summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-17 23:50:02 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-17 23:50:02 +0900
commit300eeca773564dc44a4b65159b5b971c21a033cc (patch)
tree7d37d5ea2395f4fd7705c4410c308c7cbd1367b6 /plugins
parent9fd4f17e819fcaaab7b92edf373afbdc4dd798c9 (diff)
downloadglade-300eeca773564dc44a4b65159b5b971c21a033cc.tar.gz
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Alphabetically sort GtkBox children for save.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtk+/glade-gtk.c25
-rw-r--r--plugins/gtk+/gtk+.xml.in1
2 files changed, 24 insertions, 2 deletions
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 40965b1d..23294460 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1411,7 +1411,6 @@ glade_gtk_container_get_child_property (GladeWidgetAdaptor *adaptor,
property_name, value);
}
-
GList *
glade_gtk_container_get_children (GladeWidgetAdaptor *adaptor,
GtkContainer *container)
@@ -1701,6 +1700,29 @@ sort_box_children (GtkWidget *widget_a, GtkWidget *widget_b)
return position_a - position_b;
}
+static gint
+alpha_sort_box_children (GtkWidget *a, GtkWidget *b)
+{
+ GladeWidget *ga, *gb;
+
+ ga = glade_widget_get_from_gobject (a);
+ gb = glade_widget_get_from_gobject (b);
+
+ if (!ga || !gb)
+ return 1;
+ else
+ return strcmp (ga->name, gb->name);
+}
+
+GList *
+glade_gtk_box_get_children (GladeWidgetAdaptor *adaptor,
+ GtkContainer *container)
+{
+ GList *children = glade_util_container_get_all_children (container);
+
+ return g_list_sort (children, (GCompareFunc)alpha_sort_box_children);
+}
+
void
glade_gtk_box_set_child_property (GladeWidgetAdaptor *adaptor,
GObject *container,
@@ -1816,7 +1838,6 @@ glade_gtk_box_set_child_property (GladeWidgetAdaptor *adaptor,
}
-
void
glade_gtk_box_get_property (GladeWidgetAdaptor *adaptor,
GObject *object,
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 445028c0..d0588368 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -296,6 +296,7 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkBox" _title="Box" fixed="True">
<post-create-function>glade_gtk_box_post_create</post-create-function>
<get-internal-child-function>glade_gtk_box_get_internal_child</get-internal-child-function>
+ <get-children-function>glade_gtk_box_get_children</get-children-function>
<set-property-function>glade_gtk_box_set_property</set-property-function>
<get-property-function>glade_gtk_box_get_property</get-property-function>
<verify-function>glade_gtk_box_verify_property</verify-function>