aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-09 00:43:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-07-09 20:44:22 +0800
commit9c797884816c948ead7eb93070d639498f321bd4 (patch)
tree5ebd624db23c72dbff62149f2ac1f7495adfec20 /mail
parent451afa8429b6ff074d8d0aa93d18e1f5043627ea (diff)
downloadgsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar
gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar.gz
gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar.bz2
gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar.lz
gsoc2013-evolution-9c797884816c948ead7eb93070d639498f321bd4.tar.xz
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 'mail')
-rw-r--r--mail/e-mail-reader-utils.c64
-rw-r--r--mail/e-mail-reader-utils.h4
-rw-r--r--mail/mail.error.xml4
3 files changed, 70 insertions, 2 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index f9d5e2f8e8..6d1e1bb177 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -377,6 +377,70 @@ e_mail_reader_delete_folder_name (EMailReader *reader,
context);
}
+/* Helper for e_mail_reader_unsubscribe_folder_name() */
+static void
+mail_reader_unsubscribe_folder_name_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ CamelSubscribable *subscribable;
+ AsyncContext *context;
+ EAlertSink *alert_sink;
+ GError *error = NULL;
+
+ subscribable = CAMEL_SUBSCRIBABLE (source_object);
+ context = (AsyncContext *) user_data;
+
+ alert_sink = e_activity_get_alert_sink (context->activity);
+
+ camel_subscribable_unsubscribe_folder_finish (
+ subscribable, result, &error);
+
+ if (e_activity_handle_cancellation (context->activity, error)) {
+ g_error_free (error);
+
+ } else if (error != NULL) {
+ e_alert_submit (
+ alert_sink, "mail:folder-unsubscribe",
+ context->folder_name, error->message, NULL);
+ g_error_free (error);
+
+ } else {
+ e_activity_set_state (
+ context->activity, E_ACTIVITY_COMPLETED);
+ }
+
+ async_context_free (context);
+}
+
+void
+e_mail_reader_unsubscribe_folder_name (EMailReader *reader,
+ CamelStore *store,
+ const gchar *folder_name)
+{
+ EActivity *activity;
+ AsyncContext *context;
+ GCancellable *cancellable;
+
+ g_return_if_fail (E_IS_MAIL_READER (reader));
+ g_return_if_fail (CAMEL_IS_SUBSCRIBABLE (store));
+ g_return_if_fail (folder_name != NULL);
+
+ activity = e_mail_reader_new_activity (reader);
+ cancellable = e_activity_get_cancellable (activity);
+
+ context = g_slice_new0 (AsyncContext);
+ context->activity = activity;
+ context->reader = g_object_ref (reader);
+ context->folder_name = g_strdup (folder_name);
+
+ camel_subscribable_unsubscribe_folder (
+ CAMEL_SUBSCRIBABLE (store), folder_name,
+ G_PRIORITY_DEFAULT, cancellable,
+ mail_reader_unsubscribe_folder_name_cb,
+ context);
+}
+
guint
e_mail_reader_mark_selected (EMailReader *reader,
guint32 mask,
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
index e2a8dee06a..c75d7d760f 100644
--- a/mail/e-mail-reader-utils.h
+++ b/mail/e-mail-reader-utils.h
@@ -43,6 +43,10 @@ void e_mail_reader_delete_folder_name
(EMailReader *reader,
CamelStore *store,
const gchar *folder_name);
+void e_mail_reader_unsubscribe_folder_name
+ (EMailReader *reader,
+ CamelStore *store,
+ const gchar *folder_name);
guint e_mail_reader_mark_selected (EMailReader *reader,
guint32 mask,
guint32 set);
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 5da0fa52ab..ed3856e51a 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -471,8 +471,8 @@ An mbox account will be created to preserve the old mbox folders. You can delete
</error>
<error id="folder-unsubscribe" type="warning">
- <_primary>Failed to unsubscribe from folder.</_primary>
- <_secondary>The reported error was &quot;{0}&quot;.</_secondary>
+ <_primary>Failed to unsubscribe from folder &quot;{0}&quot;.</_primary>
+ <_secondary>The reported error was &quot;{1}&quot;.</_secondary>
</error>
<error id="no-retrieve-message" type="warning">