diff gtk3/dw.c @ 787:098458f3bdfb

Fixes some missing checks for combobox causing GTK warnings running HandyFTP.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 22 Mar 2011 04:29:45 +0000
parents 0e251c2f5d08
children f8f4f72d6462
line wrap: on
line diff
--- a/gtk3/dw.c	Tue Mar 22 01:26:36 2011 +0000
+++ b/gtk3/dw.c	Tue Mar 22 04:29:45 2011 +0000
@@ -1480,20 +1480,22 @@
       
          _dw_recursing = 1;
 
-         gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter);       
-         path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
-        
-         if(path)
+         if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
          {
-            gint *indices = gtk_tree_path_get_indices(path);
-            
-            if(indices)
+            path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+           
+            if(path)
             {
-               int (*selectfunc)(HWND, int, void *) = work.func;
+               gint *indices = gtk_tree_path_get_indices(path);
                
-               retval = selectfunc(work.window, indices[0], work.data);
+               if(indices)
+               {
+                  int (*selectfunc)(HWND, int, void *) = work.func;
+                  
+                  retval = selectfunc(work.window, indices[0], work.data);
+               }
+               gtk_tree_path_free(path);
             }
-            gtk_tree_path_free(path);
          }
          
          _dw_recursing = 0;
@@ -4136,10 +4138,9 @@
 
    if(gtk_widget_get_window(handle) && icon_pixbuf)
    {
-      GList *list = g_list_alloc();
-      list = g_list_append(list, icon_pixbuf);
+      GList *list = g_list_append(NULL, icon_pixbuf);
       gdk_window_set_icon_list(gtk_widget_get_window(handle), list);
-      g_object_unref(G_OBJECT(list));
+      g_list_free(list);
    }
    DW_MUTEX_UNLOCK;
 }
@@ -8995,16 +8996,23 @@
          /* Get the nth child at the top level */
          if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index))
          {
-            GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2));
-            if(state)
+            if(GTK_IS_COMBO_BOX(handle2))
             {
-               /* Select the item */
-               gtk_tree_selection_select_iter(sel, &iter);
+               gtk_combo_box_set_active_iter(GTK_COMBO_BOX(handle2), &iter);
             }
             else
             {
-               /* Deselect the item */
-               gtk_tree_selection_unselect_iter(sel, &iter);
+               GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2));
+               if(state)
+               {
+                  /* Select the item */
+                  gtk_tree_selection_select_iter(sel, &iter);
+               }
+               else
+               {
+                  /* Deselect the item */
+                  gtk_tree_selection_unselect_iter(sel, &iter);
+               }
             }
          }
       }