* Do not show multiple headers view
authorSergio Villar Senin <svillar@igalia.com>
Mon, 16 Feb 2009 15:46:54 +0000 (15:46 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 16 Feb 2009 15:46:54 +0000 (15:46 +0000)
* Fixes NB#100902, do not show multiple views when clicking multiple times. Needs previous commit.

pmo-trunk-r7502

src/hildon2/modest-accounts-window.c
src/hildon2/modest-folder-window.c
src/hildon2/modest-hildon2-window-mgr.c
src/modest-ui-actions.c

index 95afa6b..3d6b60c 100644 (file)
@@ -347,6 +347,7 @@ on_account_activated (GtkTreeView *account_view,
 
        if (!registered) {
                gtk_widget_destroy (folder_window);
+               folder_window = NULL;
        } else {
                modest_folder_window_set_account (MODEST_FOLDER_WINDOW (folder_window), account_name);
                gtk_widget_show (folder_window);
index 520b04c..886c26a 100644 (file)
@@ -438,11 +438,15 @@ on_folder_activated (ModestFolderView *folder_view,
                return;
 
        headerwin = modest_header_window_new (folder, modest_window_get_active_account (MODEST_WINDOW (self)));
-       modest_window_mgr_register_window (modest_runtime_get_window_mgr (),
-                                          MODEST_WINDOW (headerwin),
-                                          MODEST_WINDOW (self));
 
-       gtk_widget_show (GTK_WIDGET (headerwin));
+       if (modest_window_mgr_register_window (modest_runtime_get_window_mgr (),
+                                              MODEST_WINDOW (headerwin),
+                                              MODEST_WINDOW (self))) {
+               gtk_widget_show (GTK_WIDGET (headerwin));
+       } else {
+               gtk_widget_destroy (GTK_WIDGET (headerwin));
+               headerwin = NULL;
+       }
 }
 
 static void
index 5bd5b0e..afd3419 100644 (file)
@@ -31,6 +31,7 @@
 #include <hildon/hildon.h>
 #include "modest-hildon2-window-mgr.h"
 #include "modest-msg-edit-window.h"
+#include "modest-header-window.h"
 #include "modest-main-window.h"
 #include "modest-conf.h"
 #include "modest-defs.h"
@@ -389,6 +390,12 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self,
                return FALSE;
        }
 
+       if (MODEST_IS_HEADER_WINDOW (current_top) && MODEST_IS_HEADER_WINDOW (window)) {
+               g_debug ("Trying to register a second header window is not allowed");
+               gtk_window_present (GTK_WINDOW (current_top));
+               return FALSE;
+       }
+
        if (!MODEST_WINDOW_MGR_CLASS (parent_class)->register_window (self, window, parent))
                goto fail;
 
@@ -716,7 +723,7 @@ create_folders_view (ModestWindowMgr *self)
                gtk_widget_destroy (folders_window);
                folders_window = NULL;
        }
-       return folders_window;
+       return MODEST_WINDOW (folders_window);
 }
 
 static void
index 2c7e70a..dfd8c97 100644 (file)
@@ -239,17 +239,23 @@ modest_ui_actions_run_account_setup_wizard (ModestWindow *win)
 
                window_list = modest_window_mgr_get_window_list (mgr);
                if (window_list == NULL) {
+                       ModestWindow *old_win;
                        win = MODEST_WINDOW (modest_accounts_window_new ());
-                       if (modest_window_mgr_register_window (mgr, win, NULL))
+                       if (modest_window_mgr_register_window (mgr, win, NULL)) {
                                gtk_widget_show_all (GTK_WIDGET (win));
-                       else
+                       } else {
                                gtk_widget_destroy (GTK_WIDGET (win));
+                               win = NULL;
+                       }
 
+                       old_win = win;
                        win = MODEST_WINDOW (modest_folder_window_new (NULL));
-                       if (modest_window_mgr_register_window (mgr, win, NULL))
+                       if (modest_window_mgr_register_window (mgr, win, NULL)) {
                                gtk_widget_show_all (GTK_WIDGET (win));
-                       else
+                       } else {
                                gtk_widget_destroy (GTK_WIDGET (win));
+                               win = old_win;
+                       }
                } else {
                        g_list_free (window_list);
                }
@@ -3493,7 +3499,7 @@ on_rename_folder_cb (ModestMailOperation *mail_op,
        } else {
                modest_folder_view_select_first_inbox_or_local (folder_view);
        }
-       gtk_widget_grab_focus (GTK_WIDGET (folder_view));       
+       gtk_widget_grab_focus (GTK_WIDGET (folder_view));
 }
 
 static void