GtkOptionMenu addition


I'd like to add the function:

-- gtkoptionmenu.h --

gint       gtk_option_menu_get_item_index (GtkOptionMenu *option_menu);

-- gtkoptionmenu.c --

gtk_option_menu_get_item_index (GtkOptionMenu *option_menu)
  gint res = -1;

  g_return_val_if_fail (option_menu != NULL, -1);
  g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), -1);

  if (option_menu->menu && GTK_MENU (option_menu->menu)->old_active_menu_item)
    res = g_list_index (GTK_MENU_SHELL (option_menu->menu)->children,
                        GTK_MENU (option_menu->menu)->old_active_menu_item);

  return res;


As you see, this function simply returns the active item's index. I've
found this to be useful sometimes. I'm aware this can be accomplished using
gtk_object_set_data() et al as well, but I rather thought this was nicer.

If you find it agreeable, could someone commit it? Perhaps a similar function for
GtkMenu would be a good thing.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]