aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/menus
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/menus')
-rw-r--r--widgets/menus/gal-view-menus.c81
-rw-r--r--widgets/menus/gal-view-menus.h27
2 files changed, 67 insertions, 41 deletions
diff --git a/widgets/menus/gal-view-menus.c b/widgets/menus/gal-view-menus.c
index 6e703c0cce..aa73e8ac32 100644
--- a/widgets/menus/gal-view-menus.c
+++ b/widgets/menus/gal-view-menus.c
@@ -32,6 +32,8 @@ struct _GalViewMenusPrivate {
BonoboUIComponent *component;
EList *listenerClosures;
GtkWidget *define_views_dialog;
+
+ guint show_define_views : 1;
};
typedef struct {
@@ -177,6 +179,7 @@ gvm_init (GalViewMenus *gvm)
gvm->priv->component = NULL;
gvm->priv->listenerClosures = NULL;
gvm->priv->define_views_dialog = NULL;
+ gvm->priv->show_define_views = TRUE;
}
E_MAKE_TYPE(gal_view_menus, "GalViewMenus", GalViewMenus, gvm_class_init, gvm_init, PARENT_TYPE);
@@ -337,47 +340,49 @@ build_menus(GalViewMenus *menus)
closure_free (closure, menus);
}
- if (!found) {
+ if (menus->priv->show_define_views) {
+ if (!found) {
- 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, "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");
- bonobo_ui_node_set_attr(menuitem, "id", "custom_view");
- bonobo_ui_node_set_attr(menuitem, "group", "GalViewMenus");
- bonobo_ui_node_set_attr(menuitem, "type", "radio");
- /* bonobo displays this string so it must be in locale */
- bonobo_ui_node_set_attr(menuitem, "_label", N_("Custom View"));
+ menuitem = bonobo_ui_node_new_child(submenu, "menuitem");
+ bonobo_ui_node_set_attr(menuitem, "name", "custom_view");
+ bonobo_ui_node_set_attr(menuitem, "id", "custom_view");
+ bonobo_ui_node_set_attr(menuitem, "group", "GalViewMenus");
+ bonobo_ui_node_set_attr(menuitem, "type", "radio");
+ /* bonobo displays this string so it must be in locale */
+ bonobo_ui_node_set_attr(menuitem, "_label", N_("Custom View"));
- command = bonobo_ui_node_new_child (commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", "custom_view");
- bonobo_ui_node_set_attr(command, "group", "GalViewMenus");
+ command = bonobo_ui_node_new_child (commands, "cmd");
+ bonobo_ui_node_set_attr(command, "name", "custom_view");
+ bonobo_ui_node_set_attr(command, "group", "GalViewMenus");
+ menuitem = bonobo_ui_node_new_child(submenu, "menuitem");
+ bonobo_ui_node_set_attr(menuitem, "name", "SaveCurrentView");
+ bonobo_ui_node_set_attr(menuitem, "_label", N_("Save Custom View"));
+ bonobo_ui_node_set_attr(menuitem, "verb", "");
+
+ command = bonobo_ui_node_new_child(commands, "cmd");
+ bonobo_ui_node_set_attr(command, "name", "SaveCurrentView");
+ }
+
+ 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", "SaveCurrentView");
- bonobo_ui_node_set_attr(menuitem, "_label", N_("Save Custom View"));
+ bonobo_ui_node_set_attr(menuitem, "name", "DefineViews");
+ bonobo_ui_node_set_attr(menuitem, "_label", N_("Define Views"));
bonobo_ui_node_set_attr(menuitem, "verb", "");
command = bonobo_ui_node_new_child(commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", "SaveCurrentView");
+ bonobo_ui_node_set_attr(command, "name", "DefineViews");
}
- 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");
- bonobo_ui_node_set_attr(menuitem, "_label", N_("Define Views"));
- bonobo_ui_node_set_attr(menuitem, "verb", "");
-
- command = bonobo_ui_node_new_child(commands, "cmd");
- bonobo_ui_node_set_attr(command, "name", "DefineViews");
-
string = bonobo_ui_node_to_string(root, TRUE);
xml = g_strdup(string);
bonobo_ui_node_free_string(string);
@@ -442,6 +447,24 @@ build_stuff (GalViewMenus *gvm,
}
void
+gal_view_menus_set_show_define_views (GalViewMenus *gvm,
+ gboolean show_define_views)
+{
+ if (gvm->priv->show_define_views == show_define_views)
+ return;
+
+ gvm->priv->show_define_views = show_define_views;
+
+ if (gvm->priv->component) {
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ build_stuff(gvm, &ev);
+ CORBA_exception_free (&ev);
+ }
+}
+
+void
gal_view_menus_apply (GalViewMenus *gvm,
BonoboUIComponent *component,
CORBA_Environment *opt_ev)
diff --git a/widgets/menus/gal-view-menus.h b/widgets/menus/gal-view-menus.h
index 208d49761c..257d987217 100644
--- a/widgets/menus/gal-view-menus.h
+++ b/widgets/menus/gal-view-menus.h
@@ -24,17 +24,20 @@ typedef struct {
GtkObjectClass parent_class;
} GalViewMenusClass;
-GtkType gal_view_menus_get_type (void);
-GalViewMenus *gal_view_menus_new (GalViewInstance *instance);
-GalViewMenus *gal_view_menus_construct (GalViewMenus *menus,
- GalViewInstance *instance);
-
-void gal_view_menus_apply (GalViewMenus *menus,
- BonoboUIComponent *component,
- 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);
+GtkType gal_view_menus_get_type (void);
+GalViewMenus *gal_view_menus_new (GalViewInstance *instance);
+GalViewMenus *gal_view_menus_construct (GalViewMenus *menus,
+ GalViewInstance *instance);
+
+void gal_view_menus_set_show_define_views (GalViewMenus *menus,
+ gboolean show_define_views);
+
+void gal_view_menus_apply (GalViewMenus *menus,
+ BonoboUIComponent *component,
+ 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);
#endif /* _GAL_VIEW_MENUS_H_ */