[maemo-commits] [maemo-commits] r11088 - in projects/haf/trunk/hildon-1: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Apr 16 16:42:30 EEST 2007
Author: xan
Date: 2007-04-16 16:42:07 +0300 (Mon, 16 Apr 2007)
New Revision: 11088

Modified:
   projects/haf/trunk/hildon-1/ChangeLog
   projects/haf/trunk/hildon-1/src/hildon-bread-crumb-trail.c
   projects/haf/trunk/hildon-1/src/hildon-bread-crumb.c
Log:
	* src/hildon-bread-crumb.c:
	* src/hildon-bread-crumb-trail.c:

	Some cleanups.


Modified: projects/haf/trunk/hildon-1/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-1/ChangeLog	2007-04-16 13:41:04 UTC (rev 11087)
+++ projects/haf/trunk/hildon-1/ChangeLog	2007-04-16 13:42:07 UTC (rev 11088)
@@ -1,3 +1,10 @@
+2007-04-16  Xan Lopez  <xan.lopez at nokia.com>
+
+	* src/hildon-bread-crumb.c:
+	* src/hildon-bread-crumb-trail.c:
+
+	Some cleanups.
+
 2007-04-16  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	[1.0.1 release]

Modified: projects/haf/trunk/hildon-1/src/hildon-bread-crumb-trail.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-bread-crumb-trail.c	2007-04-16 13:41:04 UTC (rev 11087)
+++ projects/haf/trunk/hildon-1/src/hildon-bread-crumb-trail.c	2007-04-16 13:42:07 UTC (rev 11088)
@@ -31,7 +31,6 @@
 {
   GtkWidget *back_button;
   GList *item_list;
-  gchar *path_separator;
 };
 
 /* Signals */
@@ -145,7 +144,6 @@
 {
   HildonBreadCrumbTrailPrivate *priv = HILDON_BREAD_CRUMB_TRAIL (object)->priv;
 
-  g_free (priv->path_separator);
   g_list_free (priv->item_list);
 
   G_OBJECT_CLASS (hildon_bread_crumb_trail_parent_class)->finalize (object);
@@ -193,7 +191,10 @@
   /* Button requisitions */
   for (p = priv->item_list; p; p = p->next)
     {
-      gtk_widget_size_request (GTK_WIDGET (p->data), &child_requisition);
+      GtkWidget *child = GTK_WIDGET (p->data);
+
+      if (GTK_WIDGET_VISIBLE (child))
+        gtk_widget_size_request (child, &child_requisition);
     }
 
   /* Border width */
@@ -229,8 +230,8 @@
   allocation_width = allocation->width - 2 * border_width;
 
   /* Allocate the back button */
-  child_allocation.x = allocation->x;
-  child_allocation.y = allocation->y;
+  child_allocation.x = allocation->x + border_width;
+  child_allocation.y = allocation->y + border_width;
   gtk_widget_get_child_requisition (priv->back_button, &child_requisition);
   child_allocation.width = child_requisition.width;
   child_allocation.height = child_requisition.height;
@@ -250,6 +251,10 @@
   first_hide = NULL; 
   extra_space = 0;
 
+  gtk_widget_style_get (widget,
+                        "maximum-width", &maximum_width,
+                        NULL);
+
   for (p = priv->item_list; p; p = p->next)
     {
       item = HILDON_BREAD_CRUMB (p->data);
@@ -260,10 +265,6 @@
                                            &natural_width,
                                            &natural_height);
 
-      gtk_widget_style_get (widget,
-                            "maximum-width", &maximum_width,
-                            NULL);
-
       desired_width = MIN (natural_width, maximum_width);
 
       if (width + desired_width <= allocation_width)
@@ -379,7 +380,6 @@
       child = GTK_WIDGET (priv->item_list->data);
     }
 
-  /* We need the item for the ID */
   g_signal_emit (bct, bread_crumb_trail_signals[CRUMB_CLICKED], 0,
                  get_bread_crumb_id (HILDON_BREAD_CRUMB (child)));
 }

Modified: projects/haf/trunk/hildon-1/src/hildon-bread-crumb.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-bread-crumb.c	2007-04-16 13:41:04 UTC (rev 11087)
+++ projects/haf/trunk/hildon-1/src/hildon-bread-crumb.c	2007-04-16 13:42:07 UTC (rev 11088)
@@ -234,7 +234,7 @@
                                      gint *natural_width,
                                      gint *natural_height)
 {
-  GtkRequisition req;
+  GtkRequisition widget_req, label_req;
   gint width, height;
   PangoLayout *layout;
   HildonBreadCrumbPrivate *priv;
@@ -243,28 +243,29 @@
 
   priv = item->priv;
 
-  gtk_widget_size_request (GTK_WIDGET (item), &req);
-  if (natural_width)
-    *natural_width = req.width;
+  gtk_widget_size_request (GTK_WIDGET (item), &widget_req);
 
-  if (natural_height)
-    *natural_height = req.height;
-  /* Substract the size request of the label */
-  gtk_widget_size_request (priv->label, &req);
-  if (natural_width)
-    *natural_width -= req.width;
   layout = gtk_widget_create_pango_layout (priv->label, priv->text);
   pango_layout_get_size (layout, &width, &height);
   g_object_unref (layout);
 
   if (natural_width)
-    *natural_width += PANGO_PIXELS (width);
-  /* Border width */
-  if (natural_width)
-    *natural_width += GTK_CONTAINER (item)->border_width * 2;
+    {
+      *natural_width = widget_req.width;
+      /* Substract the size request of the label */
+      gtk_widget_size_request (priv->label, &label_req);
+      *natural_width -= label_req.width;
 
+      /* Add the "natural" width for the label */
+      *natural_width += PANGO_PIXELS (width);
+      *natural_width += GTK_CONTAINER (item)->border_width * 2;
+    }
+
   if (natural_height)
-    *natural_height += GTK_CONTAINER (item)->border_width * 2;
+    {
+      *natural_height = widget_req.height;
+      *natural_height += GTK_CONTAINER (item)->border_width * 2;
+    }
 }
 
 GtkWidget*


More information about the maemo-commits mailing list