diff gtk3/dw.c @ 1322:3f1ac800bf65

Initial fix for being able to do container string comparisons instead of pointer on all platforms. Improved on the GTK2 change earlier... where it would do both comparisons with string enabled.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 06 Nov 2011 12:13:13 +0000
parents 6bebcfa03b2b
children e4ef8d86dfc4
line wrap: on
line diff
--- a/gtk3/dw.c	Sun Nov 06 11:48:24 2011 +0000
+++ b/gtk3/dw.c	Sun Nov 06 12:13:13 2011 +0000
@@ -6307,7 +6307,7 @@
    return retval;
 }
 
-int _find_iter(GtkListStore *store, GtkTreeIter *iter, char *text)
+int _find_iter(GtkListStore *store, GtkTreeIter *iter, char *text, int textcomp)
 {
    int z, rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
    char *thistext;
@@ -6317,7 +6317,7 @@
       if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, NULL, z))
       {
          gtk_tree_model_get(GTK_TREE_MODEL(store), iter, 0, &thistext, -1);
-         if(thistext == text)
+         if((textcomp && thistext && strcmp(thistext, text) == 0) || (!textcomp && thistext == text))
          {
             return TRUE;
          }
@@ -6336,10 +6336,11 @@
 {
    GtkWidget *cont;
    GtkListStore *store = NULL;
-   int _locked_by_me = FALSE;
+   int textcomp, _locked_by_me = FALSE;
 
    DW_MUTEX_LOCK;
    cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
+   textcomp = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_textcomp"));
 
    /* Make sure it is the correct tree type */
    if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
@@ -6349,7 +6350,7 @@
    {
       GtkTreeIter iter;
 
-      if(_find_iter(store, &iter, text))
+      if(_find_iter(store, &iter, text, textcomp))
       {
          GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
 
@@ -6373,10 +6374,11 @@
 {
    GtkWidget *cont;
    GtkListStore *store = NULL;
-   int _locked_by_me = FALSE;
+   int textcomp, _locked_by_me = FALSE;
 
    DW_MUTEX_LOCK;
    cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
+   textcomp = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(handle), "_dw_textcomp"));
 
    /* Make sure it is the correct tree type */
    if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
@@ -6387,7 +6389,7 @@
       GtkTreeIter iter;
       int rows = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount"));
 
-      if(_find_iter(store, &iter, text))
+      if(_find_iter(store, &iter, text, textcomp))
       {
          gtk_list_store_remove(store, &iter);
          rows--;