mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
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).
This commit is contained in:
parent
993b9db533
commit
83d5006ee4
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user