patch for NB#73896
authorFelipe Erias Morandeira <femorandeira@igalia.com>
Tue, 23 Oct 2007 16:37:58 +0000 (16:37 +0000)
committerFelipe Erias Morandeira <femorandeira@igalia.com>
Tue, 23 Oct 2007 16:37:58 +0000 (16:37 +0000)
pmo-trunk-r3563

src/gnome/modest-main-window.c
src/maemo/modest-main-window.c
src/widgets/modest-main-window.h
src/widgets/modest-window-mgr.c

index d987c29..09a7541 100644 (file)
@@ -692,14 +692,6 @@ on_header_status_update (ModestHeaderView *header_view,
        modest_gnome_info_bar_set_message (MODEST_GNOME_INFO_BAR (priv->main_bar), msg);
 }
 
-gboolean 
-modest_main_window_close_all (ModestMainWindow *self)
-{
-       /* TODO: show a dialog to ask the user for permission to close
-          all */
-       return TRUE;
-}
-
 void 
 modest_main_window_set_style (ModestMainWindow *self, 
                              ModestMainWindowStyle style)
index c444b74..73eed0f 100644 (file)
@@ -1219,29 +1219,6 @@ modest_main_window_new (void)
        return MODEST_WINDOW(self);
 }
 
-gboolean 
-modest_main_window_close_all (ModestMainWindow *self)
-{
-       GtkWidget *note;
-       GtkResponseType response;
-
-       /* Create the confirmation dialog MSG-NOT308 */
-       note = hildon_note_new_confirmation_add_buttons (GTK_WINDOW (self),
-                                                        _("emev_nc_close_windows"),
-                                                        _("mcen_bd_yes"), GTK_RESPONSE_YES,
-                                                        _("mcen_bd_no"), GTK_RESPONSE_NO,
-                                                        NULL);
-
-       response = gtk_dialog_run (GTK_DIALOG (note));
-       gtk_widget_destroy (GTK_WIDGET (note));
-
-       if (response == GTK_RESPONSE_YES)
-               return TRUE;
-       else
-               return FALSE;
-}
-
-
 void 
 modest_main_window_set_style (ModestMainWindow *self, 
                              ModestMainWindowStyle style)
index edf9a90..1256cc2 100644 (file)
@@ -129,17 +129,6 @@ typedef enum {
 GtkWidget* modest_main_window_get_child_widget (ModestMainWindow *self,
                                                ModestMainWindowWidgetType widget_type);
 
-/**
- * modest_main_window_close_all:
- * @self: 
- * 
- * this function will ask the user about if the user wants to close
- * all the windows or just the main one
- * 
- * Returns: TRUE if the user selected to close all the windows, otherwise FALSE
- **/
-gboolean   modest_main_window_close_all        (ModestMainWindow *self);
-
 
 /**
  * modest_main_window_set_style:
index a4153be..ced34cc 100644 (file)
@@ -512,6 +512,8 @@ on_window_destroy (ModestWindow *window,
                   GdkEvent *event,
                   ModestWindowMgr *self)
 {
+       gint dialog_response = GTK_RESPONSE_NONE;
+
        /* Specific stuff first */
        if (MODEST_IS_MAIN_WINDOW (window)) {
                ModestWindowMgrPrivate *priv;
@@ -520,21 +522,32 @@ on_window_destroy (ModestWindow *window,
                /* If more than one window already opened */
                if (g_list_length (priv->window_list) > 1) {
 
+                       /* Create the confirmation dialog MSG-NOT308 */
+                       dialog_response = modest_platform_run_confirmation_dialog (
+                                       GTK_WINDOW (window), _("emev_nc_close_windows"));
+
                        /* If the user wants to close all the windows */
-                       if (modest_main_window_close_all (MODEST_MAIN_WINDOW (window))) {
-                               GList *iter = priv->window_list;
-                               do {
-                                       if (iter->data != window) {
-                                               GList *tmp = iter->next;
-                                               on_window_destroy (MODEST_WINDOW (iter->data),
-                                                                  event,
-                                                                  self);
-                                               iter = tmp;
-                                       } else {
-                                               iter = g_list_next (iter);
-                                       }
-                               } while (iter);
-                       }
+                       if ((dialog_response == GTK_RESPONSE_OK) 
+                                       || (dialog_response == GTK_RESPONSE_ACCEPT) 
+                                       || (dialog_response == GTK_RESPONSE_YES))
+                               {
+                                       GList *iter = priv->window_list;
+                                       do {
+                                               if (iter->data != window) {
+                                                       GList *tmp = iter->next;
+                                                       on_window_destroy (MODEST_WINDOW (iter->data),
+                                                                       event,
+                                                                       self);
+                                                       iter = tmp;
+                                               } else {
+                                                       iter = g_list_next (iter);
+                                               }
+                                       } while (iter);
+                               }
+                       else
+                               {
+                                       return TRUE;
+                               }
                }
        }
        else {