{
GtkWidget *back_button;
GList *item_list;
- gchar *path_separator;
};
/* Signals */
{
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);
/* 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 */
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;
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);
&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)
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)));
}
gint *natural_width,
gint *natural_height)
{
- GtkRequisition req;
+ GtkRequisition widget_req, label_req;
gint width, height;
PangoLayout *layout;
HildonBreadCrumbPrivate *priv;
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*