From d7494c8f160b12e1199b06dcafdc8ff01b24b796 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 4 Mar 2010 15:26:59 -0500 Subject: Shell and UI manager cleanups. Replace the EVO_EXPRESS environment variable with an --express command line option. (Note, this adds a new translatable string for --help.) Add an EUIManager class with an "express-mode" property and custom load functions that use our new "express" preprocessor. This replaces the UI manager functions in e-utils.c. (Also going to see if I can get GTK+ to add an "add_ui_from_string" method to GtkUIManagerClass that we can override. Then we could just call gtk_ui_manager_add_ui_from_string() and the preprocessor would automatically do its thing and chain up.) Add an "express-mode" read-only GObject property to EShell. Add e_shell_configure_ui_manager() to e-shell-utils.c. For now this just creates a one-way property binding: EShell:express-mode -> EUIManager:express-mode Call this immediately after e_ui_manager_new(). (EUIManager can't do this itself because it lives too low in the dependency hierarchy and doesn't know about EShell.) --- e-util/e-plugin-ui.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'e-util/e-plugin-ui.c') diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c index 133455b108..9a9a4f23ed 100644 --- a/e-util/e-plugin-ui.c +++ b/e-util/e-plugin-ui.c @@ -16,7 +16,9 @@ */ #include "e-plugin-ui.h" + #include "e-util.h" +#include "e-ui-manager.h" #include @@ -165,7 +167,7 @@ static gpointer parent_class; static void plugin_ui_hook_unregister_manager (EPluginUIHook *hook, - GtkUIManager *ui_manager) + EUIManager *ui_manager) { GHashTable *registry; @@ -176,7 +178,7 @@ plugin_ui_hook_unregister_manager (EPluginUIHook *hook, static void plugin_ui_hook_register_manager (EPluginUIHook *hook, - GtkUIManager *ui_manager, + EUIManager *ui_manager, const gchar *id, gpointer user_data) { @@ -227,7 +229,7 @@ plugin_ui_hook_register_manager (EPluginUIHook *hook, static guint plugin_ui_hook_merge_ui (EPluginUIHook *hook, - GtkUIManager *ui_manager, + EUIManager *ui_manager, const gchar *id) { GHashTable *hash_table; @@ -239,7 +241,7 @@ plugin_ui_hook_merge_ui (EPluginUIHook *hook, ui_definition = g_hash_table_lookup (hash_table, id); g_return_val_if_fail (ui_definition != NULL, 0); - merge_id = e_load_ui_manager_definition_from_string ( + merge_id = e_ui_manager_add_ui_from_string ( ui_manager, ui_definition, &error); if (error != NULL) { @@ -252,7 +254,7 @@ plugin_ui_hook_merge_ui (EPluginUIHook *hook, static void plugin_ui_enable_manager (EPluginUIHook *hook, - GtkUIManager *ui_manager, + EUIManager *ui_manager, const gchar *id) { GHashTable *hash_table; @@ -300,7 +302,7 @@ plugin_ui_enable_manager (EPluginUIHook *hook, static void plugin_ui_disable_manager (EPluginUIHook *hook, - GtkUIManager *ui_manager, + EUIManager *ui_manager, const gchar *id, gboolean remove) { @@ -336,7 +338,8 @@ plugin_ui_disable_manager (EPluginUIHook *hook, /* Merge ID could be 0 if the plugin is disabled. */ if (merge_id > 0) - gtk_ui_manager_remove_ui (ui_manager, merge_id); + gtk_ui_manager_remove_ui ( + GTK_UI_MANAGER (ui_manager), merge_id); if (remove) g_hash_table_remove (hash_table, id); @@ -358,7 +361,7 @@ plugin_ui_enable_hook (EPluginUIHook *hook) g_hash_table_iter_init (&iter, hash_table); while (g_hash_table_iter_next (&iter, &key, NULL)) { - GtkUIManager *ui_manager = key; + EUIManager *ui_manager = key; plugin_ui_enable_manager (hook, ui_manager, NULL); } } @@ -376,7 +379,7 @@ plugin_ui_disable_hook (EPluginUIHook *hook) g_hash_table_iter_init (&iter, hash_table); while (g_hash_table_iter_next (&iter, &key, NULL)) { - GtkUIManager *ui_manager = key; + EUIManager *ui_manager = key; plugin_ui_disable_manager (hook, ui_manager, NULL, FALSE); } } @@ -546,13 +549,13 @@ e_plugin_ui_hook_get_type (void) } void -e_plugin_ui_register_manager (GtkUIManager *ui_manager, +e_plugin_ui_register_manager (EUIManager *ui_manager, const gchar *id, gpointer user_data) { GSList *plugin_list; - g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager)); + g_return_if_fail (E_IS_UI_MANAGER (ui_manager)); g_return_if_fail (id != NULL); /* Loop over all installed plugins. */ @@ -586,12 +589,12 @@ e_plugin_ui_register_manager (GtkUIManager *ui_manager, } void -e_plugin_ui_enable_manager (GtkUIManager *ui_manager, +e_plugin_ui_enable_manager (EUIManager *ui_manager, const gchar *id) { GSList *plugin_list; - g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager)); + g_return_if_fail (E_IS_UI_MANAGER (ui_manager)); g_return_if_fail (id != NULL); /* Loop over all installed plugins. */ @@ -615,12 +618,12 @@ e_plugin_ui_enable_manager (GtkUIManager *ui_manager, } void -e_plugin_ui_disable_manager (GtkUIManager *ui_manager, +e_plugin_ui_disable_manager (EUIManager *ui_manager, const gchar *id) { GSList *plugin_list; - g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager)); + g_return_if_fail (E_IS_UI_MANAGER (ui_manager)); g_return_if_fail (id != NULL); /* Loop over all installed plugins. */ -- cgit v1.2.3