[glade3] * plugins/gtk+/glade-gtk.c: Sync up size requests of fixed/layout children



commit cd43350649676baf63c329e2b9d34a88025a8c2e
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat Jun 6 13:49:22 2009 -0400

    	* plugins/gtk+/glade-gtk.c: Sync up size requests of fixed/layout children
    	at load time (bug 584334).
---
 ChangeLog                |    5 +++++
 plugins/gtk+/glade-gtk.c |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 969ff87..750f74e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-06  Tristan Van Berkom <tvb gnome org>
+	
+	* plugins/gtk+/glade-gtk.c: Sync up size requests of fixed/layout children
+	at load time (bug 584334).
+
 2009-05-27  Tristan Van Berkom <tvb gnome org>
 
 	* configure.ac, NEWS: Updating for 3.6.4 ... [ NOT ROLLED YET ]
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index d45edfa..f6a2216 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -4884,12 +4884,39 @@ glade_gtk_fixed_layout_realize (GtkWidget *widget)
 	else
 		gdk_window_set_back_pixmap (widget->window, backing, FALSE);
 
+
 	/* For cleanup later
 	 */
 	g_object_weak_ref(G_OBJECT(widget), 
 			  (GWeakNotify)glade_gtk_fixed_layout_finalize, backing);
 }
 
+static void
+glade_gtk_fixed_layout_sync_size_requests (GtkWidget   *widget)
+{
+	GList *children, *l;
+
+	if ((children = gtk_container_get_children (GTK_CONTAINER (widget))) != NULL)
+       	{
+		for (l = children; l; l = l->next)
+	       	{
+			GtkWidget *child = l->data;
+			GladeWidget *gchild = glade_widget_get_from_gobject (child);
+			gint width = -1, height = -1;
+
+			if (!gchild)
+				continue;
+
+			glade_widget_property_get (gchild, "width-request", &width);
+			glade_widget_property_get (gchild, "height-request", &height);
+	
+			gtk_widget_set_size_request (child, width, height);
+			
+		}
+		g_list_free (children);
+	}
+}
+
 void
 glade_gtk_fixed_layout_post_create (GladeWidgetAdaptor *adaptor,
 				    GObject            *object, 
@@ -4902,6 +4929,13 @@ glade_gtk_fixed_layout_post_create (GladeWidgetAdaptor *adaptor,
 	 */
 	g_signal_connect_after(object, "realize",
 			       G_CALLBACK(glade_gtk_fixed_layout_realize), NULL);
+
+
+	/* Sync up size request at project load time */
+	if (reason == GLADE_CREATE_LOAD)
+		g_signal_connect_after(object, "realize",
+				       G_CALLBACK(glade_gtk_fixed_layout_sync_size_requests), NULL);
+
 }
 
 void



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