comparison 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
comparison
equal deleted inserted replaced
786:0e251c2f5d08 787:098458f3bdfb
1478 GtkTreeIter iter; 1478 GtkTreeIter iter;
1479 GtkTreePath *path; 1479 GtkTreePath *path;
1480 1480
1481 _dw_recursing = 1; 1481 _dw_recursing = 1;
1482 1482
1483 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter); 1483 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
1484 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
1485
1486 if(path)
1487 { 1484 {
1488 gint *indices = gtk_tree_path_get_indices(path); 1485 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
1489 1486
1490 if(indices) 1487 if(path)
1491 { 1488 {
1492 int (*selectfunc)(HWND, int, void *) = work.func; 1489 gint *indices = gtk_tree_path_get_indices(path);
1493 1490
1494 retval = selectfunc(work.window, indices[0], work.data); 1491 if(indices)
1492 {
1493 int (*selectfunc)(HWND, int, void *) = work.func;
1494
1495 retval = selectfunc(work.window, indices[0], work.data);
1496 }
1497 gtk_tree_path_free(path);
1495 } 1498 }
1496 gtk_tree_path_free(path);
1497 } 1499 }
1498 1500
1499 _dw_recursing = 0; 1501 _dw_recursing = 0;
1500 } 1502 }
1501 } 1503 }
4134 DW_MUTEX_LOCK; 4136 DW_MUTEX_LOCK;
4135 icon_pixbuf = _find_pixbuf(icon, NULL, NULL); 4137 icon_pixbuf = _find_pixbuf(icon, NULL, NULL);
4136 4138
4137 if(gtk_widget_get_window(handle) && icon_pixbuf) 4139 if(gtk_widget_get_window(handle) && icon_pixbuf)
4138 { 4140 {
4139 GList *list = g_list_alloc(); 4141 GList *list = g_list_append(NULL, icon_pixbuf);
4140 list = g_list_append(list, icon_pixbuf);
4141 gdk_window_set_icon_list(gtk_widget_get_window(handle), list); 4142 gdk_window_set_icon_list(gtk_widget_get_window(handle), list);
4142 g_object_unref(G_OBJECT(list)); 4143 g_list_free(list);
4143 } 4144 }
4144 DW_MUTEX_UNLOCK; 4145 DW_MUTEX_UNLOCK;
4145 } 4146 }
4146 4147
4147 /* 4148 /*
8993 GtkTreeIter iter; 8994 GtkTreeIter iter;
8994 8995
8995 /* Get the nth child at the top level */ 8996 /* Get the nth child at the top level */
8996 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) 8997 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index))
8997 { 8998 {
8998 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); 8999 if(GTK_IS_COMBO_BOX(handle2))
8999 if(state)
9000 { 9000 {
9001 /* Select the item */ 9001 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(handle2), &iter);
9002 gtk_tree_selection_select_iter(sel, &iter);
9003 } 9002 }
9004 else 9003 else
9005 { 9004 {
9006 /* Deselect the item */ 9005 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2));
9007 gtk_tree_selection_unselect_iter(sel, &iter); 9006 if(state)
9007 {
9008 /* Select the item */
9009 gtk_tree_selection_select_iter(sel, &iter);
9010 }
9011 else
9012 {
9013 /* Deselect the item */
9014 gtk_tree_selection_unselect_iter(sel, &iter);
9015 }
9008 } 9016 }
9009 } 9017 }
9010 } 9018 }
9011 } 9019 }
9012 DW_MUTEX_UNLOCK; 9020 DW_MUTEX_UNLOCK;