diff options
author | Milan Crha <mcrha@redhat.com> | 2014-05-13 01:47:16 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-05-13 01:47:16 +0800 |
commit | d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9 (patch) | |
tree | bdc2d2362021b2da8b8b0eaab55ca28af61122ca /modules/mail/e-mail-shell-view-actions.c | |
parent | 4508696844c20530bdf7fe6150c432eb16a9c77b (diff) | |
download | gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.tar gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.tar.gz gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.tar.bz2 gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.tar.lz gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.tar.xz gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.tar.zst gsoc2013-evolution-d46ad6d3cd44c3c9b730566cbd7719c2961a9bc9.zip |
Bug #678843 - May re-prompt password on account re-enable
Diffstat (limited to 'modules/mail/e-mail-shell-view-actions.c')
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 76159950a5..292aa96c48 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -156,6 +156,54 @@ account_refresh_folder_info_received_cb (GObject *source, g_clear_object (&activity); } +typedef struct _RefreshData +{ + EActivity *activity; + CamelStore *store; +} RefreshData; + +static void +account_refresh_allow_auth_prompt_done_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) +{ + RefreshData *data = user_data; + EActivity *activity; + CamelStore *store; + GError *local_error = NULL; + + g_return_if_fail (data != NULL); + + activity = data->activity; + store = data->store; + + g_free (data); + + e_source_allow_auth_prompt_finish (E_SOURCE (source_object), result, &local_error); + + if (e_activity_handle_cancellation (activity, local_error)) { + g_error_free (local_error); + g_clear_object (&activity); + } else { + GCancellable *cancellable; + + if (local_error) { + g_debug ("%s: Failed with: %s", G_STRFUNC, local_error->message); + g_clear_error (&local_error); + } + + cancellable = e_activity_get_cancellable (activity); + + camel_store_get_folder_info ( + store, NULL, + CAMEL_STORE_FOLDER_INFO_RECURSIVE, + G_PRIORITY_DEFAULT, cancellable, + account_refresh_folder_info_received_cb, activity); + } + + g_object_unref (store); +} + static void action_mail_account_refresh_cb (GtkAction *action, EMailShellView *mail_shell_view) @@ -165,8 +213,12 @@ action_mail_account_refresh_cb (GtkAction *action, EMFolderTree *folder_tree; EMailView *mail_view; EActivity *activity; + ESourceRegistry *registry; + ESource *source; + EShell *shell; CamelStore *store; GCancellable *cancellable; + RefreshData *data; mail_shell_content = mail_shell_view->priv->mail_shell_content; mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; @@ -179,13 +231,18 @@ action_mail_account_refresh_cb (GtkAction *action, activity = e_mail_reader_new_activity (E_MAIL_READER (mail_view)); cancellable = e_activity_get_cancellable (activity); - camel_store_get_folder_info ( - store, NULL, - CAMEL_STORE_FOLDER_INFO_RECURSIVE, - G_PRIORITY_DEFAULT, cancellable, - account_refresh_folder_info_received_cb, activity); + data = g_new0 (RefreshData, 1); + data->activity = activity; + data->store = store; - g_object_unref (store); + shell = e_shell_backend_get_shell (e_shell_view_get_shell_backend (E_SHELL_VIEW (mail_shell_view))); + registry = e_shell_get_registry (shell); + source = e_source_registry_ref_source (registry, camel_service_get_uid (CAMEL_SERVICE (store))); + g_return_if_fail (source != NULL); + + e_source_allow_auth_prompt (source, cancellable, account_refresh_allow_auth_prompt_done_cb, data); + + g_clear_object (&source); } static void |