From 9c797884816c948ead7eb93070d639498f321bd4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 Jul 2012 12:43:41 -0400 Subject: Add e_mail_reader_unsubscribe_folder_name(). Replaces e_mail_session_unsubscribe_folder(). --- modules/mail/e-mail-shell-view-actions.c | 79 +++++++------------------------- 1 file changed, 16 insertions(+), 63 deletions(-) (limited to 'modules') diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 9306704ed7..04d23ef509 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -25,35 +25,6 @@ #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 (e_activity_handle_cancellation (activity, error)) { - 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) @@ -616,48 +587,30 @@ static void action_mail_folder_unsubscribe_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; - EShellBackend *shell_backend; - EShellContent *shell_content; - EShellView *shell_view; - EMailBackend *backend; - EMailSession *session; + EMailView *mail_view; EMFolderTree *folder_tree; - EActivity *activity; - EAlertSink *alert_sink; - GCancellable *cancellable; - gchar *folder_uri; + CamelStore *selected_store = NULL; + gchar *selected_folder_name = NULL; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + mail_view = e_mail_shell_content_get_mail_view (mail_shell_content); mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); - 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 (); - - alert_sink = E_ALERT_SINK (shell_content); - e_activity_set_alert_sink (activity, alert_sink); - - cancellable = camel_operation_new (); - e_activity_set_cancellable (activity, cancellable); - - e_shell_backend_add_activity (shell_backend, activity); - - folder_uri = em_folder_tree_get_selected_uri (folder_tree); - - e_mail_session_unsubscribe_folder ( - session, folder_uri, G_PRIORITY_DEFAULT, cancellable, - (GAsyncReadyCallback) mail_folder_unsubscribe_done_cb, - activity); + em_folder_tree_get_selected ( + folder_tree, &selected_store, &selected_folder_name); + g_return_if_fail (CAMEL_IS_STORE (selected_store)); + g_return_if_fail (selected_folder_name != NULL); - g_free (folder_uri); + e_mail_reader_unsubscribe_folder_name ( + E_MAIL_READER (mail_view), + selected_store, selected_folder_name); - g_object_unref (cancellable); + g_object_unref (selected_store); + g_free (selected_folder_name); } static void -- cgit