diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-11-25 13:43:18 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-11-25 13:44:20 +0800 |
commit | 463032d13238e9de9623046b13bdb3b40ad4fcbf (patch) | |
tree | 718412543f80278c5ea1bc951eadc2ba0e333bf5 | |
parent | a947c90caf68975c2cb3d1e0a12e6056ee5f6f03 (diff) | |
download | gsoc2013-evolution-463032d13238e9de9623046b13bdb3b40ad4fcbf.tar.gz gsoc2013-evolution-463032d13238e9de9623046b13bdb3b40ad4fcbf.tar.zst gsoc2013-evolution-463032d13238e9de9623046b13bdb3b40ad4fcbf.zip |
BugĀ 602844 - Flags not saved to IMAP account on exit
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 54 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.h | 3 |
2 files changed, 57 insertions, 0 deletions
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index d28de5a3b1..86f166d916 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -312,6 +312,36 @@ mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, } static void +mail_shell_view_prepare_for_quit_done_cb (CamelFolder *folder, + gpointer user_data) +{ + g_object_unref (E_ACTIVITY (user_data)); +} + +static void +mail_shell_view_prepare_for_quit_cb (EMailShellView *mail_shell_view, + EActivity *activity) +{ + EMailReader *reader; + MessageList *message_list; + + /* If we got here, it means the application is shutting down + * and this is the last EMailShellView instance. Synchronize + * the currently selected folder before we terminate. */ + + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + message_list = e_mail_reader_get_message_list (reader); + + if (message_list->folder == NULL) + return; + + mail_sync_folder ( + message_list->folder, + mail_shell_view_prepare_for_quit_done_cb, + g_object_ref (activity)); +} + +static void mail_shell_view_load_view_collection (EShellViewClass *shell_view_class) { GalViewCollection *collection; @@ -520,6 +550,15 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) G_CALLBACK (mail_shell_view_reader_status_message_cb), mail_shell_view); + /* Need to keep the handler ID so we can disconnect it in + * dispose(). The shell outlives us and we don't want it + * invoking callbacks on finalized shell views. */ + priv->prepare_for_quit_handler_id = + g_signal_connect_swapped ( + shell, "prepare-for-quit", + G_CALLBACK (mail_shell_view_prepare_for_quit_cb), + mail_shell_view); + e_mail_shell_view_actions_init (mail_shell_view); e_mail_shell_view_update_search_filter (mail_shell_view); e_mail_reader_init (reader); @@ -545,6 +584,21 @@ e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view) EMailShellViewPrivate *priv = mail_shell_view->priv; gint ii; + /* XXX It's a little awkward to have to dig up the + * shell this late in the game. Should we just + * keep a direct reference to it? Not sure. */ + if (priv->prepare_for_quit_handler_id > 0) { + EShellBackend *shell_backend; + EShell *shell; + + shell_backend = E_SHELL_BACKEND (priv->mail_shell_backend); + shell = e_shell_backend_get_shell (shell_backend); + + g_signal_handler_disconnect ( + shell, priv->prepare_for_quit_handler_id); + priv->prepare_for_quit_handler_id = 0; + } + DISPOSE (priv->mail_shell_backend); DISPOSE (priv->mail_shell_content); DISPOSE (priv->mail_shell_sidebar); diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index 3c9ec88630..70700dddfc 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -141,6 +141,9 @@ struct _EMailShellViewPrivate { /* Filter rules correspond to the search entry menu. */ EFilterRule *search_rules[MAIL_NUM_SEARCH_RULES]; + /* EShell::prepare-for-quit */ + gulong prepare_for_quit_handler_id; + guint show_deleted : 1; }; |