[glade/glade-3-10] * gladeui/glade-project.c: Fix glade_project_notify_has_child() to notify that the children are go
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/glade-3-10] * gladeui/glade-project.c: Fix glade_project_notify_has_child() to notify that the children are go
- Date: Sun, 9 Oct 2011 21:59:32 +0000 (UTC)
commit 48baf1a8127c4d57a2235a143c7f0e52c209992d
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Oct 9 17:58:16 2011 -0400
* 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
ChangeLog | 7 +++++++
gladeui/glade-project.c | 36 +++++++++++++++++-------------------
2 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 87bf90f..a7d31d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 27ad165..f28f9c3 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -2559,28 +2559,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);
+ }
}
}
@@ -2599,7 +2601,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
@@ -2874,7 +2876,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);
}
@@ -4184,8 +4186,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,
@@ -4211,7 +4211,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]);
@@ -4224,7 +4223,6 @@ glade_project_model_get_iter (GtkTreeModel *model,
}
widget = glade_widget_get_from_gobject (object);
- debug_widget = widget;
}
if (object)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]