Commit 83d5006e authored by Soeren Sandmann's avatar Soeren Sandmann Committed by Søren Sandmann Pedersen

Make sure we actually return the index of a real item. (get_nth_item)

Thu Oct 30 16:20:58 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
	return the index of a real item.
	(get_nth_item) assert that the returned items is not a
	placeholder.  (#125826, Marco Pesenti Gritti).
parent 993b9db5
Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
return the index of a real item.
(get_nth_item) assert that the returned items is not a
placeholder. (#125826, Marco Pesenti Gritti).
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
......
Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
return the index of a real item.
(get_nth_item) assert that the returned items is not a
placeholder. (#125826, Marco Pesenti Gritti).
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
......
Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
return the index of a real item.
(get_nth_item) assert that the returned items is not a
placeholder. (#125826, Marco Pesenti Gritti).
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
......
Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
return the index of a real item.
(get_nth_item) assert that the returned items is not a
placeholder. (#125826, Marco Pesenti Gritti).
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
......
Thu Oct 30 16:20:58 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktoolbar.c (logical_to_physical): Make sure we actually
return the index of a real item.
(get_nth_item) assert that the returned items is not a
placeholder. (#125826, Marco Pesenti Gritti).
2003-10-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkcellrendererseptext.c
......
......@@ -1797,15 +1797,18 @@ 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--;
physical++;
}
if (!content->is_placeholder && logical == 0)
break;
}
g_assert (logical == 0);
return physical;
}
......@@ -2730,20 +2733,26 @@ gtk_toolbar_get_nth_item (GtkToolbar *toolbar,
{
GtkToolbarPrivate *priv;
ToolbarContent *content;
gint n_items;
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
if (!gtk_toolbar_check_new_api (toolbar))
return NULL;
n_items = gtk_toolbar_get_n_items (toolbar);
if (n < 0 || n >= n_items)
return NULL;
priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
content = g_list_nth_data (priv->content, logical_to_physical (toolbar, n));
if (content)
return content->item;
return NULL;
g_assert (content);
g_assert (!content->is_placeholder);
return content->item;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment