From 757d9ab56d294b70f9dcd9e0f5aad34f224eae9e Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Thu, 7 Feb 2002 20:39:09 +0000 Subject: New function to handle unmerging menus at control deactivation time. (d): 2002-02-07 Christopher James Lahey * menus/gal-view-menus.c, menus/gal-view-menus.h (gal_view_menus_unmerge): New function to handle unmerging menus at control deactivation time. (d): Turned off debugging output here. (build_menus): Gave the separators names and marked them with f="" to make them work better with bonobo 1. svn path=/trunk/; revision=15599 --- widgets/menus/gal-view-menus.c | 37 +++++++++++++++++++++++-------------- widgets/menus/gal-view-menus.h | 4 +++- 2 files changed, 26 insertions(+), 15 deletions(-) (limited to 'widgets/menus') diff --git a/widgets/menus/gal-view-menus.c b/widgets/menus/gal-view-menus.c index 351308e654..312f492a7f 100644 --- a/widgets/menus/gal-view-menus.c +++ b/widgets/menus/gal-view-menus.c @@ -47,7 +47,8 @@ static void collection_changed (GalViewCollection *collection, static void instance_changed (GalViewInstance *instance, GalViewMenus *gvm); -#define d(x) x +#define d(x) +#define CURRENT_VIEW_PATH "/menu/View/ViewBegin/CurrentView" static void closure_free (void *data, void *user_data) @@ -137,10 +138,7 @@ gvm_destroy (GtkObject *object) remove_instance (gvm); - if (gvm->priv->component) { - bonobo_object_unref (BONOBO_OBJECT (gvm->priv->component)); - gvm->priv->component = NULL; - } + gal_view_menus_unmerge (gvm, NULL); g_free(gvm->priv); gvm->priv = NULL; @@ -313,6 +311,9 @@ build_menus(GalViewMenus *menus) if (id == NULL) { menuitem = bonobo_ui_node_new_child(submenu, "separator"); + bonobo_ui_node_set_attr(menuitem, "name", "GalView:first_sep"); + bonobo_ui_node_set_attr(menuitem, "f", ""); + menuitem = bonobo_ui_node_new_child(submenu, "menuitem"); bonobo_ui_node_set_attr(menuitem, "name", "custom_view"); @@ -337,6 +338,8 @@ build_menus(GalViewMenus *menus) } menuitem = bonobo_ui_node_new_child(submenu, "separator"); + bonobo_ui_node_set_attr(menuitem, "name", "GalView:second_sep"); + bonobo_ui_node_set_attr(menuitem, "f", ""); menuitem = bonobo_ui_node_new_child(submenu, "menuitem"); bonobo_ui_node_set_attr(menuitem, "name", "DefineViews"); @@ -390,18 +393,13 @@ set_radio (GalViewMenus *gvm, g_free (id); } -#define CURRENT_VIEW_PATH "/menu/View/ViewBegin/CurrentView" static void build_stuff (GalViewMenus *gvm, CORBA_Environment *ev) { char *xml; - d(g_print ("%s:\n", __FUNCTION__)); - if (bonobo_ui_component_path_exists (gvm->priv->component, CURRENT_VIEW_PATH, ev)) { - d(g_print ("%s: Removing path\n", __FUNCTION__)); - bonobo_ui_component_rm (gvm->priv->component, CURRENT_VIEW_PATH, ev); - } + gal_view_menus_unmerge (gvm, ev); remove_listeners(gvm); remove_xml(gvm); @@ -417,7 +415,7 @@ build_stuff (GalViewMenus *gvm, void gal_view_menus_apply (GalViewMenus *gvm, BonoboUIComponent *component, - CORBA_Environment *ev) + CORBA_Environment *opt_ev) { if (component != gvm->priv->component) { if (component) @@ -429,8 +427,19 @@ gal_view_menus_apply (GalViewMenus *gvm, gvm->priv->component = component; - build_stuff (gvm, ev); - set_radio (gvm, ev); + build_stuff (gvm, opt_ev); + set_radio (gvm, opt_ev); +} + +void +gal_view_menus_unmerge (GalViewMenus *gvm, + CORBA_Environment *opt_ev) +{ + d(g_print ("%s:\n", __FUNCTION__)); + if (bonobo_ui_component_path_exists (gvm->priv->component, CURRENT_VIEW_PATH, opt_ev)) { + d(g_print ("%s: Removing path\n", __FUNCTION__)); + bonobo_ui_component_rm (gvm->priv->component, CURRENT_VIEW_PATH, opt_ev); + } } static void diff --git a/widgets/menus/gal-view-menus.h b/widgets/menus/gal-view-menus.h index 0ab299e4d7..208d49761c 100644 --- a/widgets/menus/gal-view-menus.h +++ b/widgets/menus/gal-view-menus.h @@ -31,7 +31,9 @@ GalViewMenus *gal_view_menus_construct (GalViewMenus *menus, void gal_view_menus_apply (GalViewMenus *menus, BonoboUIComponent *component, - CORBA_Environment *ev); + CORBA_Environment *opt_ev); +void gal_view_menus_unmerge (GalViewMenus *gvm, + CORBA_Environment *opt_ev); void gal_view_menus_set_instance (GalViewMenus *gvm, GalViewInstance *instance); -- cgit