diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-07-09 00:43:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-07-09 20:44:22 +0800 |
commit | 9c797884816c948ead7eb93070d639498f321bd4 (patch) | |
tree | 5ebd624db23c72dbff62149f2ac1f7495adfec20 /libemail-engine | |
parent | 451afa8429b6ff074d8d0aa93d18e1f5043627ea (diff) | |
download | gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar.gz gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar.zst gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.zip |
Add e_mail_reader_unsubscribe_folder_name().
Replaces e_mail_session_unsubscribe_folder().
Diffstat (limited to 'libemail-engine')
-rw-r--r-- | libemail-engine/e-mail-session-utils.c | 107 | ||||
-rw-r--r-- | libemail-engine/e-mail-session-utils.h | 16 |
2 files changed, 0 insertions, 123 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); -} diff --git a/libemail-engine/e-mail-session-utils.h b/libemail-engine/e-mail-session-utils.h index 2c92216533..aec6a500e6 100644 --- a/libemail-engine/e-mail-session-utils.h +++ b/libemail-engine/e-mail-session-utils.h @@ -75,22 +75,6 @@ void e_mail_session_send_to (EMailSession *session, gboolean e_mail_session_send_to_finish (EMailSession *session, GAsyncResult *result, GError **error); -gboolean e_mail_session_unsubscribe_folder_sync - (EMailSession *session, - const gchar *folder_uri, - GCancellable *cancellable, - GError **error); -void e_mail_session_unsubscribe_folder - (EMailSession *session, - const gchar *folder_uri, - gint io_priority, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean e_mail_session_unsubscribe_folder_finish - (EMailSession *session, - GAsyncResult *result, - GError **error); G_END_DECLS |