diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2011-10-09 17:58:16 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2011-10-09 18:02:40 -0400 |
commit | 1277357a9ae6725a5f55e5494ce112c2e5c0d118 (patch) | |
tree | 94fe2b56565018e80dd097bfb1fa0e0a80907ed6 | |
parent | d20f63e55b3b153e48f1ec1ae4ea6c9da4b135ec (diff) | |
download | glade-1277357a9ae6725a5f55e5494ce112c2e5c0d118.tar.gz |
* gladeui/glade-project.c: Fix glade_project_notify_has_child() to notify
that the children are gone only when the last item on that level disappears.
Fixes bug 651673
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | gladeui/glade-project.c | 36 |
2 files changed, 24 insertions, 19 deletions
@@ -1,3 +1,10 @@ +2011-10-09 Tristan Van Berkom <tvb@gnome.org> + + * gladeui/glade-project.c: Fix glade_project_notify_has_child() to notify + that the children are gone only when the last item on that level disappears. + + Fixes bug 651673 + 2011-10-09 Fabien Parent <parent.f@gmail.com> * gladeui/glade-property.c, gladeui/glade-xml-utils.c: diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c index 651c2f27..b0244c08 100644 --- a/gladeui/glade-project.c +++ b/gladeui/glade-project.c @@ -2688,28 +2688,30 @@ glade_project_set_widget_name (GladeProject *project, } static void -glade_project_notify_row_has_child (GladeProject *project, GladeWidget *gwidget) +glade_project_notify_row_has_child (GladeProject *project, + GladeWidget *gwidget, + gboolean adding) { GladeWidget *parent; gint siblings; - + parent = glade_widget_get_parent (gwidget); if (parent) { siblings = glade_project_count_children (project, parent); - if (siblings == 1) - { - GtkTreePath *path; - GtkTreeIter iter; - - glade_project_model_get_iter_for_object (project, glade_widget_get_object (parent), &iter); - - path = gtk_tree_model_get_path (GTK_TREE_MODEL (project), &iter); - gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (project), path, &iter); - gtk_tree_path_free (path); - } + if (siblings == (adding ? 1 : 0)) + { + GtkTreePath *path; + GtkTreeIter iter; + + glade_project_model_get_iter_for_object (project, + glade_widget_get_object (parent), &iter); + path = gtk_tree_model_get_path (GTK_TREE_MODEL (project), &iter); + gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (project), path, &iter); + gtk_tree_path_free (path); + } } } @@ -2728,7 +2730,7 @@ glade_project_notify_row_inserted (GladeProject *project, GladeWidget *gwidget) gtk_tree_model_row_inserted (GTK_TREE_MODEL (project), path, &iter); gtk_tree_path_free (path); - glade_project_notify_row_has_child (project, gwidget); + glade_project_notify_row_has_child (project, gwidget, TRUE); } static void @@ -3192,7 +3194,7 @@ glade_project_remove_object (GladeProject *project, GObject *object) glade_widget_set_project (gwidget, NULL); glade_widget_set_in_project (gwidget, FALSE); - glade_project_notify_row_has_child (project, gwidget); + glade_project_notify_row_has_child (project, gwidget, FALSE); g_object_unref (gwidget); } @@ -4511,8 +4513,6 @@ glade_project_model_get_column_type (GtkTreeModel *model, gint column) } } -GladeWidget *debug_widget; - static gboolean glade_project_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter, @@ -4538,7 +4538,6 @@ glade_project_model_get_iter (GtkTreeModel *model, return FALSE; } - debug_widget = widget; for (i = 1; i < depth; i++) { object = glade_project_nth_child (project, widget, indices[i]); @@ -4551,7 +4550,6 @@ glade_project_model_get_iter (GtkTreeModel *model, } widget = glade_widget_get_from_gobject (object); - debug_widget = widget; } if (object) |