[glade3/glade-3-8] * gladeui/glade-project.c: Restore proper sorting of objects at save time.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3/glade-3-8] * gladeui/glade-project.c: Restore proper sorting of objects at save time.
- Date: Fri, 17 Dec 2010 13:52:06 +0000 (UTC)
commit c50814537065f826b4874a7112b5c23744788cb8
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri Dec 17 22:58:08 2010 +0900
* gladeui/glade-project.c: Restore proper sorting of objects at save time.
ChangeLog | 2 ++
gladeui/glade-project.c | 44 +++++++++++++++++++++++---------------------
2 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b772783..ca830e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Added support for deprecated GtkOptionMenu.
+ * gladeui/glade-project.c: Restore proper sorting of objects at save time.
+
2010-12-17 Tristan Van Berkom <tristanvb openismus com>
* NEWS, configure.ac: Rolling 3.7.2.
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index d5c753e..d0e8796 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -1671,6 +1671,22 @@ glade_project_write_resource_path (GladeProject *project,
}
}
+static gint
+sort_project_dependancies (GObject *a, GObject *b)
+{
+ GladeWidget *ga, *gb;
+
+ ga = glade_widget_get_from_gobject (a);
+ gb = glade_widget_get_from_gobject (b);
+
+ if (glade_widget_adaptor_depends (ga->adaptor, ga, gb))
+ return 1;
+ else if (glade_widget_adaptor_depends (gb->adaptor, gb, ga))
+ return -1;
+ else
+ return strcmp (ga->name, gb->name);
+}
+
static GladeXmlContext *
glade_project_write (GladeProject *project)
{
@@ -1696,6 +1712,11 @@ glade_project_write (GladeProject *project)
glade_project_write_resource_path (project, context, root);
+ /* Sort the whole thing */
+ project->priv->objects =
+ g_list_sort (project->priv->objects,
+ (GCompareFunc)sort_project_dependancies);
+
for (list = project->priv->objects; list; list = list->next)
{
GladeWidget *widget;
@@ -2807,22 +2828,6 @@ glade_project_set_widget_name (GladeProject *project,
gtk_tree_path_free (path);
}
-static gint
-sort_project_dependancies (GObject *a, GObject *b)
-{
- GladeWidget *ga, *gb;
-
- ga = glade_widget_get_from_gobject (a);
- gb = glade_widget_get_from_gobject (b);
-
- if (glade_widget_adaptor_depends (ga->adaptor, ga, gb))
- return 1;
- else if (glade_widget_adaptor_depends (gb->adaptor, gb, ga))
- return -1;
- else
- return 1;
-}
-
static gboolean
glade_project_has_widget (GladeProject *project)
{
@@ -2918,13 +2923,10 @@ glade_project_add_object (GladeProject *project,
glade_widget_set_project (gwidget, (gpointer)project);
g_object_ref_sink (gwidget);
+ /* Be sure to update the lists before emitting signals */
if (glade_widget_get_parent (gwidget) == NULL)
- {
- project->priv->tree = g_list_insert_sorted (project->priv->tree, object,
- (GCompareFunc)sort_project_dependancies);
- }
+ project->priv->tree = g_list_append (project->priv->tree, object);
- /* Be sure to update the list before emitting signals */
project->priv->objects = g_list_prepend (project->priv->objects, object);
if (!project->priv->loading)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]