diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-24 05:41:01 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2009-01-24 05:41:01 +0800 |
commit | bd9f473a896496b95b9896d30940f2ab27493432 (patch) | |
tree | 7c314e4776bcfbff0c483ee7995818519fbc43bb /shell | |
parent | 3c7a575407bef757d434808904a4c4dc1ba60cb3 (diff) | |
download | gsoc2013-evolution-bd9f473a896496b95b9896d30940f2ab27493432.tar.gz gsoc2013-evolution-bd9f473a896496b95b9896d30940f2ab27493432.tar.zst gsoc2013-evolution-bd9f473a896496b95b9896d30940f2ab27493432.zip |
Redesign EPluginUI to accommodate merging and unmerging shell views.
Get the "mark-all-read" and "plugin-manager" plugins working.
svn path=/branches/kill-bonobo/; revision=37125
Diffstat (limited to 'shell')
-rw-r--r-- | shell/e-shell-view.c | 57 | ||||
-rw-r--r-- | shell/e-shell-view.h | 6 | ||||
-rw-r--r-- | shell/e-shell-window.c | 6 |
3 files changed, 44 insertions, 25 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index f1f1ffb476..d7a564c567 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -25,6 +25,7 @@ #include <glib/gi18n.h> #include "e-util/e-util.h" +#include "e-util/e-plugin-ui.h" #include "e-shell-content.h" #include "e-shell-module.h" @@ -76,7 +77,7 @@ static gpointer parent_class; static gulong signals[LAST_SIGNAL]; static void -shell_view_init_view_collection (EShellViewClass *shell_view_class) +shell_view_init_view_collection (EShellViewClass *class) { EShellModule *shell_module; const gchar *base_dir; @@ -84,8 +85,8 @@ shell_view_init_view_collection (EShellViewClass *shell_view_class) gchar *system_dir; gchar *local_dir; - shell_module = E_SHELL_MODULE (shell_view_class->type_module); - module_name = shell_view_class->type_module->name; + shell_module = E_SHELL_MODULE (class->type_module); + module_name = class->type_module->name; base_dir = EVOLUTION_GALVIEWSDIR; system_dir = g_build_filename (base_dir, module_name, NULL); @@ -94,15 +95,13 @@ shell_view_init_view_collection (EShellViewClass *shell_view_class) local_dir = g_build_filename (base_dir, "views", NULL); /* The view collection is never destroyed. */ - shell_view_class->view_collection = gal_view_collection_new (); + class->view_collection = gal_view_collection_new (); gal_view_collection_set_title ( - shell_view_class->view_collection, - shell_view_class->label); + class->view_collection, class->label); gal_view_collection_set_storage_directories ( - shell_view_class->view_collection, - system_dir, local_dir); + class->view_collection, system_dir, local_dir); g_free (system_dir); g_free (local_dir); @@ -319,13 +318,22 @@ shell_view_finalize (GObject *object) static void shell_view_constructed (GObject *object) { + EShellWindow *shell_window; EShellView *shell_view; EShellViewClass *class; + GtkUIManager *ui_manager; GtkWidget *widget; + const gchar *id; shell_view = E_SHELL_VIEW (object); class = E_SHELL_VIEW_GET_CLASS (object); + shell_window = e_shell_view_get_shell_window (shell_view); + ui_manager = e_shell_window_get_ui_manager (shell_window); + id = class->ui_manager_id; + + e_plugin_ui_register_manager (ui_manager, id, shell_view); + /* Invoke factory methods. */ widget = class->new_shell_content (shell_view); @@ -345,21 +353,24 @@ static void shell_view_toggled (EShellView *shell_view) { EShellViewPrivate *priv = shell_view->priv; - EShellViewClass *shell_view_class; + EShellViewClass *class; EShellWindow *shell_window; GtkUIManager *ui_manager; const gchar *basename; gboolean view_is_active; - shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); + class = E_SHELL_VIEW_GET_CLASS (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); view_is_active = e_shell_view_is_active (shell_view); - basename = shell_view_class->ui_definition; + basename = class->ui_definition; - if (view_is_active && priv->merge_id == 0) + if (view_is_active && priv->merge_id == 0) { priv->merge_id = e_load_ui_definition (ui_manager, basename); - else if (!view_is_active && priv->merge_id != 0) { + e_plugin_ui_enable_manager (ui_manager, class->ui_manager_id); + + } else if (!view_is_active && priv->merge_id != 0) { + e_plugin_ui_disable_manager (ui_manager, class->ui_manager_id); gtk_ui_manager_remove_ui (ui_manager, priv->merge_id); priv->merge_id = 0; } @@ -581,7 +592,7 @@ shell_view_class_init (EShellViewClass *class) static void shell_view_init (EShellView *shell_view, - EShellViewClass *shell_view_class) + EShellViewClass *class) { GtkSizeGroup *size_group; @@ -590,8 +601,8 @@ shell_view_init (EShellView *shell_view, shell_view->priv = E_SHELL_VIEW_GET_PRIVATE (shell_view); shell_view->priv->size_group = size_group; - if (shell_view_class->view_collection == NULL) - shell_view_init_view_collection (shell_view_class); + if (class->view_collection == NULL) + shell_view_init_view_collection (class); } GType @@ -785,17 +796,17 @@ e_shell_view_get_shell_window (EShellView *shell_view) EShellModule * e_shell_view_get_shell_module (EShellView *shell_view) { - EShellViewClass *shell_view_class; + EShellViewClass *class; g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); /* Calling this function during the shell view's instance * initialization function will return the wrong result, * so watch for that and emit a warning. */ - shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); - g_return_val_if_fail (E_IS_SHELL_VIEW_CLASS (shell_view_class), NULL); + class = E_SHELL_VIEW_GET_CLASS (shell_view); + g_return_val_if_fail (E_IS_SHELL_VIEW_CLASS (class), NULL); - return E_SHELL_MODULE (shell_view_class->type_module); + return E_SHELL_MODULE (class->type_module); } /** @@ -1018,15 +1029,15 @@ GalViewInstance * e_shell_view_new_view_instance (EShellView *shell_view, const gchar *instance_id) { - EShellViewClass *shell_view_class; + EShellViewClass *class; GalViewCollection *view_collection; GalViewInstance *view_instance; g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); - shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); + class = E_SHELL_VIEW_GET_CLASS (shell_view); - view_collection = shell_view_class->view_collection; + view_collection = class->view_collection; view_instance = gal_view_instance_new (view_collection, instance_id); g_signal_connect_swapped ( diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 3159b5a71b..78987d9db6 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -85,6 +85,9 @@ struct _EShellView { * e_shell_view_get_action(). * @ui_definition: Base name of the UI definintion file to add * when the shell view is activated. + * @ui_manager_id: The #GtkUIManager ID for #EPluginUI. Plugins + * should use to this ID in their "eplug" files to + * add menu and toolbar items to the shell view. * @search_options: Widget path in the UI definition to the search * options popup menu. The menu gets shown when the * user clicks the "find" icon in the search entry. @@ -129,6 +132,9 @@ struct _EShellViewClass { /* Base name of the UI definition file. */ const gchar *ui_definition; + /* GtkUIManager ID for use with EPluginUI. */ + const gchar *ui_manager_id; + /* Widget path to the search options popup menu. */ const gchar *search_options; diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 2a9adc67ac..53074d2352 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -353,6 +353,7 @@ static void shell_window_init (EShellWindow *shell_window) { GtkUIManager *ui_manager; + const gchar *id; shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window); @@ -362,8 +363,9 @@ shell_window_init (EShellWindow *shell_window) ui_manager = e_shell_window_get_ui_manager (shell_window); - e_plugin_ui_register_manager ( - "org.gnome.evolution.shell", ui_manager, shell_window); + id = "org.gnome.evolution.shell"; + e_plugin_ui_register_manager (ui_manager, id, shell_window); + e_plugin_ui_enable_manager (ui_manager, id); } GType |