*
* Copyright (C) 2007 Nokia Corporation, all rights reserved.
*
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
* Author: Xan Lopez <xan.lopez@nokia.com>
*
* This library is free software; you can redistribute it and/or
* implemented if needed. See #HildonBreadCrumb for more details.
*/
+#undef HILDON_DISABLE_DEPRECATED
+
#include <gdk/gdkkeysyms.h>
+
#include "hildon-marshalers.h"
#include "hildon-bread-crumb-trail.h"
#include "hildon-bread-crumb-widget.h"
GList *p, *first_show, *first_hide;
gint back_button_size;
HildonBreadCrumbTrailPrivate *priv = HILDON_BREAD_CRUMB_TRAIL (widget)->priv;
+ gboolean rtl;
+
+ /* Get the rtl status */
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
widget->allocation = *allocation;
allocation_width = allocation->width - 2 * border_width;
/* Allocate the back button */
- child_allocation.x = allocation->x + border_width;
+ if (rtl)
+ child_allocation.x = allocation->width - border_width;
+ else
+ child_allocation.x = allocation->x + border_width;
+
child_allocation.y = allocation->y + border_width;
gtk_widget_get_child_requisition (priv->back_button, &child_requisition);
/* We want the back button to be a square */
back_button_size = MAX (child_requisition.width, child_requisition.height);
child_allocation.width = child_allocation.height = back_button_size;
+
+ if (rtl)
+ child_allocation.x -= back_button_size;
+
gtk_widget_size_allocate (priv->back_button, &child_allocation);
- child_allocation.x += back_button_size;
+
+ if (!rtl)
+ child_allocation.x += back_button_size;
/* If there are no buttons there's nothing else to do */
if (priv->item_list == NULL)
{
first_hide = p->next;
gtk_widget_set_child_visible (child, TRUE);
+
+ if (rtl)
+ child_allocation.x -= child_allocation.width;
+
gtk_widget_size_allocate (child, &child_allocation);
- child_allocation.x += child_allocation.width;
+
+ if (!rtl)
+ child_allocation.x += child_allocation.width;
}
else
{
child_allocation.width = natural_width;
gtk_widget_set_child_visible (child, TRUE);
+
+ if (rtl)
+ child_allocation.x -= child_allocation.width;
+
gtk_widget_size_allocate (child, &child_allocation);
- child_allocation.x += child_allocation.width;
+
+ if (!rtl)
+ child_allocation.x += child_allocation.width;
}
for (p = first_hide; p; p = p->next)
{
item = HILDON_BREAD_CRUMB (p->data);
- child = GTK_WIDGET (item);
-
gtk_widget_set_child_visible (GTK_WIDGET (item), FALSE);
}
}
hildon_bread_crumb_trail_remove (GtkContainer *container,
GtkWidget *widget)
{
- GList *p;
+ GList *p, *next;
HildonBreadCrumbTrailPrivate *priv;
gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
while (p)
{
+ next = p->next;
+
if (widget == GTK_WIDGET (p->data))
{
g_signal_handlers_disconnect_by_func (widget, G_CALLBACK (crumb_activated_cb),
HILDON_BREAD_CRUMB_TRAIL (container));
gtk_widget_unparent (widget);
- priv->item_list = g_list_remove_link (priv->item_list, p);
- g_list_free (p);
+ priv->item_list = g_list_delete_link (priv->item_list, p);
hildon_bread_crumb_trail_update_back_button_sensitivity (HILDON_BREAD_CRUMB_TRAIL (container));
}
}
- p = p->next;
+ p = next;
}
}