changeset 820:19a632499344

GTK2/3 changes for similar dw_container_set_item() and dw_container_change_item() misbehavior. Also implemented dw_container_change_row_title() for GTK2/3.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 26 Mar 2011 12:52:35 +0000
parents 2dd7638a7719
children 00fa951abeb5
files gtk/dw.c gtk3/dw.c
diffstat 2 files changed, 60 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Sat Mar 26 12:49:59 2011 +0000
+++ b/gtk/dw.c	Sat Mar 26 12:52:35 2011 +0000
@@ -6994,6 +6994,24 @@
    DW_MUTEX_UNLOCK;
 }
 
+/* Internal version for both */
+void _dw_container_set_row_title(HWND handle, void *pointer, int row, char *title)
+{
+   GtkWidget *clist;
+   int _locked_by_me = FALSE;
+
+   DW_MUTEX_LOCK;
+   clist = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle));
+   if(pointer)
+   {
+      row += (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_insertpos");
+   }
+
+   if(clist)
+      gtk_clist_set_row_data(GTK_CLIST(clist), row, (gpointer)title);
+   DW_MUTEX_UNLOCK;
+}
+
 /*
  * Sets the title of a row in the container.
  * Parameters:
@@ -7003,16 +7021,19 @@
  */
 void dw_container_set_row_title(void *pointer, int row, char *title)
 {
-   GtkWidget *clist;
-   int _locked_by_me = FALSE;
-
-   DW_MUTEX_LOCK;
-   clist = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(pointer));
-   row += (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_insertpos");
-
-   if(clist)
-      gtk_clist_set_row_data(GTK_CLIST(clist), row, (gpointer)title);
-   DW_MUTEX_UNLOCK;
+   _dw_container_set_row_title(pointer, pointer, row, title);
+}
+
+/*
+ * Changes the title of a row already inserted in the container.
+ * Parameters:
+ *          handle: Handle to window (widget) of container.
+ *          row: Zero based row of data being set.
+ *          title: String title of the item.
+ */
+void dw_container_change_row_title(HWND handle, int row, char *title)
+{
+   _dw_container_set_row_title(handle, NULL, row, title);
 }
 
 /*
--- a/gtk3/dw.c	Sat Mar 26 12:49:59 2011 +0000
+++ b/gtk3/dw.c	Sat Mar 26 12:52:35 2011 +0000
@@ -5844,7 +5844,7 @@
    
    if(GTK_IS_TREE_VIEW(tree))
    {
-      _dw_container_set_item(handle, NULL, column, row, data);
+      _dw_container_set_item(handle, pointer, column, row, data);
    }
 }
 
@@ -5989,16 +5989,10 @@
 {
 }
 
-/*
- * Sets the title of a row in the container.
- * Parameters:
- *          pointer: Pointer to the allocated memory in dw_container_alloc().
- *          row: Zero based row of data being set.
- *          title: String title of the item.
- */
-void dw_container_set_row_title(void *pointer, int row, char *title)
-{
-   GtkWidget *cont = pointer;
+/* Internal version for both */
+void _dw_container_set_row_title(HWND handle, void *pointer, int row, char *title)
+{
+   GtkWidget *cont = handle;
    GtkListStore *store = NULL;
    int _locked_by_me = FALSE;
 
@@ -6027,6 +6021,30 @@
 /*
  * Sets the title of a row in the container.
  * Parameters:
+ *          pointer: Pointer to the allocated memory in dw_container_alloc().
+ *          row: Zero based row of data being set.
+ *          title: String title of the item.
+ */
+void dw_container_set_row_title(void *pointer, int row, char *title)
+{
+   _dw_container_set_row_title(pointer, pointer, row, title);
+}
+
+/*
+ * Changes the title of a row already inserted in the container.
+ * Parameters:
+ *          handle: Handle to window (widget) of container.
+ *          row: Zero based row of data being set.
+ *          title: String title of the item.
+ */
+void dw_container_change_row_title(HWND handle, int row, char *title)
+{
+   _dw_container_set_row_title(handle, NULL, row, title);
+}
+
+/*
+ * Sets the title of a row in the container.
+ * Parameters:
  *          handle: Handle to the container window (widget).
  *          pointer: Pointer to the allocated memory in dw_container_alloc().
  *          rowcount: The number of rows to be inserted.