For menu items with submenus, destroy the item along with the submenu.

Tue Jan 30 16:39:25 2001  Owen Taylor  <otaylor@redhat.com>

	* 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 '<foo>/abcd...'
	properly.

	* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
	later.
This commit is contained in:
Owen Taylor
2001-01-30 21:44:48 +00:00
committed by Owen Taylor
parent db6d3a0ed7
commit 7431b6b3d6
10 changed files with 96 additions and 18 deletions

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -1,3 +1,13 @@
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* 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 '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where

View File

@@ -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);
}
}

View File

@@ -2387,11 +2387,19 @@ static GtkItemFactoryEntry menu_items[] =
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_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, "<Branch>" },
{ "/Preferences/ShouldNotAppear/SubItem1", NULL, gtk_ifactory_cb, 0 },
{ "/Preferences/ShouldNotAppear/SubItem2", NULL, gtk_ifactory_cb, 0 },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/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

View File

@@ -2387,11 +2387,19 @@ static GtkItemFactoryEntry menu_items[] =
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_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, "<Branch>" },
{ "/Preferences/ShouldNotAppear/SubItem1", NULL, gtk_ifactory_cb, 0 },
{ "/Preferences/ShouldNotAppear/SubItem2", NULL, gtk_ifactory_cb, 0 },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/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