From 086a96050b16f6dabd99a391b5a4faf0411963a1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 3 Oct 2008 04:43:40 +0000 Subject: Tasks progress. Merge EMemoPreview back into ECalComponentPreview. svn path=/branches/kill-bonobo/; revision=36538 --- shell/e-shell-content.c | 6 ++++-- shell/e-shell-content.h | 3 --- shell/e-shell-module.c | 21 --------------------- shell/e-shell-module.h | 5 ----- shell/e-shell-view.h | 7 +++++++ shell/e-shell-window-actions.c | 2 ++ shell/e-shell-window-private.c | 13 +++++++++++-- shell/e-shell-window.c | 8 ++++---- shell/test/e-test-shell-module.c | 2 -- 9 files changed, 28 insertions(+), 39 deletions(-) (limited to 'shell') diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c index 4d44a564b6..87c1bbfd50 100644 --- a/shell/e-shell-content.c +++ b/shell/e-shell-content.c @@ -208,6 +208,7 @@ static void shell_content_init_search_context (EShellContent *shell_content) { EShellView *shell_view; + EShellViewClass *shell_view_class; EShellModule *shell_module; RuleContext *context; FilterRule *rule; @@ -217,13 +218,14 @@ shell_content_init_search_context (EShellContent *shell_content) shell_view = e_shell_content_get_shell_view (shell_content); shell_module = e_shell_view_get_shell_module (shell_view); + shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); + g_return_if_fail (shell_view_class->search_rules != NULL); /* The filename for built-in searches is specified in a * module's EShellModuleInfo. All built-in search rules * live in the same directory. */ system_filename = g_build_filename ( - EVOLUTION_RULEDIR, - e_shell_module_get_searches (shell_module), NULL); + EVOLUTION_RULEDIR, shell_view_class->search_rules, NULL); /* The filename for custom saved searches is always of * the form "$(shell_module_data_dir)/searches.xml". */ diff --git a/shell/e-shell-content.h b/shell/e-shell-content.h index 102a465bf5..3a3c2eeb46 100644 --- a/shell/e-shell-content.h +++ b/shell/e-shell-content.h @@ -125,9 +125,6 @@ gboolean e_shell_content_get_scope_visible void e_shell_content_set_scope_visible (EShellContent *shell_content, gboolean scope_visible); -void e_shell_content_save_search_dialog - (EShellContent *shell_content, - const gchar *filename); const gchar * e_shell_content_get_view_id (EShellContent *shell_content); void e_shell_content_set_view_id (EShellContent *shell_content, const gchar *view_id); diff --git a/shell/e-shell-module.c b/shell/e-shell-module.c index 61e529a75a..1eea8188b6 100644 --- a/shell/e-shell-module.c +++ b/shell/e-shell-module.c @@ -404,26 +404,6 @@ e_shell_module_get_filename (EShellModule *shell_module) return shell_module->priv->filename; } -/** - * e_shell_module_get_searches: - * @shell_module: an #EShellModule - * - * Returns the base name of the XML file containing predefined search - * rules for @shell_module. The XML files are usually named something - * like moduletypes.xml. - * - * XXX This function is likely to change or disappear. - * - * Returns: the base name of the XML filter file - **/ -const gchar * -e_shell_module_get_searches (EShellModule *shell_module) -{ - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); - - return shell_module->priv->info.searches; -} - /** * e_shell_module_get_shell: * @shell_module: an #EShellModule @@ -551,7 +531,6 @@ e_shell_module_set_info (EShellModule *shell_module, module_info->aliases = g_intern_string (info->aliases); module_info->schemes = g_intern_string (info->schemes); - module_info->searches = g_intern_string (info->searches); module_info->sort_order = info->sort_order; module_info->is_busy = info->is_busy; diff --git a/shell/e-shell-module.h b/shell/e-shell-module.h index a0dece314f..abb4bd213b 100644 --- a/shell/e-shell-module.h +++ b/shell/e-shell-module.h @@ -70,9 +70,6 @@ typedef struct _EShellModulePrivate EShellModulePrivate; * @schemes: Colon-separated list of URI schemes. The #EShell * will forward command-line URIs to the appropriate * module based on this list. - * @searches: Base name of the XML file containing predefined - * search rules for this module. These show up as - * options in the search entry drop-down. * @sort_order: Used to determine the order of modules listed in * the main menu and in the switcher. See * e_shell_module_compare(). @@ -89,7 +86,6 @@ struct _EShellModuleInfo { const gchar *name; const gchar *aliases; const gchar *schemes; - const gchar *searches; gint sort_order; gboolean (*is_busy) (EShellModule *shell_module); @@ -119,7 +115,6 @@ gint e_shell_module_compare (EShellModule *shell_module_a, const gchar * e_shell_module_get_config_dir (EShellModule *shell_module); const gchar * e_shell_module_get_data_dir (EShellModule *shell_module); const gchar * e_shell_module_get_filename (EShellModule *shell_module); -const gchar * e_shell_module_get_searches (EShellModule *shell_module); struct _EShell *e_shell_module_get_shell (EShellModule *shell_module); void e_shell_module_add_activity (EShellModule *shell_module, EActivity *activity); diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 5aa9e6c0ff..28392d2963 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -87,6 +87,10 @@ struct _EShellView { * @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. + * @search_rules: Base name of the XML file containing predefined + * search rules for this shell view. The XML files + * are usually named something like + * viewtypes.xml. * @type_module: The corresponding #GTypeModule for this shell * view. Subclasses are responsible for setting * this. An easy way do so is to pass it to the @@ -127,6 +131,9 @@ struct _EShellViewClass { /* Widget path to the search options popup menu. */ const gchar *search_options; + /* Base name of the search rule definition file. */ + const gchar *search_rules; + /* Subclasses should set this via the "class_data" field in * the GTypeInfo they pass to g_type_module_register_type(). */ GTypeModule *type_module; diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index 91f1a16e78..9dac1127c3 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -2083,6 +2083,8 @@ e_shell_window_update_view_menu (EShellWindow *shell_window) ui_manager = e_shell_window_get_ui_manager (shell_window); view_name = e_shell_window_get_active_view (shell_window); shell_view = e_shell_window_get_shell_view (shell_window, view_name); + g_return_if_fail (shell_view != NULL); + shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); view_collection = shell_view_class->view_collection; view_id = e_shell_view_get_view_id (shell_view); diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 78fa425b26..c6283a1481 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -109,7 +109,7 @@ shell_window_menu_item_select_cb (EShellWindow *shell_window, { GtkAction *action; GtkLabel *label; - gchar *tooltip; + gchar *tooltip = NULL; action = g_object_get_data (G_OBJECT (menu_item), "action"); g_return_if_fail (GTK_IS_ACTION (action)); @@ -410,6 +410,9 @@ e_shell_window_switch_to_view (EShellWindow *shell_window, EShellView *shell_view; gint page_num; + g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); + g_return_if_fail (view_name != NULL); + shell_view = e_shell_window_get_shell_view (shell_window, view_name); page_num = e_shell_view_get_page_num (shell_view); @@ -440,7 +443,9 @@ e_shell_window_update_icon (EShellWindow *shell_window) EShellView *shell_view; GtkAction *action; const gchar *view_name; - gchar *icon_name; + gchar *icon_name = NULL; + + g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); view_name = e_shell_window_get_active_view (shell_window); shell_view = e_shell_window_get_shell_view (shell_window, view_name); @@ -459,6 +464,8 @@ e_shell_window_update_title (EShellWindow *shell_window) const gchar *view_name; gchar *window_title; + g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); + view_name = e_shell_window_get_active_view (shell_window); shell_view = e_shell_window_get_shell_view (shell_window, view_name); view_title = e_shell_view_get_title (shell_view); @@ -476,6 +483,8 @@ e_shell_window_update_new_menu (EShellWindow *shell_window) GtkWidget *widget; const gchar *path; + g_return_if_fail (E_IS_SHELL_WINDOW (shell_window)); + /* Update the "File -> New" submenu. */ path = "/main-menu/file-menu/new-menu"; menu = e_shell_window_create_new_menu (shell_window); diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index eca36dd90e..ebc9cb376b 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -595,15 +595,15 @@ e_shell_window_set_active_view (EShellWindow *shell_window, g_return_if_fail (shell_view != NULL); action = e_shell_view_get_action (shell_view); - gtk_action_activate (action); /* XXX Radio actions refuse to activate if they're already active. * This causes problems during intialization if we're trying to * switch to the shell view whose corresponding radio action is - * already active. Fortunately we can detect that and force - * the switch. */ - if (shell_window->priv->active_view == NULL) + * already active. This works around the problem. */ + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) e_shell_window_switch_to_view (shell_window, view_name); + else + gtk_action_activate (action); } /** diff --git a/shell/test/e-test-shell-module.c b/shell/test/e-test-shell-module.c index 7aeb3cab25..32de51a650 100644 --- a/shell/test/e-test-shell-module.c +++ b/shell/test/e-test-shell-module.c @@ -30,7 +30,6 @@ #define MODULE_NAME "test" #define MODULE_ALIASES "monkey" #define MODULE_SCHEMES "" -#define MODULE_SEARCHES NULL #define MODULE_SORT_ORDER 100 /* Module Entry Point */ @@ -133,7 +132,6 @@ static EShellModuleInfo module_info = { MODULE_NAME, MODULE_ALIASES, MODULE_SCHEMES, - MODULE_SEARCHES, MODULE_SORT_ORDER, /* Methods */ -- cgit v1.2.3