[evolution/wip/gsettings] Simplify e_mail_session_unsubscribe_folder_sync().
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/gsettings] Simplify e_mail_session_unsubscribe_folder_sync().
- Date: Wed, 29 Jun 2011 17:36:11 +0000 (UTC)
commit 7d3aa5b78a472e93ab8bdc01580cde7199588701
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu May 5 16:38:30 2011 -0400
Simplify e_mail_session_unsubscribe_folder_sync().
mail/e-mail-session-utils.c | 49 +++++++++++++++---------------------------
1 files changed, 18 insertions(+), 31 deletions(-)
---
diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c
index 4f13ff4..b307fdc 100644
--- a/mail/e-mail-session-utils.c
+++ b/mail/e-mail-session-utils.c
@@ -23,6 +23,7 @@
#include <mail/mail-tools.h>
#include <mail/e-mail-local.h>
+#include <mail/e-mail-folder-utils.h>
#include <e-util/e-account-utils.h>
#include <filter/e-filter-rule.h>
@@ -832,50 +833,36 @@ e_mail_session_unsubscribe_folder_sync (EMailSession *session,
GCancellable *cancellable,
GError **error)
{
- CamelURL *url;
- CamelService *service;
- CamelProvider *provider;
+ CamelStore *store = NULL;
+ gchar *folder_name = NULL;
const gchar *message;
- const gchar *path = NULL;
gboolean success = FALSE;
g_return_val_if_fail (E_IS_MAIL_SESSION (session), FALSE);
g_return_val_if_fail (folder_uri != NULL, FALSE);
- message = _("Unsubscribing from folder '%s'");
- camel_operation_push_message (cancellable, message, folder_uri);
-
- url = camel_url_new (folder_uri, error);
- if (url == NULL)
- goto exit;
+ success = e_mail_folder_uri_parse (
+ CAMEL_SESSION (session), folder_uri,
+ &store, &folder_name, error);
- service = camel_session_get_service_by_url (
- CAMEL_SESSION (session), url, CAMEL_PROVIDER_STORE);
+ if (!success)
+ return FALSE;
- if (!CAMEL_IS_STORE (service))
- goto exit;
+ message = _("Unsubscribing from folder '%s'");
+ camel_operation_push_message (cancellable, message, folder_name);
/* FIXME This should take our GCancellable. */
- if (!camel_service_connect_sync (service, error))
- goto exit;
+ success =
+ camel_service_connect_sync (
+ CAMEL_SERVICE (store), error) &&
+ camel_store_unsubscribe_folder_sync (
+ store, folder_name, cancellable, error);
- provider = camel_service_get_provider (service);
-
- if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH)
- path = url->fragment;
- else if (url->path != NULL && *url->path != '\0')
- path = url->path + 1;
-
- g_return_val_if_fail (path != NULL, FALSE);
-
- success = camel_store_unsubscribe_folder_sync (
- CAMEL_STORE (service), path, cancellable, error);
-
- camel_url_free (url);
-
-exit:
camel_operation_pop_message (cancellable);
+ g_object_unref (store);
+ g_free (folder_name);
+
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]