diff --git a/ChangeLog b/ChangeLog index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e5c2a6bc54..836d35d27f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Tue Jan 30 16:39:25 2001 Owen Taylor + + * gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu + items with submenus, destroy the item along with the submenu. + (#7841, Brian Masney(?)) Also, handle paths of the form '/abcd...' + properly. + + * gtk/testgtk.c (menu_items): Add a dummy branch that we delete + later. + Tue Jan 30 15:51:25 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c index a9988ef82c..e69bda71c1 100644 --- a/gtk/gtkitemfactory.c +++ b/gtk/gtkitemfactory.c @@ -1304,8 +1304,7 @@ gtk_item_factory_delete_item (GtkItemFactory *ifactory, const gchar *path) { GtkItemFactoryClass *class; - GtkItemFactoryItem *item; - gchar *fpath; + GtkWidget *widget; g_return_if_fail (ifactory != NULL); g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory)); @@ -1313,25 +1312,14 @@ gtk_item_factory_delete_item (GtkItemFactory *ifactory, class = GTK_ITEM_FACTORY_CLASS (GTK_OBJECT (ifactory)->klass); - fpath = g_strconcat (ifactory->path, path, NULL); - item = g_hash_table_lookup (class->item_ht, fpath); - g_free (fpath); + widget = gtk_item_factory_get_widget (ifactory, path); - if (item) + if (widget) { - GtkWidget *widget = NULL; - GSList *slist; + if (GTK_IS_MENU (widget)) + widget = gtk_menu_get_attach_widget (GTK_MENU (widget)); - for (slist = item->widgets; slist; slist = slist->next) - { - widget = slist->data; - - if (gtk_item_factory_from_widget (widget) == ifactory) - break; - } - - if (slist) - gtk_widget_destroy (widget); + gtk_widget_destroy (widget); } } diff --git a/gtk/testgtk.c b/gtk/testgtk.c index bb5c4b8497..bec851a6b6 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -2387,11 +2387,19 @@ static GtkItemFactoryEntry menu_items[] = { "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "" }, { "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" }, { "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" }, + { "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" }, + { "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" }, + + /* For testing deletion of menus */ + { "/_Preferences/Should_NotAppear", NULL, 0, 0, "" }, + { "/Preferences/ShouldNotAppear/SubItem1", NULL, gtk_ifactory_cb, 0 }, + { "/Preferences/ShouldNotAppear/SubItem2", NULL, gtk_ifactory_cb, 0 }, { "/_Help", NULL, 0, 0, "" }, { "/Help/_About", NULL, gtk_ifactory_cb, 0 }, }; + static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); static void @@ -2464,6 +2472,8 @@ create_item_factory (void) GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_grab_default (button); + gtk_item_factory_delete_item (item_factory, "/Preferences/ShouldNotAppear"); + gtk_widget_show_all (window); } else diff --git a/tests/testgtk.c b/tests/testgtk.c index bb5c4b8497..bec851a6b6 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2387,11 +2387,19 @@ static GtkItemFactoryEntry menu_items[] = { "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "" }, { "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" }, { "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" }, + { "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" }, + { "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" }, + + /* For testing deletion of menus */ + { "/_Preferences/Should_NotAppear", NULL, 0, 0, "" }, + { "/Preferences/ShouldNotAppear/SubItem1", NULL, gtk_ifactory_cb, 0 }, + { "/Preferences/ShouldNotAppear/SubItem2", NULL, gtk_ifactory_cb, 0 }, { "/_Help", NULL, 0, 0, "" }, { "/Help/_About", NULL, gtk_ifactory_cb, 0 }, }; + static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); static void @@ -2464,6 +2472,8 @@ create_item_factory (void) GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_grab_default (button); + gtk_item_factory_delete_item (item_factory, "/Preferences/ShouldNotAppear"); + gtk_widget_show_all (window); } else