aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-11-01 05:16:57 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-11-01 10:54:30 +0800
commitc211a974e3d532077b3be3235ff2e891533b9c3c (patch)
tree84b380a0ba37b9ec0feec3b61cac5725773c8534 /modules
parentccc2b3a14bf19b3db1d837887a07e74f50db078c (diff)
downloadgsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.tar
gsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.tar.gz
gsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.tar.bz2
gsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.tar.lz
gsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.tar.xz
gsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.tar.zst
gsoc2013-evolution-c211a974e3d532077b3be3235ff2e891533b9c3c.zip
Kill em_folder_utils_unsubscribe_folder().
Use e_mail_session_unsubscribe_folder() instead.
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/e-mail-shell-view-actions.c50
-rw-r--r--modules/mail/e-mail-shell-view-private.h2
2 files changed, 50 insertions, 2 deletions
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 467afa5ff9..ba21f28b8d 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -19,10 +19,39 @@
*
*/
-#include "mail/mail-folder-cache.h"
#include "e-mail-shell-view-private.h"
static void
+mail_folder_unsubscribe_done_cb (EMailSession *session,
+ GAsyncResult *result,
+ EActivity *activity)
+{
+ EAlertSink *alert_sink;
+ GError *error = NULL;
+
+ alert_sink = e_activity_get_alert_sink (activity);
+
+ e_mail_session_unsubscribe_folder_finish (session, result, &error);
+
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ e_activity_set_state (activity, E_ACTIVITY_CANCELLED);
+ g_error_free (error);
+
+ } else if (error != NULL) {
+ e_alert_submit (
+ alert_sink,
+ "mail:folder-unsubscribe",
+ error->message, NULL);
+ g_error_free (error);
+
+ } else {
+ e_activity_set_state (activity, E_ACTIVITY_COMPLETED);
+ }
+
+ g_object_unref (activity);
+}
+
+static void
action_gal_save_custom_view_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
@@ -587,10 +616,14 @@ action_mail_folder_unsubscribe_cb (GtkAction *action,
{
EMailShellSidebar *mail_shell_sidebar;
EShellBackend *shell_backend;
+ EShellContent *shell_content;
EShellView *shell_view;
EMailBackend *backend;
EMailSession *session;
EMFolderTree *folder_tree;
+ EActivity *activity;
+ EAlertSink *alert_sink;
+ GCancellable *cancellable;
gchar *folder_uri;
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
@@ -598,12 +631,25 @@ action_mail_folder_unsubscribe_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
+ activity = e_activity_new ();
+ cancellable = camel_operation_new ();
+ alert_sink = E_ALERT_SINK (shell_content);
+ e_activity_set_alert_sink (activity, alert_sink);
+ e_activity_set_cancellable (activity, cancellable);
+ e_shell_backend_add_activity (shell_backend, activity);
+
folder_uri = em_folder_tree_get_selected_uri (folder_tree);
- em_folder_utils_unsubscribe_folder (session, folder_uri);
+
+ e_mail_session_unsubscribe_folder (
+ session, folder_uri, G_PRIORITY_DEFAULT, cancellable,
+ (GAsyncReadyCallback) mail_folder_unsubscribe_done_cb,
+ activity);
+
g_free (folder_uri);
}
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 92f00d4eb9..806b408772 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -43,6 +43,7 @@
#include "e-mail-local.h"
#include "e-mail-reader.h"
#include "e-mail-session.h"
+#include "e-mail-session-utils.h"
#include "e-mail-sidebar.h"
#include "e-mail-store.h"
#include "em-composer-utils.h"
@@ -53,6 +54,7 @@
#include "em-subscription-editor.h"
#include "em-utils.h"
#include "mail-autofilter.h"
+#include "mail-folder-cache.h"
#include "mail-ops.h"
#include "mail-send-recv.h"
#include "mail-tools.h"