* Check for opened edit-windows before close all windows.
authorJavier Fernandez Garcia-Boente <jfernandez@igalia.com>
Wed, 5 Sep 2007 17:55:28 +0000 (17:55 +0000)
committerJavier Fernandez Garcia-Boente <jfernandez@igalia.com>
Wed, 5 Sep 2007 17:55:28 +0000 (17:55 +0000)
* Fixes: NB#64364

pmo-trunk-r3220

src/modest-ui-actions.c
src/widgets/modest-window-mgr.c
src/widgets/modest-window-mgr.h

index 669fb18..a3c0d6e 100644 (file)
@@ -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
index 4e380f1..d97f8db 100644 (file)
@@ -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;
 
index 2518f5f..91d61b2 100644 (file)
@@ -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