[maemo-commits] [maemo-commits] r13764 - in projects/haf/trunk/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Sep 12 10:40:09 EEST 2007
Author: jobi
Date: 2007-09-12 10:40:05 +0300 (Wed, 12 Sep 2007)
New Revision: 13764

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
Log:

2007-09-12 Johan Bilien  <johan.bilien at nokia.com>

	* libhildondesktop/hildon-home-area.c
	(hildon_home_area_place.c): treat the case where a widget
	previously placed has not been allocated a size yet.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-11 15:11:20 UTC (rev 13763)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-12 07:40:05 UTC (rev 13764)
@@ -1,3 +1,9 @@
+2007-09-12 Johan Bilien  <johan.bilien at nokia.com>
+
+	* libhildondesktop/hildon-home-area.c
+	(hildon_home_area_place.c): treat the case where a widget
+	previously placed has not been allocated a size yet.
+
 2007-09-11  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* libhildondesktop/hildon-desktop-popup-menu.c

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-09-11 15:11:20 UTC (rev 13763)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-home-area.c	2007-09-12 07:40:05 UTC (rev 13764)
@@ -1603,6 +1603,7 @@
   GdkRectangle r = {0};
   gint x, y;
   gint padding;
+  guint width, height;
 
   gtk_container_child_get (GTK_CONTAINER (widget->parent), widget,
                            "x", &x,
@@ -1613,17 +1614,31 @@
                 "applet-padding", &padding,
                 NULL);
 
+  if (widget->allocation.width == 1 && widget->allocation.height == 1)
+  {
+    GtkRequisition req;
+
+    gtk_widget_size_request (widget, &req);
+    width = req.width;
+    height = req.height;
+  }
+  else
+  {
+    width = widget->allocation.width;
+    height = widget->allocation.height;
+  }
+
   r.x = x?x-padding:0;
   r.y = y?y-padding:0;
 
-  r.width = widget->allocation.width;
-  if (x + widget->allocation.width != widget->parent->allocation.width)
+  r.width = width;
+  if (x + width != widget->parent->allocation.width)
     r.width += padding;
   if (x)
     r.width += padding;
 
-  r.height = widget->allocation.height;
-  if (y + widget->allocation.height != widget->parent->allocation.height)
+  r.height = height;
+  if (y + height != widget->parent->allocation.height)
     r.height += padding;
   if (y)
     r.height += padding;
@@ -2086,7 +2101,6 @@
 
   g_return_if_fail (HILDON_IS_HOME_AREA (area) && GTK_IS_WIDGET (widget));
 
-  g_debug ("setting parent");
   if (widget->parent != GTK_WIDGET (area))
     gtk_widget_set_parent (widget, GTK_WIDGET (area));
 


More information about the maemo-commits mailing list