diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-21 06:33:11 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-21 07:05:55 +0800 |
commit | 9aa668aa6bf612673ad7e760b06fc62350be041e (patch) | |
tree | 0faa8c08a5452393069fc3fc716b1458ad9cad5a /modules | |
parent | 7333f12087eb0b0271ff272c6643909a7803510b (diff) | |
download | gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.tar gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.tar.gz gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.tar.bz2 gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.tar.lz gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.tar.xz gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.tar.zst gsoc2013-evolution-9aa668aa6bf612673ad7e760b06fc62350be041e.zip |
Bug 650587 - Hide Search Folder actions when Search Folders are disabled
Add an action group for Search Folders to EMailReader. The action
group's visibility is bound to the "mail-enable-search-folders" setting,
so that menu items related to Search Folders are hidden when Search
Folders are disabled in GConf.
Affected menu items are:
Edit -> Search Folders
Message -> Create Rule -> Search Folder from Subject...
Message -> Create Rule -> Search Folder from Sender...
Message -> Create Rule -> Search Folder from Recipients...
Message -> Create Rule -> Search Folder from Mailing List...
Search -> Create Search Folder From Search...
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mail/e-mail-config-reader.c | 30 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 3 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 37 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.h | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 1 |
5 files changed, 55 insertions, 18 deletions
diff --git a/modules/mail/e-mail-config-reader.c b/modules/mail/e-mail-config-reader.c index a13f0bf936..5aea86b7b1 100644 --- a/modules/mail/e-mail-config-reader.c +++ b/modules/mail/e-mail-config-reader.c @@ -24,15 +24,14 @@ static gpointer parent_class; -static void -mail_config_reader_constructed (GObject *object) +static gboolean +mail_config_reader_idle_cb (EExtension *extension) { - EExtension *extension; EExtensible *extensible; + GtkActionGroup *action_group; EShellSettings *shell_settings; EShell *shell; - extension = E_EXTENSION (object); extensible = e_extension_get_extensible (extension); shell = e_shell_get_default (); @@ -48,6 +47,29 @@ mail_config_reader_constructed (GObject *object) extensible, "reply-style", G_BINDING_SYNC_CREATE); + action_group = e_mail_reader_get_action_group ( + E_MAIL_READER (extensible), + E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS); + + g_object_bind_property ( + shell_settings, "mail-enable-search-folders", + action_group, "visible", + G_BINDING_SYNC_CREATE); + + return FALSE; +} + +static void +mail_config_reader_constructed (GObject *object) +{ + /* Bind properties to settings from an idle callback so the + * EMailReader interface has a chance to be initialized first. */ + g_idle_add_full ( + G_PRIORITY_DEFAULT_IDLE, + (GSourceFunc) mail_config_reader_idle_cb, + g_object_ref (object), + (GDestroyNotify) g_object_unref); + /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); } diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 30c842243f..5657db18ac 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -264,6 +264,9 @@ mail_shell_content_get_action_group (EMailReader *reader, case E_MAIL_READER_ACTION_GROUP_STANDARD: group_name = "mail"; break; + case E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS: + group_name = "search-folders"; + break; default: g_return_val_if_reached (NULL); } diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 90096393e3..f5c5524648 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -1117,13 +1117,6 @@ static GtkActionEntry mail_entries[] = { N_("Permanently remove all the deleted messages from all folders"), G_CALLBACK (action_mail_folder_expunge_cb) }, - { "mail-create-search-folder", - NULL, - N_("C_reate Search Folder From Search..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mail_create_search_folder_cb) }, - { "mail-download", NULL, N_("_Download Messages for Offline Usage"), @@ -1329,13 +1322,6 @@ static GtkActionEntry mail_entries[] = { N_("Create or edit rules for filtering new mail"), G_CALLBACK (action_mail_tools_filters_cb) }, - { "mail-tools-search-folders", - NULL, - N_("Search F_olders"), - NULL, - N_("Create or edit search folder definitions"), - G_CALLBACK (action_mail_tools_search_folders_cb) }, - { "mail-tools-subscriptions", NULL, N_("_Subscriptions..."), @@ -1367,6 +1353,23 @@ static GtkActionEntry mail_entries[] = { NULL } }; +static GtkActionEntry search_folder_entries[] = { + + { "mail-create-search-folder", + NULL, + N_("C_reate Search Folder From Search..."), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_create_search_folder_cb) }, + + { "mail-tools-search-folders", + NULL, + N_("Search F_olders"), + NULL, + N_("Create or edit search folder definitions"), + G_CALLBACK (action_mail_tools_search_folders_cb) }, +}; + static EPopupActionEntry mail_popup_entries[] = { { "mail-popup-account-disable", @@ -1666,6 +1669,12 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) G_N_ELEMENTS (mail_scope_entries), MAIL_SCOPE_CURRENT_FOLDER, NULL, NULL); + /* Search Folder Actions */ + action_group = ACTION_GROUP (SEARCH_FOLDERS); + gtk_action_group_add_actions ( + action_group, search_folder_entries, + G_N_ELEMENTS (search_folder_entries), mail_shell_view); + action = ACTION (MAIL_SCOPE_ALL_ACCOUNTS); combo_box = e_shell_searchbar_get_scope_combo_box (searchbar); e_action_combo_box_set_action (combo_box, GTK_RADIO_ACTION (action)); diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h index d9b801a9c0..c6ca167e14 100644 --- a/modules/mail/e-mail-shell-view-actions.h +++ b/modules/mail/e-mail-shell-view-actions.h @@ -259,5 +259,7 @@ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-filter") #define E_SHELL_WINDOW_ACTION_GROUP_MAIL_LABEL(window) \ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-label") +#define E_SHELL_WINDOW_ACTION_GROUP_SEARCH_FOLDERS(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "search-folders") #endif /* E_MAIL_SHELL_VIEW_ACTIONS_H */ diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 8cc7d45c85..01ceca277e 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -644,6 +644,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) e_shell_window_add_action_group (shell_window, "mail"); e_shell_window_add_action_group (shell_window, "mail-filter"); e_shell_window_add_action_group (shell_window, "mail-label"); + e_shell_window_add_action_group (shell_window, "search-folders"); merge_id = gtk_ui_manager_new_merge_id (ui_manager); priv->label_merge_id = merge_id; |