summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2013-11-21 16:54:28 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2013-11-21 16:58:30 -0300
commit27b7e1c87cb439dc99fdea8e2e5924a514602181 (patch)
tree5ce8bacee83d3e51de47355a788c1645eb49a07f
parentb9d0f5f579fd0120708bd9ee8fab76d79eb05b64 (diff)
downloadglade-27b7e1c87cb439dc99fdea8e2e5924a514602181.tar.gz
Fixed GtkBox virtual size property value on load.
This bug was introduced by commit 787cc5cac5d1950ac57783478279a9135c640995 which fixed Bug 652655 "Setting entry on combobox moves the widget"
-rw-r--r--plugins/gtk+/glade-gtk-box.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/plugins/gtk+/glade-gtk-box.c b/plugins/gtk+/glade-gtk-box.c
index d41304af..00c02cef 100644
--- a/plugins/gtk+/glade-gtk-box.c
+++ b/plugins/gtk+/glade-gtk-box.c
@@ -221,18 +221,23 @@ glade_gtk_box_set_child_property (GladeWidgetAdaptor * adaptor,
}
+static gint
+glade_gtk_box_get_num_children (GObject *box)
+{
+ GList *children = gtk_container_get_children (GTK_CONTAINER (box));
+ gint retval = g_list_length (children);
+ g_list_free (children);
+ return retval;
+}
+
void
glade_gtk_box_get_property (GladeWidgetAdaptor * adaptor,
GObject * object, const gchar * id, GValue * value)
{
if (!strcmp (id, "size"))
{
- GtkBox *box = GTK_BOX (object);
- GList *children = gtk_container_get_children (GTK_CONTAINER (box));
-
g_value_reset (value);
- g_value_set_int (value, g_list_length (children));
- g_list_free (children);
+ g_value_set_int (value, glade_gtk_box_get_num_children (object));
}
else
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->get_property (adaptor, object, id,
@@ -414,7 +419,6 @@ glade_gtk_box_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
{
GladeWidget *gbox, *gchild;
- GList *children;
gint num_children;
g_return_if_fail (GTK_IS_BOX (object));
@@ -446,14 +450,7 @@ glade_gtk_box_add_child (GladeWidgetAdaptor * adaptor,
}
gtk_container_add (GTK_CONTAINER (object), GTK_WIDGET (child));
-
- if (glade_widget_superuser ())
- return;
-
- children = gtk_container_get_children (GTK_CONTAINER (object));
- num_children = g_list_length (children);
- g_list_free (children);
-
+ num_children = glade_gtk_box_get_num_children (object);
glade_widget_property_set (gbox, "size", num_children);
gchild = glade_widget_get_from_gobject (child);
@@ -464,11 +461,14 @@ glade_gtk_box_add_child (GladeWidgetAdaptor * adaptor,
if (gchild)
glade_widget_set_pack_action_visible (gchild, "remove_slot", FALSE);
+ fix_response_id_on_child (gbox, child, TRUE);
+
+ if (glade_widget_superuser ())
+ return;
+
/* Packing props arent around when parenting during a glade_widget_dup() */
if (gchild && glade_widget_get_packing_properties (gchild))
glade_widget_pack_property_set (gchild, "position", num_children - 1);
-
- fix_response_id_on_child (gbox, child, TRUE);
}
void