mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 20:50:12 +00:00
TreeMenu: Don't manually reinvent g_list_index()
g_list_index() "Gets the position of the element containing the given data (starting from 0)." That is exactly what we were manually doing.
This commit is contained in:
parent
009c256991
commit
08bafb4a52
@ -988,18 +988,11 @@ static gint
|
|||||||
menu_item_position (GtkTreeMenu *menu,
|
menu_item_position (GtkTreeMenu *menu,
|
||||||
GtkWidget *item)
|
GtkWidget *item)
|
||||||
{
|
{
|
||||||
GList *children, *l;
|
GList *children;
|
||||||
gint position;
|
gint position;
|
||||||
|
|
||||||
children = gtk_container_get_children (GTK_CONTAINER (menu));
|
children = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||||
for (position = 0, l = children; l; position++, l = l->next)
|
position = g_list_index (children, item);
|
||||||
{
|
|
||||||
GtkWidget *iitem = l->data;
|
|
||||||
|
|
||||||
if (item == iitem)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (children);
|
g_list_free (children);
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
|
Loading…
Reference in New Issue
Block a user