[libgd] header-bar: ensure widgets packed at pack_end will be appended
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd] header-bar: ensure widgets packed at pack_end will be appended
- Date: Wed, 20 Feb 2013 15:56:51 +0000 (UTC)
commit 34da80eaebfe28ee4913840a45d799577de28b97
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Feb 20 10:55:37 2013 -0500
header-bar: ensure widgets packed at pack_end will be appended
When packing widgets to the end, they're currently prepended to the others
with pack_type = END. We should respect the order of the caller instead
when allocating them.
libgd/gd-header-bar.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/libgd/gd-header-bar.c b/libgd/gd-header-bar.c
index f8ea3a2..12f289c 100644
--- a/libgd/gd-header-bar.c
+++ b/libgd/gd-header-bar.c
@@ -482,18 +482,21 @@ gd_header_bar_size_allocate (GtkWidget *widget,
else
x = allocation->x + allocation->width - priv->hpadding;
- i = 0;
- for (l = priv->children; l; l = l->next)
+ if (packing == GTK_PACK_START)
+ l = priv->children;
+ else
+ l = g_list_last (priv->children);
+
+ i = g_list_position (priv->children, l);
+
+ for (l; l != NULL; (packing == GTK_PACK_START) ? (l = l->next) : (l = l->prev))
{
child = l->data;
if (!gtk_widget_get_visible (child->widget))
continue;
if (child->pack_type != packing)
- {
- i++;
- continue;
- }
+ goto next;
child_size = sizes[i].minimum_size;
@@ -518,7 +521,12 @@ gd_header_bar_size_allocate (GtkWidget *widget,
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) -
child_allocation.width;
gtk_widget_size_allocate (child->widget, &child_allocation);
- i++;
+
+ next:
+ if (packing == GTK_PACK_START)
+ i++;
+ else
+ i--;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]