diff options
author | Milan Crha <mcrha@redhat.com> | 2012-05-31 00:46:49 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-05-31 00:46:49 +0800 |
commit | c88d3170304e1892b221d0581a3cd3c767de4281 (patch) | |
tree | be7750049e7dca9b187bea5347556d2007ba5509 /modules/mail | |
parent | b9d8defa321ea315ca15e59c9df33845563d5042 (diff) | |
download | gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.gz gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.bz2 gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.lz gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.xz gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.tar.zst gsoc2013-evolution-c88d3170304e1892b221d0581a3cd3c767de4281.zip |
Adapt to vFolder changes from evolution-data-server
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 11 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-settings.c | 5 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 20 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.h | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 16 |
5 files changed, 45 insertions, 9 deletions
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index ab85d4e6d4..709626bef5 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -425,11 +425,15 @@ static void mail_shell_backend_constructed (GObject *object) { EShell *shell; + EShellSettings *shell_settings; EShellBackend *shell_backend; + EMailSession *mail_session; + CamelService *vstore; GtkWidget *preferences_window; shell_backend = E_SHELL_BACKEND (object); shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_mail_shell_backend_parent_class)->constructed (object); @@ -499,6 +503,13 @@ mail_shell_backend_constructed (GObject *object) NULL, em_network_prefs_new, 500); + + mail_session = e_mail_backend_get_session (E_MAIL_BACKEND (object)); + vstore = camel_session_get_service (CAMEL_SESSION (mail_session), E_MAIL_SESSION_VFOLDER_UID); + g_object_bind_property ( + shell_settings, "mail-enable-unmatched-search-folder", + vstore, "unmatched-enabled", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); } static void diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index 7d1fba1bf4..1838a06f26 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -136,6 +136,11 @@ e_mail_shell_settings_init (EShellBackend *shell_backend) "trash-empty-on-exit"); e_shell_settings_install_property_for_key ( + "mail-enable-unmatched-search-folder", + MAIL_SCHEMA, + "enable-unmatched"); + + e_shell_settings_install_property_for_key ( "mail-enable-search-folders", MAIL_SCHEMA, "enable-vfolders"); diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 5487920c74..bcda07c7a1 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -1556,7 +1556,14 @@ static GtkToggleActionEntry mail_toggle_entries[] = { "<Control>t", N_("Threaded message list"), NULL, /* Handled by property bindings */ - FALSE } + FALSE }, + + { "mail-vfolder-unmatched-enable", + NULL, + N_("_Unmatched Folder Enabled"), + NULL, + N_("Toggles whether Unmatched search folder is enabled"), + NULL } }; static GtkRadioActionEntry mail_view_entries[] = { @@ -1759,9 +1766,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) gtk_action_group_add_actions ( action_group, mail_entries, G_N_ELEMENTS (mail_entries), mail_shell_view); - e_action_group_add_popup_actions ( - action_group, mail_popup_entries, - G_N_ELEMENTS (mail_popup_entries)); gtk_action_group_add_toggle_actions ( action_group, mail_toggle_entries, G_N_ELEMENTS (mail_toggle_entries), mail_shell_view); @@ -1777,6 +1781,9 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) action_group, mail_scope_entries, G_N_ELEMENTS (mail_scope_entries), MAIL_SCOPE_CURRENT_FOLDER, NULL, NULL); + e_action_group_add_popup_actions ( + action_group, mail_popup_entries, + G_N_ELEMENTS (mail_popup_entries)); /* Search Folder Actions */ action_group = ACTION_GROUP (SEARCH_FOLDERS); @@ -1811,6 +1818,11 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) ACTION (MAIL_VIEW_VERTICAL), "current-value", G_SETTINGS_BIND_DEFAULT); + g_settings_bind ( + settings, "enable-unmatched", + ACTION (MAIL_VFOLDER_UNMATCHED_ENABLE), "active", + G_SETTINGS_BIND_DEFAULT); + g_object_unref (settings); /* Fine tuning. */ diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h index ac682b3563..a78ce2cf00 100644 --- a/modules/mail/e-mail-shell-view-actions.h +++ b/modules/mail/e-mail-shell-view-actions.h @@ -203,6 +203,8 @@ E_SHELL_WINDOW_ACTION ((window), "mail-tools-subscriptions") #define E_SHELL_WINDOW_ACTION_MAIL_UNDELETE(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-undelete") +#define E_SHELL_WINDOW_ACTION_MAIL_VFOLDER_UNMATCHED_ENABLE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-vfolder-unmatched-enable") #define E_SHELL_WINDOW_ACTION_MAIL_VIEW_CLASSIC(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-view-classic") #define E_SHELL_WINDOW_ACTION_MAIL_VIEW_VERTICAL(window) \ diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 1f459eb6d7..1a08251508 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -69,7 +69,7 @@ search_results_exec (SearchResultsMsg *msg, g_list_foreach (copied_list, (GFunc) g_object_ref, NULL); camel_vee_folder_set_folders ( - CAMEL_VEE_FOLDER (msg->folder), copied_list); + CAMEL_VEE_FOLDER (msg->folder), copied_list, cancellable); g_list_foreach (copied_list, (GFunc) g_object_unref, NULL); g_list_free (copied_list); @@ -528,7 +528,7 @@ all_accounts: /* Skip the search if we already have the results. */ if (search_folder != NULL) - if (g_strcmp0 (query, search_folder->expression) == 0) + if (g_strcmp0 (query, camel_vee_folder_get_expression (search_folder)) == 0) goto execute; /* Disable the scope combo while search is in progress. */ @@ -558,7 +558,7 @@ all_accounts: search_folder = (CamelVeeFolder *) camel_vee_folder_new ( CAMEL_STORE (service), _("All Account Search"), - CAMEL_STORE_VEE_FOLDER_AUTO); + 0); priv->search_account_all = search_folder; cache = e_mail_session_get_folder_cache (session); @@ -632,7 +632,7 @@ current_account: /* Skip the search if we already have the results. */ if (search_folder != NULL) - if (g_strcmp0 (query, search_folder->expression) == 0) + if (g_strcmp0 (query, camel_vee_folder_get_expression (search_folder)) == 0) goto execute; /* Disable the scope combo while search is in progress. */ @@ -719,7 +719,7 @@ current_account: search_folder = (CamelVeeFolder *) camel_vee_folder_new ( CAMEL_STORE (service), _("Account Search"), - CAMEL_STORE_VEE_FOLDER_AUTO); + 0); priv->search_account_current = search_folder; camel_vee_folder_set_expression (search_folder, query); @@ -832,6 +832,7 @@ mail_shell_view_update_actions (EShellView *shell_view) gboolean folder_has_unread_rec = FALSE; gboolean folder_tree_and_message_list_agree = TRUE; gboolean store_is_subscribable; + gboolean store_is_vstore = FALSE; gboolean any_store_is_subscribable = FALSE; /* Chain up to parent's update_actions() method. */ @@ -880,6 +881,8 @@ mail_shell_view_update_actions (EShellView *shell_view) service = CAMEL_SERVICE (store); uid = camel_service_get_uid (service); account = e_get_account_by_uid (uid); + + store_is_vstore = g_strcmp0 (uid, E_MAIL_SESSION_VFOLDER_UID) == 0; } else account = NULL; @@ -1020,6 +1023,9 @@ mail_shell_view_update_actions (EShellView *shell_view) sensitive = any_store_is_subscribable; gtk_action_set_sensitive (action, sensitive); + action = ACTION (MAIL_VFOLDER_UNMATCHED_ENABLE); + gtk_action_set_visible (action, folder_is_store && store_is_vstore); + e_mail_shell_view_update_popup_labels (mail_shell_view); } |