diff options
author | Arvind Samptur <arvind.samptur@wipro.com> | 2002-07-12 02:01:53 +0000 |
---|---|---|
committer | Mark McLoughlin <mmclouglin@src.gnome.org> | 2002-07-12 02:01:53 +0000 |
commit | 97adc1833a5b73fdfbf1047ac94680ae4d4295bc (patch) | |
tree | a044a5ef888fd238d58681b9496c8497508c3843 | |
parent | cdab689a73e7ee020fa9d8bda1af90a757d102e2 (diff) | |
download | gnome-desktop-97adc1833a5b73fdfbf1047ac94680ae4d4295bc.tar.gz |
Get the menuitem index and set the option menu with
2002-06-19 Arvind Samptur <arvind.samptur@wipro.com>
* gnome-ditem-edit.c: (setup_option) Get the
menuitem index and set the option menu with
gtk_option_menu_set_history. Fixes #85782
-rw-r--r-- | libgnome-desktop/ChangeLog | 6 | ||||
-rw-r--r-- | libgnome-desktop/gnome-ditem-edit.c | 37 |
2 files changed, 31 insertions, 12 deletions
diff --git a/libgnome-desktop/ChangeLog b/libgnome-desktop/ChangeLog index c0d487e8..b5ea381d 100644 --- a/libgnome-desktop/ChangeLog +++ b/libgnome-desktop/ChangeLog @@ -1,3 +1,9 @@ +2002-06-19 Arvind Samptur <arvind.samptur@wipro.com> + + * gnome-ditem-edit.c: (setup_option) Get the + menuitem index and set the option menu with + gtk_option_menu_set_history. Fixes #85782 + 2002-07-10 jacob berkman <jacob@ximian.com> * gnome-desktop-item.c (gnome_desktop_item_new_from_uri): diff --git a/libgnome-desktop/gnome-ditem-edit.c b/libgnome-desktop/gnome-ditem-edit.c index aa71f2d4..2dcbdb1a 100644 --- a/libgnome-desktop/gnome-ditem-edit.c +++ b/libgnome-desktop/gnome-ditem-edit.c @@ -174,18 +174,23 @@ enum { #define TYPE_STRING "GnomeDitemEdit:TypeString" static void -add_menuitem (GtkWidget *menu, const char *str, const char *label, - const char *select, GtkWidget **selected) +add_menuitem (GtkWidget *menu, + const char *str, + const char *label, + const char *select, + GtkWidget **selected) { - GtkWidget *item = gtk_menu_item_new_with_label (label); + GtkWidget *item; + + item = gtk_menu_item_new_with_label (label); gtk_widget_show (item); + g_object_set_data_full (G_OBJECT (item), TYPE_STRING, - g_strdup (str), - (GDestroyNotify)g_free); + g_strdup (str), (GDestroyNotify) g_free); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - if (select != NULL && - strcmp (str, select) == 0) + if (selected && select && !strcmp (str, select)) *selected = item; } @@ -225,14 +230,22 @@ setup_option (GnomeDItemEdit *dee, break; } - if (select != NULL && - selected == NULL) + if (select && selected) add_menuitem (menu, select, _(select), select, &selected); - if (selected != NULL) - gtk_menu_item_activate (GTK_MENU_ITEM (selected)); - gtk_option_menu_set_menu (GTK_OPTION_MENU (dee->_priv->type_option), menu); + + if (selected) { + GList *children; + int pos; + + children = gtk_container_get_children (GTK_CONTAINER (menu)); + pos = g_list_index (children, selected); + g_list_free (children); + + gtk_option_menu_set_history (GTK_OPTION_MENU (dee->_priv->type_option), pos); + } + } static const char * |