[geary/mjog/mutiple-main-windows: 1/2] Select account/folder/conversations in new windows
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/mutiple-main-windows: 1/2] Select account/folder/conversations in new windows
- Date: Mon, 18 Nov 2019 08:17:10 +0000 (UTC)
commit af2b799dc72468c10b9bba9c93b867c7a2edddde
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 | 30 +++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/src/client/application/application-client.vala b/src/client/application/application-client.vala
index 7e5a3ba1..f5ef4e9e 100644
--- a/src/client/application/application-client.vala
+++ b/src/client/application/application-client.vala
@@ -615,10 +615,24 @@ public class Application.Client : Gtk.Application {
this.controller.compose(mailto);
}
- public async void new_window() {
+ public async void new_window(Geary.Folder? select_folder,
+ Gee.Collection<Geary.App.Conversation>? select_conversations) {
yield create_controller();
- new_main_window().present();
+ MainWindow main = new_main_window();
+ main.present();
+
+ if (select_folder != null) {
+ if (select_conversations == null || select_conversations.is_empty) {
+ main.select_folder.begin(select_folder, true);
+ } else {
+ main.show_conversations.begin(
+ select_folder,
+ select_conversations,
+ true
+ );
+ }
+ }
}
/** Returns the application's base user configuration directory. */
@@ -974,7 +988,17 @@ public class Application.Client : Gtk.Application {
}
private void on_activate_new_window() {
- this.new_window.begin();
+ // If there was an existing active main, select the same
+ // account/folder/conversation.
+ MainWindow? current = this.last_active_main_window;
+ // Make a copy of the selection so the underlying collection
+ // doesn't change as the selection does.
+ this.new_window.begin(
+ current.selected_folder,
+ Geary.traverse(
+ current.conversation_list_view.get_selected_conversations()
+ ).to_linked_list()
+ );
}
private void on_activate_preferences() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]