diff options
Diffstat (limited to 'libemail-engine/e-mail-session-utils.c')
-rw-r--r-- | libemail-engine/e-mail-session-utils.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c index 0c05a26df9..2ac4170a2e 100644 --- a/libemail-engine/e-mail-session-utils.c +++ b/libemail-engine/e-mail-session-utils.c @@ -856,110 +856,3 @@ e_mail_session_send_to_finish (EMailSession *session, return !g_simple_async_result_propagate_error (simple, error); } -static void -mail_session_unsubscribe_folder_thread (GSimpleAsyncResult *simple, - EMailSession *session, - GCancellable *cancellable) -{ - AsyncContext *context; - GError *error = NULL; - - context = g_simple_async_result_get_op_res_gpointer (simple); - - e_mail_session_unsubscribe_folder_sync ( - session, context->folder_uri, cancellable, &error); - - if (error != NULL) - g_simple_async_result_take_error (simple, error); -} - -gboolean -e_mail_session_unsubscribe_folder_sync (EMailSession *session, - const gchar *folder_uri, - GCancellable *cancellable, - GError **error) -{ - CamelStore *store = NULL; - gchar *folder_name = NULL; - const gchar *message; - gboolean success = FALSE; - - g_return_val_if_fail (E_IS_MAIL_SESSION (session), FALSE); - g_return_val_if_fail (folder_uri != NULL, FALSE); - - success = e_mail_folder_uri_parse ( - CAMEL_SESSION (session), folder_uri, - &store, &folder_name, error); - - if (!success) - return FALSE; - - message = _("Unsubscribing from folder '%s'"); - camel_operation_push_message (cancellable, message, folder_name); - - success = - camel_service_connect_sync ( - CAMEL_SERVICE (store), cancellable, error) && - camel_subscribable_unsubscribe_folder_sync ( - CAMEL_SUBSCRIBABLE (store), - folder_name, cancellable, error); - - camel_operation_pop_message (cancellable); - - g_object_unref (store); - g_free (folder_name); - - return success; -} - -void -e_mail_session_unsubscribe_folder (EMailSession *session, - const gchar *folder_uri, - gint io_priority, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *simple; - AsyncContext *context; - - g_return_if_fail (E_IS_MAIL_SESSION (session)); - g_return_if_fail (folder_uri != NULL); - - context = g_slice_new0 (AsyncContext); - context->folder_uri = g_strdup (folder_uri); - - simple = g_simple_async_result_new ( - G_OBJECT (session), callback, user_data, - e_mail_session_unsubscribe_folder); - - g_simple_async_result_set_check_cancellable (simple, cancellable); - - g_simple_async_result_set_op_res_gpointer ( - simple, context, (GDestroyNotify) async_context_free); - - g_simple_async_result_run_in_thread ( - simple, (GSimpleAsyncThreadFunc) - mail_session_unsubscribe_folder_thread, - io_priority, cancellable); - - g_object_unref (simple); -} - -gboolean -e_mail_session_unsubscribe_folder_finish (EMailSession *session, - GAsyncResult *result, - GError **error) -{ - GSimpleAsyncResult *simple; - - g_return_val_if_fail ( - g_simple_async_result_is_valid ( - result, G_OBJECT (session), - e_mail_session_unsubscribe_folder), FALSE); - - simple = G_SIMPLE_ASYNC_RESULT (result); - - /* Assume success unless a GError is set. */ - return !g_simple_async_result_propagate_error (simple, error); -} |