[glade3/project-tree-model] glade-project: Fixed bug in glade_project_get_widget_by_name()



commit b546fec1fe5bbf73b5201c599e91731c8949929d
Author: Johannes Schmid <jhs gnome org>
Date:   Fri May 7 11:24:27 2010 +0200

    glade-project: Fixed bug in glade_project_get_widget_by_name()
    
    It should correctly interate on the list of toplevels. In addition, fixed adjust_naming_policy to
    avoid a now unnecessary check if this is really a toplevel.

 gladeui/glade-project.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 83a11b7..e4188fa 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -2397,7 +2397,7 @@ glade_project_get_widget_by_name (GladeProject *project, GladeWidget *ancestor,
 	}
 
 	/* Now try searching in only toplevel objects... */
-	for (list = project->priv->toplevels; list; list = list->next) {
+	for (list = project->priv->tree; list; list = list->next) {
 		GladeWidget *widget;
 
 		widget = glade_widget_get_from_gobject (list->data);
@@ -2821,13 +2821,9 @@ adjust_naming_policy (GladeProject       *project,
 	for (list = objects; list; list = list->next)
 	{
 		widget = glade_widget_get_from_gobject (list->data);
-		if (!widget->parent)
-       		{
-			g_object_ref (widget->object);
-			g_object_ref (widget);
-			glade_project_remove_object (project, widget->object);
-		}
-
+		g_object_ref (widget->object);
+		g_object_ref (widget);
+		glade_project_remove_object (project, widget->object);
 	}
 
 	project->priv->naming_policy = policy;
@@ -2835,13 +2831,9 @@ adjust_naming_policy (GladeProject       *project,
 	/* Put the toplevels back with the new policy (recursive operation) */
 	for (list = objects; list; list = list->next)
 	{
-		widget = glade_widget_get_from_gobject (list->data);
-		if (!widget->parent)
-		{
-			glade_project_add_object (project, project, widget->object);
-			g_object_unref (widget->object);
-			g_object_unref (widget);
-		}
+		glade_project_add_object (project, project, widget->object);
+		g_object_unref (widget->object);
+		g_object_unref (widget);
 	}
 
 	g_list_free (objects);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]