[geary/mjog/mutiple-main-windows] Select account/folder/conversations in new windows



commit 3f0bac1d705a9bf2cd83951c9c4968cf6160ceec
Author: Michael Gratton <mike vee net>
Date:   Mon Nov 18 18:50:45 2019 +1100

    Select account/folder/conversations in new windows
    
    Select the same as was selected in last active window, if any.

 src/client/application/application-client.vala | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/src/client/application/application-client.vala b/src/client/application/application-client.vala
index 7e5a3ba1..6d4ec2f3 100644
--- a/src/client/application/application-client.vala
+++ b/src/client/application/application-client.vala
@@ -618,7 +618,29 @@ public class Application.Client : Gtk.Application {
     public async void new_window() {
         yield create_controller();
 
-        new_main_window().present();
+        MainWindow? current_main = this.last_active_main_window;
+        MainWindow new_main = new_main_window();
+        new_main.present();
+
+        // If there was an existing active main, select the same
+        // account/folder/conversation.
+        if (current_main != null &&
+            current_main.selected_folder != null) {
+            var conversations =
+                current_main.conversation_list_view.get_selected_conversations();
+            if (conversations.is_empty) {
+                new_main.select_folder.begin(
+                    current_main.selected_folder,
+                    true
+                );
+            } else {
+                new_main.show_conversations.begin(
+                    current_main.selected_folder,
+                    conversations,
+                    true
+                );
+            }
+        }
     }
 
     /** Returns the application's base user configuration directory. */


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