From 16502247dfe1bc30c9b7b2e21ffca6ecb5c3b41e Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 3 Dec 1999 20:15:32 +0000 Subject: New function, long needed. Fri Dec 3 14:09:50 1999 Owen Taylor * gtk/gtkoptionmenu.[ch] (gtk_option_menu_get_history): New function, long needed. Wed Dec 1 22:35:43 1999 Owen Taylor * gdk/gdkproperty.h x11/gdkproperty.c: Change only_if_exists argument of gdk_atom_intern to bool. --- gtk/gtkoptionmenu.c | 15 +++++++++++++++ gtk/gtkoptionmenu.h | 1 + 2 files changed, 16 insertions(+) (limited to 'gtk') diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index f0ce53d69..c4d4009e0 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -244,6 +244,21 @@ gtk_option_menu_set_history (GtkOptionMenu *option_menu, } } +gint +gtk_option_menu_get_history (GtkOptionMenu *option_menu) +{ + GtkWidget *active_widget; + + g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), -1); + + active_widget = gtk_menu_get_active (GTK_MENU (option_menu->menu)); + + if (active_widget) + return g_list_index (GTK_MENU_SHELL (option_menu->menu)->children, + active_widget); + else + return -1; +} static void gtk_option_menu_destroy (GtkObject *object) diff --git a/gtk/gtkoptionmenu.h b/gtk/gtkoptionmenu.h index 84ac0ede8..bdd84bc0b 100644 --- a/gtk/gtkoptionmenu.h +++ b/gtk/gtkoptionmenu.h @@ -70,6 +70,7 @@ GtkWidget* gtk_option_menu_get_menu (GtkOptionMenu *option_menu); void gtk_option_menu_set_menu (GtkOptionMenu *option_menu, GtkWidget *menu); void gtk_option_menu_remove_menu (GtkOptionMenu *option_menu); +gint gtk_option_menu_get_history (GtkOptionMenu *option_menu); void gtk_option_menu_set_history (GtkOptionMenu *option_menu, guint index); -- cgit v1.2.1