[evolution] Remove mail_cancel_all().



commit 8ae3cc32830179e0937b315d673d11a17658e7ac
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Nov 27 10:28:55 2013 -0500

    Remove mail_cancel_all().
    
    Turns out this function was a no-op, because nothing registered itself
    to be cancelled this way.  This was part of the legacy async framework,
    which we've mostly moved away from now.

 .../evolution-mail-engine-sections.txt             |    1 -
 libemail-engine/mail-mt.c                          |   15 ------
 libemail-engine/mail-mt.h                          |    3 -
 mail/e-mail-backend.c                              |   52 +++++++++----------
 modules/mail/e-mail-shell-view-actions.c           |    8 ---
 5 files changed, 25 insertions(+), 54 deletions(-)
---
diff --git a/doc/reference/evolution-mail-engine/evolution-mail-engine-sections.txt 
b/doc/reference/evolution-mail-engine/evolution-mail-engine-sections.txt
index c666ff9..15da5af 100644
--- a/doc/reference/evolution-mail-engine/evolution-mail-engine-sections.txt
+++ b/doc/reference/evolution-mail-engine/evolution-mail-engine-sections.txt
@@ -363,7 +363,6 @@ mail_msg_main_loop_push
 mail_msg_unordered_push
 mail_msg_fast_ordered_push
 mail_msg_slow_ordered_push
-mail_cancel_all
 mail_get_password
 mail_in_main_thread
 mail_call_t
diff --git a/libemail-engine/mail-mt.c b/libemail-engine/mail-mt.c
index 26c4592..0999c31 100644
--- a/libemail-engine/mail-mt.c
+++ b/libemail-engine/mail-mt.c
@@ -306,21 +306,6 @@ mail_msg_active (void)
 
 /* **************************************** */
 
-static GHookList cancel_hook_list;
-
-void
-mail_cancel_all (void)
-{
-       camel_operation_cancel_all ();
-
-       g_mutex_lock (&mail_msg_lock);
-
-       if (cancel_hook_list.is_setup)
-               g_hook_list_invoke (&cancel_hook_list, FALSE);
-
-       g_mutex_unlock (&mail_msg_lock);
-}
-
 static guint idle_source_id = 0;
 G_LOCK_DEFINE_STATIC (idle_source_id);
 static GAsyncQueue *main_loop_queue = NULL;
diff --git a/libemail-engine/mail-mt.h b/libemail-engine/mail-mt.h
index 8ac8b8c..b8c9923 100644
--- a/libemail-engine/mail-mt.h
+++ b/libemail-engine/mail-mt.h
@@ -99,9 +99,6 @@ void mail_msg_unordered_push (gpointer msg);
 void mail_msg_fast_ordered_push (gpointer msg);
 void mail_msg_slow_ordered_push (gpointer msg);
 
-/* To implement the stop button */
-void mail_cancel_all (void);
-
 /* Call a function in the GUI thread, wait for it to return, type is
  * the marshaller to use.  FIXME This thing is horrible, please put
  * it out of its misery. */
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 54e2ccb..e51a83e 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -131,33 +131,34 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
        GtkWindow *window;
        EMailSession *session;
        EMailAccountStore *account_store;
+       EShellBackend *shell_backend;
        GQueue queue = G_QUEUE_INIT;
-       gboolean synchronize = FALSE;
 
-       if (e_shell_backend_is_started (E_SHELL_BACKEND (backend)))
-               e_shell_backend_add_activity (E_SHELL_BACKEND (backend), activity);
+       shell_backend = E_SHELL_BACKEND (backend);
 
        window = e_shell_get_active_window (shell);
        session = e_mail_backend_get_session (backend);
        account_store = e_mail_ui_session_get_account_store (E_MAIL_UI_SESSION (session));
 
-       if (e_shell_get_network_available (shell) &&
-               e_shell_backend_is_started (E_SHELL_BACKEND (backend)))
-               synchronize = em_utils_prompt_user (
-                       window, NULL, "mail:ask-quick-offline", NULL);
+       if (e_shell_backend_is_started (shell_backend)) {
+               gboolean synchronize = FALSE;
 
-       if (!synchronize)
-               mail_cancel_all ();
+               if (e_shell_get_network_available (shell))
+                       synchronize = em_utils_prompt_user (
+                               window, NULL, "mail:ask-quick-offline", NULL);
 
-       /* Set the cancellable only here, because mail_cancel_all() would
-        * cancel the just added CamelOperation as well. */
-       if (e_shell_backend_is_started (E_SHELL_BACKEND (backend)) &&
-           !e_activity_get_cancellable (activity)) {
-               GCancellable *cancellable;
+               if (synchronize)
+                       e_shell_backend_cancel_all (shell_backend);
+
+               if (!e_activity_get_cancellable (activity)) {
+                       GCancellable *cancellable;
+
+                       cancellable = camel_operation_new ();
+                       e_activity_set_cancellable (activity, cancellable);
+                       g_object_unref (cancellable);
+               }
 
-               cancellable = camel_operation_new ();
-               e_activity_set_cancellable (activity, cancellable);
-               g_object_unref (cancellable);
+               e_shell_backend_add_activity (shell_backend, activity);
        }
 
        e_mail_account_store_queue_enabled_services (account_store, &queue);
@@ -165,15 +166,15 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
                CamelService *service;
 
                service = g_queue_pop_head (&queue);
-               if (service == NULL)
+
+               if (!CAMEL_IS_STORE (service))
                        continue;
 
-               if (CAMEL_IS_STORE (service))
-                       e_mail_store_go_offline (
-                               CAMEL_STORE (service), G_PRIORITY_DEFAULT,
-                               e_activity_get_cancellable (activity),
-                               (GAsyncReadyCallback) mail_backend_store_operation_done_cb,
-                               g_object_ref (activity));
+               e_mail_store_go_offline (
+                       CAMEL_STORE (service), G_PRIORITY_DEFAULT,
+                       e_activity_get_cancellable (activity),
+                       (GAsyncReadyCallback) mail_backend_store_operation_done_cb,
+                       g_object_ref (activity));
        }
 }
 
@@ -305,9 +306,6 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
 
        mail_vfolder_shutdown ();
 
-       /* Cancel all pending activities. */
-       mail_cancel_all ();
-
        list = camel_session_list_services (CAMEL_SESSION (session));
 
        if (delete_junk) {
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 26f04b3..b389d9c 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -1367,14 +1367,6 @@ action_mail_stop_cb (GtkAction *action,
        shell_view = E_SHELL_VIEW (mail_shell_view);
        shell_backend = e_shell_view_get_shell_backend (shell_view);
 
-       /* XXX There's some overlap here: activities submitted through
-        *     the legacy MailMsg system might be cancelled twice, but
-        *     it shouldn't cause problems. */
-
-       /* the old way */
-       mail_cancel_all ();
-
-       /* the new way */
        e_shell_backend_cancel_all (shell_backend);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]