client: Ensure conversation is loaded before replying

This commit is contained in:
Cédric Bellegarde 2023-10-04 17:29:57 +02:00 committed by Niels De Graef
parent 155374a208
commit 4c442f6253
2 changed files with 29 additions and 3 deletions

View file

@ -2065,6 +2065,20 @@ public class Application.MainWindow :
}
}
private void reply_conversation(Composer.Widget.ContextType context_type) {
if (this.outer_leaflet.folded) {
this.conversation_list_view.activate_selected();
navigate_next_pane();
// This is a lot of async actions, delay composer creation
GLib.Timeout.add(500, () => {
this.create_composer_from_viewer.begin(context_type);
return Source.REMOVE;
});
} else {
this.create_composer_from_viewer.begin(context_type);
}
}
private void on_scan_completed(Geary.App.ConversationMonitor monitor) {
// Done scanning. Check if we have enough messages to fill
// the conversation list; if not, trigger a load_more();
@ -2405,15 +2419,15 @@ public class Application.MainWindow :
}
private void on_reply_conversation() {
this.create_composer_from_viewer.begin(REPLY_SENDER);
reply_conversation(REPLY_SENDER);
}
private void on_reply_all_conversation() {
this.create_composer_from_viewer.begin(REPLY_ALL);
reply_conversation(REPLY_ALL);
}
private void on_forward_conversation() {
this.create_composer_from_viewer.begin(FORWARD);
reply_conversation(FORWARD);
}
private void on_show_window_menu() {

View file

@ -356,6 +356,18 @@ public class ConversationList.View : Gtk.ScrolledWindow, Geary.BaseInterface {
});
}
/**
* Activate currently selected row
*
* If more than one selected, activate the first one
*/
public void activate_selected() {
Gee.Set<Geary.App.Conversation> conversations = get_selected_conversations();
if (!conversations.is_empty) {
conversation_activated(conversations.to_array()[0], 1);
}
}
/**
* Selects all conversations
*/