From abcd3579f4f5822551b85cb995d4ba4b11ab890e Mon Sep 17 00:00:00 2001 From: Javier Fernandez Garcia-Boente Date: Wed, 5 Sep 2007 17:55:28 +0000 Subject: [PATCH] * Check for opened edit-windows before close all windows. * Fixes: NB#64364 pmo-trunk-r3220 --- src/modest-ui-actions.c | 11 +++++++++-- src/widgets/modest-window-mgr.c | 25 +++++++++++++++++++++++-- src/widgets/modest-window-mgr.h | 8 ++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 669fb18..a3c0d6e 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -553,7 +553,9 @@ modest_ui_actions_on_delete_message_or_folder (GtkAction *action, ModestWindow * void modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win) -{ +{ + ModestWindowMgr *mgr = NULL; + #ifdef MODEST_PLATFORM_MAEMO modest_osso_save_state(); #endif /* MODEST_PLATFORM_MAEMO */ @@ -568,11 +570,16 @@ modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win) g_debug ("queue has been cleared"); + + /* Check if there are opened editing windows */ + mgr = modest_runtime_get_window_mgr (); + modest_window_mgr_close_all_windows (mgr); + /* note: when modest-tny-account-store is finalized, it will automatically set all network connections to offline */ - gtk_main_quit (); +/* gtk_main_quit (); */ } void diff --git a/src/widgets/modest-window-mgr.c b/src/widgets/modest-window-mgr.c index 4e380f1..d97f8db 100644 --- a/src/widgets/modest-window-mgr.c +++ b/src/widgets/modest-window-mgr.c @@ -317,12 +317,33 @@ compare_msguids (ModestWindow *win, } +void +modest_window_mgr_close_all_windows (ModestWindowMgr *self) +{ + ModestWindowMgrPrivate *priv = NULL; + GList *wins = NULL; + gboolean ret_value = FALSE; + + g_return_if_fail (MODEST_IS_WINDOW_MGR (self)); + priv = MODEST_WINDOW_MGR_GET_PRIVATE (self); + + /* delete-event handler already removes window_list item, */ + /* so no next its required on this loop */ + wins = priv->window_list; + while (wins) { + g_signal_emit_by_name (G_OBJECT (wins->data), "delete-event", NULL, &ret_value); + + wins = priv->window_list; + } +} + + gboolean modest_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHeader *header, ModestWindow **win) { - ModestWindowMgrPrivate *priv; - gchar* uid; + ModestWindowMgrPrivate *priv = NULL; + gchar* uid = NULL; gboolean has_header, has_window = FALSE; GList *item = NULL; diff --git a/src/widgets/modest-window-mgr.h b/src/widgets/modest-window-mgr.h index 2518f5f..91d61b2 100644 --- a/src/widgets/modest-window-mgr.h +++ b/src/widgets/modest-window-mgr.h @@ -191,6 +191,14 @@ gboolean modest_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHe /** + * modest_window_mgr_close_all_windows + * @self: a #ModestWindowMgr + * + * Close all registered windows. + **/ +void modest_window_mgr_close_all_windows (ModestWindowMgr *self); + +/** * modest_window_mgr_register_header * @self: a #ModestWindowMgr * @header: a valid #TnyHeader -- 1.7.9.5