[geary] Present Welcome dialog if Geary re-run while visible: Bug #720360



commit 9013140c708aaed83af278ba06f69a5191e2645f
Author: Jim Nelson <jim yorba org>
Date:   Tue Oct 21 15:00:23 2014 -0700

    Present Welcome dialog if Geary re-run while visible: Bug #720360
    
    If the Welcome dialog (used to create the initial account) is visible
    and Geary was re-run, an empty main window would appear.  This is due
    to the Welcome dialog hiding the main window until the first account
    is created.  Now, if Geary is re-run the Welcome dialog is presented
    to the user.
    
    This may possibly solve bug #737811.

 src/client/application/geary-application.vala |   16 ++++++++++++++--
 src/client/application/geary-controller.vala  |    5 +++--
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index ee10326..e093d5a 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -151,13 +151,25 @@ public class GearyApplication : Gtk.Application {
     }
     
     public bool present() {
-        if (controller == null || controller.main_window == null)
+        if (controller == null)
+            return false;
+        
+        // if LoginDialog (i.e. the opening dialog for creating the initial account) is present
+        // and visible, bring that to top (to prevent opening the hidden main window, which is
+        // empty)
+        if (controller.login_dialog != null && controller.login_dialog.visible) {
+            controller.login_dialog.present_with_time(Gdk.CURRENT_TIME);
+            
+            return true;
+        }
+        
+        if (controller.main_window == null)
             return false;
         
         if (!controller.main_window.get_realized())
             controller.main_window.show_all();
         else
-            controller.main_window.present();
+            controller.main_window.present_with_time(Gdk.CURRENT_TIME);
         
         return true;
     }
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index c53fb67..c621668 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -90,7 +90,9 @@ public class GearyController : Geary.BaseObject {
     public Geary.App.ConversationMonitor? current_conversations { get; private set; default = null; }
     
     public AutostartManager? autostart_manager { get; private set; default = null; }
-
+    
+    public LoginDialog? login_dialog { get; private set; default = null; }
+    
     private Geary.Account? current_account = null;
     private Gee.HashMap<Geary.Account, Geary.App.EmailStore> email_stores
         = new Gee.HashMap<Geary.Account, Geary.App.EmailStore>();
@@ -118,7 +120,6 @@ public class GearyController : Geary.BaseObject {
     private Geary.Account? account_to_select = null;
     private Geary.Folder? previous_non_search_folder = null;
     private uint search_timeout_id = 0;
-    private LoginDialog? login_dialog = null;
     private UpgradeDialog upgrade_dialog;
     private Gee.List<string> pending_mailtos = new Gee.ArrayList<string>();
     private Geary.Nonblocking.Mutex untrusted_host_prompt_mutex = new Geary.Nonblocking.Mutex();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]