[glade] GtkBox adaptor: Handle internal widgets properly
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GtkBox adaptor: Handle internal widgets properly
- Date: Wed, 1 May 2013 14:57:53 +0000 (UTC)
commit 0a5c552095f3d1fdd28f2fac41e56ecbabca9a22
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Wed May 1 23:54:42 2013 +0900
GtkBox adaptor: Handle internal widgets properly
plugins/gtk+/glade-gtk-box.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-box.c b/plugins/gtk+/glade-gtk-box.c
index a30fa9f..1eac6a3 100644
--- a/plugins/gtk+/glade-gtk-box.c
+++ b/plugins/gtk+/glade-gtk-box.c
@@ -68,20 +68,22 @@ glade_gtk_box_post_create (GladeWidgetAdaptor * adaptor,
}
static gint
-sort_box_children (GtkWidget * widget_a, GtkWidget * widget_b)
+sort_box_children (GtkWidget * widget_a, GtkWidget * widget_b, GtkWidget *box)
{
- GtkWidget *box;
GladeWidget *gwidget_a, *gwidget_b;
gint position_a, position_b;
gwidget_a = glade_widget_get_from_gobject (widget_a);
gwidget_b = glade_widget_get_from_gobject (widget_b);
- box = gtk_widget_get_parent (widget_a);
+ /* Indirect children might be internal children, sort internal children before any other children */
+ if (box != gtk_widget_get_parent (widget_a))
+ return -1;
+ if (box != gtk_widget_get_parent (widget_b))
+ return 1;
/* XXX Sometimes the packing "position" property doesnt exist here, why ?
*/
-
if (gwidget_a)
glade_widget_pack_property_get (gwidget_a, "position", &position_a);
else
@@ -98,11 +100,13 @@ sort_box_children (GtkWidget * widget_a, GtkWidget * widget_b)
GList *
glade_gtk_box_get_children (GladeWidgetAdaptor * adaptor,
- GtkContainer * container)
+ GObject * container)
{
- GList *children = glade_util_container_get_all_children (container);
+ GList *children;
+
+ children = GWA_GET_CLASS (GTK_TYPE_CONTAINER)->get_children (adaptor, container);
- return g_list_sort (children, (GCompareFunc) sort_box_children);
+ return g_list_sort_with_data (children, (GCompareDataFunc) sort_box_children, container);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]