summaryrefslogtreecommitdiff
path: root/gtk/gtktoolbar.c
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@daimi.au.dk>2003-10-30 17:08:49 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2003-10-30 17:08:49 +0000
commitaca1b6f3911ddc91f7d3861337be2501b264cc67 (patch)
treed3cd0d9b89cea60e10f758672582706a17e46a50 /gtk/gtktoolbar.c
parent342646018d3634b95c0d0d92c7df64ac3011af26 (diff)
downloadgdk-pixbuf-aca1b6f3911ddc91f7d3861337be2501b264cc67.tar.gz
Make it work even when item 0 is a placeholder. (#125826) add an assertion
Thu Oct 30 17:57:53 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtktoolbar.c (logical_to_physical): Make it work even when item 0 is a placeholder. (#125826) * tests/testtoolbar.c: add an assertion that gtk_toolbar_get_nth_item (0) != NULL
Diffstat (limited to 'gtk/gtktoolbar.c')
-rw-r--r--gtk/gtktoolbar.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 9095d2ed1..f6af3f869 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -1797,19 +1797,22 @@ logical_to_physical (GtkToolbar *toolbar, gint logical)
g_assert (logical >= 0);
physical = 0;
- for (list = priv->content; list && logical > 0; list = list->next)
+ for (list = priv->content; list; list = list->next)
{
ToolbarContent *content = list->data;
if (!content->is_placeholder)
- logical--;
+ {
+ if (logical == 0)
+ break;
+ logical--;
+ }
+
physical++;
-
- if (!content->is_placeholder && logical == 0)
- break;
}
-
+
g_assert (logical == 0);
+
return physical;
}