aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-misc-utils.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-05-13 01:47:16 +0800
committerMilan Crha <mcrha@redhat.com>2014-05-13 01:47:16 +0800
commitd46ad6d3cd44c3c9b730566cbd7719c2961a9bc9 (patch)
treebdc2d2362021b2da8b8b0eaab55ca28af61122ca /e-util/e-misc-utils.c
parent4508696844c20530bdf7fe6150c432eb16a9c77b (diff)
downloadgsoc2013-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 'e-util/e-misc-utils.c')
-rw-r--r--e-util/e-misc-utils.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c
index 0f935d49af..3a52292af4 100644
--- a/e-util/e-misc-utils.c
+++ b/e-util/e-misc-utils.c
@@ -1964,6 +1964,72 @@ e_util_dup_searchable_categories (void)
return g_list_reverse (res);
}
+gboolean
+e_util_allow_auth_prompt_and_refresh_client_sync (EClient *client,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+
+ if (!e_source_allow_auth_prompt_sync (e_client_get_source (client), cancellable, error))
+ return FALSE;
+
+ return e_client_refresh_sync (client, cancellable, error);
+}
+
+static void
+util_allow_auth_prompt_and_refresh_client_thread (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *cancellable)
+{
+ gboolean success;
+ GError *local_error = NULL;
+
+ success = e_util_allow_auth_prompt_and_refresh_client_sync (
+ E_CLIENT (source_object),
+ cancellable, &local_error);
+
+ if (local_error != NULL) {
+ g_task_return_error (task, local_error);
+ } else {
+ g_task_return_boolean (task, success);
+ }
+}
+
+void
+e_util_allow_auth_prompt_and_refresh_client (EClient *client,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GTask *task;
+
+ g_return_if_fail (E_IS_CLIENT (client));
+
+ task = g_task_new (client, cancellable, callback, user_data);
+ g_task_set_source_tag (task, e_util_allow_auth_prompt_and_refresh_client);
+
+ g_task_run_in_thread (task, util_allow_auth_prompt_and_refresh_client_thread);
+
+ g_object_unref (task);
+}
+
+gboolean
+e_util_allow_auth_prompt_and_refresh_client_finish (EClient *client,
+ GAsyncResult *result,
+ GError **error)
+{
+ g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, client), FALSE);
+
+ g_return_val_if_fail (
+ g_async_result_is_tagged (
+ result, e_util_allow_auth_prompt_and_refresh_client), FALSE);
+
+ return g_task_propagate_boolean (G_TASK (result), error);
+}
+
/**
* e_binding_transform_color_to_string:
* @binding: a #GBinding