[geary/mjog/account-command-stacks: 35/77] Implement main toolbar composer actions
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/account-command-stacks: 35/77] Implement main toolbar composer actions
- Date: Tue, 5 Nov 2019 00:36:02 +0000 (UTC)
commit d1d8bed53b4b85256dff8dc15f576f594ef7ce59
Author: Michael Gratton <mike vee net>
Date: Sat Oct 5 10:52:04 2019 +1000
Implement main toolbar composer actions
src/client/application/application-controller.vala | 9 +++++++++
src/client/components/main-window.vala | 19 +++++++++++++++++++
2 files changed, 28 insertions(+)
---
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index d5b167c2..62a44247 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -456,6 +456,15 @@ public class Application.Controller : Geary.BaseObject {
}
}
+ /**
+ * Opens new composer with an existing message as context.
+ */
+ public void compose_with_context_email(ComposerWidget.ComposeType type,
+ Geary.Email context,
+ string? quote) {
+ create_compose_widget(type, context, quote);
+ }
+
/** Adds a new composer to be kept track of. */
public void add_composer(ComposerWidget widget) {
debug(@"Added composer of type $(widget.compose_type); $(this.composer_widgets.size) composers
total");
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 82138736..337a73e6 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -804,6 +804,22 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
this.conversations = null;
}
+ private void create_composer_from_viewer(ComposerWidget.ComposeType compose_type) {
+ ConversationEmail? email_view = null;
+ ConversationListBox? list_view = this.conversation_viewer.current_list;
+ if (list_view != null) {
+ email_view = list_view.get_reply_target();
+ }
+ if (email_view != null) {
+ email_view.get_selection_for_quoting.begin((obj, res) => {
+ string? quote = email_view.get_selection_for_quoting.end(res);
+ this.application.controller.compose_with_context_email(
+ compose_type, email_view.email, quote
+ );
+ });
+ }
+ }
+
private void load_more() {
if (this.conversations != null) {
this.conversations.min_window_count += MIN_CONVERSATION_COUNT;
@@ -1108,12 +1124,15 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
}
private void on_reply_to_message() {
+ create_composer_from_viewer(REPLY);
}
private void on_reply_all_message() {
+ create_composer_from_viewer(REPLY_ALL);
}
private void on_forward_message() {
+ create_composer_from_viewer(FORWARD);
}
private void on_show_copy_menu() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]