From eec3b5a2f3d0d4ca1211c0f3ddec19e707cfbf22 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 14 May 2002 07:04:49 +0000 Subject: Made it so that if the current_id doesn't match any of the given ids, it 2002-05-14 Christopher James Lahey * menus/gal-view-menus.c (build_menus): Made it so that if the current_id doesn't match any of the given ids, it treats it the same as a NULL id. (gal_view_menus_apply): Added a check for gvm->priv == NULL here. (gal_view_menus_apply, collection_changed, instance_changed): Removed calls to set_radio after build_stuff, since the last thing build_stuff does is calls set_radio. svn path=/trunk/; revision=16781 --- widgets/ChangeLog | 10 ++++++++++ widgets/menus/gal-view-menus.c | 14 ++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/widgets/ChangeLog b/widgets/ChangeLog index 51047e0201..f66377522c 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,13 @@ +2002-05-14 Christopher James Lahey + + * menus/gal-view-menus.c (build_menus): Made it so that if the + current_id doesn't match any of the given ids, it treats it the + same as a NULL id. + (gal_view_menus_apply): Added a check for gvm->priv == NULL here. + (gal_view_menus_apply, collection_changed, instance_changed): + Removed calls to set_radio after build_stuff, since the last thing + build_stuff does is calls set_radio. + 2002-02-27 Larry Ewing * misc/e-combo-button.c (impl_button_press_event): make a right diff --git a/widgets/menus/gal-view-menus.c b/widgets/menus/gal-view-menus.c index 312f492a7f..6c796dd6ee 100644 --- a/widgets/menus/gal-view-menus.c +++ b/widgets/menus/gal-view-menus.c @@ -252,6 +252,7 @@ build_menus(GalViewMenus *menus) GalViewInstance *instance = menus->priv->instance; GalViewCollection *collection = instance->collection; char *id; + gboolean found = FALSE; root = bonobo_ui_node_new("Root"); menu = bonobo_ui_node_new_child(root, "menu"); @@ -269,6 +270,7 @@ build_menus(GalViewMenus *menus) id = gal_view_instance_get_current_view_id (instance); + length = gal_view_collection_get_count(collection); menus->priv->listenerClosures = e_list_new (closure_copy, closure_free, menus); @@ -300,6 +302,10 @@ build_menus(GalViewMenus *menus) closure->id = item->id; closure->ref_count = 1; + if (!found && id && !strcmp (item->id, id)) { + found = TRUE; + } + gtk_object_ref (GTK_OBJECT(closure->instance)); bonobo_ui_component_add_listener (menus->priv->component, item->id, toggled_cb, closure); @@ -308,7 +314,7 @@ build_menus(GalViewMenus *menus) closure_free (closure, menus); } - if (id == NULL) { + if (!found) { menuitem = bonobo_ui_node_new_child(submenu, "separator"); bonobo_ui_node_set_attr(menuitem, "name", "GalView:first_sep"); @@ -417,6 +423,9 @@ gal_view_menus_apply (GalViewMenus *gvm, BonoboUIComponent *component, CORBA_Environment *opt_ev) { + if (gvm->priv == NULL) + return; + if (component != gvm->priv->component) { if (component) bonobo_object_ref (BONOBO_OBJECT (component)); @@ -428,7 +437,6 @@ gal_view_menus_apply (GalViewMenus *gvm, gvm->priv->component = component; build_stuff (gvm, opt_ev); - set_radio (gvm, opt_ev); } void @@ -450,7 +458,6 @@ collection_changed (GalViewCollection *collection, CORBA_exception_init (&ev); build_stuff(gvm, &ev); - set_radio (gvm, &ev); CORBA_exception_free (&ev); } @@ -462,7 +469,6 @@ instance_changed (GalViewInstance *instance, CORBA_exception_init (&ev); build_stuff(gvm, &ev); - set_radio (gvm, &ev); CORBA_exception_free (&ev); } -- cgit v1.2.3