From: Sergio Villar Senin Date: Tue, 22 Apr 2008 07:59:21 +0000 (+0000) Subject: * Properly synchronizes the selected folder when closing the main window X-Git-Tag: git_migration_finished~1438 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=ebe5a4d3baa63b4fd621805d068a3a6122556a5e * Properly synchronizes the selected folder when closing the main window pmo-trunk-r4445 --- diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index d997f0b..f3890e6 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -2828,8 +2828,27 @@ on_window_hide (GObject *gobject, { g_return_if_fail (MODEST_IS_MAIN_WINDOW (gobject)); - if (!GTK_WIDGET_VISIBLE (gobject)) + if (!GTK_WIDGET_VISIBLE (gobject)) { + TnyFolderStore *folder_store; + ModestMainWindowPrivate *priv; + + /* Remove the currently shown banners */ remove_banners (MODEST_MAIN_WINDOW (gobject)); + + /* Force the folder view to sync the currently selected folder + to save the read/unread status and to expunge messages */ + priv = MODEST_MAIN_WINDOW_GET_PRIVATE (gobject); + folder_store = modest_folder_view_get_selected (priv->folder_view); + if (TNY_IS_FOLDER (folder_store)) { + ModestMailOperation *mail_op; + + mail_op = modest_mail_operation_new (NULL); + modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), + mail_op); + modest_mail_operation_sync_folder (mail_op, TNY_FOLDER (folder_store), FALSE); + g_object_unref (mail_op); + } + } } static void diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index e189605..8a9ba72 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -1111,7 +1111,6 @@ modest_folder_view_finalize (GObject *obj) priv->query = NULL; } -/* modest_folder_view_disable_next_folder_selection (MODEST_FOLDER_VIEW(obj)); */ if (priv->folder_to_select) { g_object_unref (G_OBJECT(priv->folder_to_select)); priv->folder_to_select = NULL; @@ -1131,16 +1130,6 @@ modest_folder_view_finalize (GObject *obj) } if (priv->cur_folder_store) { - if (TNY_IS_FOLDER(priv->cur_folder_store)) { - ModestMailOperation *mail_op; - - mail_op = modest_mail_operation_new (NULL); - modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), - mail_op); - modest_mail_operation_sync_folder (mail_op, TNY_FOLDER (priv->cur_folder_store), FALSE); - g_object_unref (mail_op); - } - g_object_unref (priv->cur_folder_store); priv->cur_folder_store = NULL; }