[geary/mjog/1193-conversation-buttons-resize-race: 5/13] client: Invoke the correct menu for move or copy shortcuts
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/1193-conversation-buttons-resize-race: 5/13] client: Invoke the correct menu for move or copy shortcuts
- Date: Tue, 13 Apr 2021 08:40:12 +0000 (UTC)
commit 5aea0ad10f10cd812f9eb1348f7e5f9a8519c093
Author: Michael Gratton <mike vee net>
Date: Sun Apr 11 11:20:04 2021 +1000
client: Invoke the correct menu for move or copy shortcuts
src/client/application/application-main-window.vala | 18 ++++++++++++++++--
.../components/components-conversation-actions.vala | 8 ++++++++
src/client/components/components-main-toolbar.vala | 8 ++++++++
3 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index ec4416194..41f022358 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -2332,11 +2332,25 @@ public class Application.MainWindow :
}
private void on_show_copy_menu() {
- this.conversation_actions.copy_message_button.clicked();
+ if (this.is_conversation_list_shown &&
+ this.conversation_list_actions_revealer.child_revealed) {
+ this.conversation_list_actions.show_copy_menu();
+ } else if (this.is_conversation_viewer_shown) {
+ this.main_toolbar.shown_actions.show_copy_menu();
+ } else {
+ this.error_bell();
+ }
}
private void on_show_move_menu() {
- this.conversation_actions.move_message_button.clicked();
+ if (this.is_conversation_list_shown &&
+ this.conversation_list_actions_revealer.child_revealed) {
+ this.conversation_list_actions.show_move_menu();
+ } else if (this.is_conversation_viewer_shown) {
+ this.main_toolbar.shown_actions.show_move_menu();
+ } else {
+ this.error_bell();
+ }
}
private void on_conversation_up() {
diff --git a/src/client/components/components-conversation-actions.vala
b/src/client/components/components-conversation-actions.vala
index 8c2fa32a9..a9e17c580 100644
--- a/src/client/components/components-conversation-actions.vala
+++ b/src/client/components/components-conversation-actions.vala
@@ -70,6 +70,14 @@ public class Components.ConversationActions : Gtk.Box {
}
}
+ public void show_copy_menu() {
+ this.copy_message_button.clicked();
+ }
+
+ public void show_move_menu() {
+ this.move_message_button.clicked();
+ }
+
public void update_trash_button(bool show_trash) {
this.show_trash_button = show_trash;
update_conversation_buttons();
diff --git a/src/client/components/components-main-toolbar.vala
b/src/client/components/components-main-toolbar.vala
index 98a62730a..90e6f79d6 100644
--- a/src/client/components/components-main-toolbar.vala
+++ b/src/client/components/components-main-toolbar.vala
@@ -1,5 +1,6 @@
/*
* Copyright © 2017 Software Freedom Conservancy Inc.
+ * Copyright © 2021 Michael Gratton <mike vee net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
@@ -25,6 +26,12 @@ public class Components.MainToolbar : Hdy.Leaflet {
public bool find_open { get; set; default = false; }
+ public ConversationActions shown_actions {
+ get {
+ return (ConversationActions) this.actions_squeezer.visible_child;
+ }
+ }
+
[GtkChild] public unowned ConversationActions full_actions;
[GtkChild] public unowned ConversationActions compact_actions;
@@ -44,6 +51,7 @@ public class Components.MainToolbar : Hdy.Leaflet {
// Conversation viewer header elements
[GtkChild] private unowned Hdy.HeaderBar conversation_header;
+ [GtkChild] private unowned Hdy.Squeezer actions_squeezer;
[GtkChild] private unowned Gtk.ToggleButton find_button;
[GtkChild] private unowned Hdy.HeaderGroup header_group;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]