New function to handle unmerging menus at control deactivation time. (d):

2002-02-07  Christopher James Lahey  <clahey@ximian.com>

	* 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
This commit is contained in:
Christopher James Lahey
2002-02-07 20:39:09 +00:00
committed by Chris Lahey
parent ee74c23472
commit 757d9ab56d
3 changed files with 35 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2002-02-07 Christopher James Lahey <clahey@ximian.com>
* 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.
2002-02-07 Christopher James Lahey <clahey@ximian.com>
* menus/gal-view-menus.c, menus/gal-view-menus.h

View File

@ -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

View File

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