[geary/mjog/shortcut-updates: 4/4] client: Implement showing window menu when F10 pressed
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/shortcut-updates: 4/4] client: Implement showing window menu when F10 pressed
- Date: Fri, 8 Jan 2021 06:57:50 +0000 (UTC)
commit 7ec99e1f6bc1d0abda68ae4b1aae98d98884f8d6
Author: Michael Gratton <mike vee net>
Date: Thu Jan 7 11:54:12 2021 +1100
client: Implement showing window menu when F10 pressed
Fixes #1102
src/client/application/application-client.vala | 3 ++-
src/client/application/application-main-window.vala | 19 ++++++++++++++++++-
src/client/client-action.vala | 3 ++-
src/client/components/main-toolbar.vala | 5 +++++
src/client/composer/composer-widget.vala | 13 ++++++++++++-
5 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/application-client.vala b/src/client/application/application-client.vala
index db8cdfdcb..0bd704fc7 100644
--- a/src/client/application/application-client.vala
+++ b/src/client/application/application-client.vala
@@ -1,6 +1,6 @@
/*
* Copyright © 2016 Software Freedom Conservancy Inc.
- * Copyright © 2019-2020 Michael Gratton <mike vee net>
+ * Copyright © 2019-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.
@@ -400,6 +400,7 @@ public class Application.Client : Gtk.Application {
add_window_accelerators(
Action.Window.SHORTCUT_HELP, { "<Ctrl>F1", "<Ctrl>question" }
);
+ add_window_accelerators(Action.Window.SHOW_MENU, { "F10" });
// Common edit accels
add_edit_accelerators(Action.Edit.COPY, { "<Ctrl>C" });
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index 27526e0e1..589dc6cf1 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -1,6 +1,6 @@
/*
* Copyright © 2016 Software Freedom Conservancy Inc.
- * Copyright © 2016, 2019-2020 Michael Gratton <mike vee net>
+ * Copyright © 2016, 2019-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.
@@ -40,10 +40,12 @@ public class Application.MainWindow :
private const ActionEntry[] WINDOW_ACTIONS = {
{ Action.Window.CLOSE, on_close },
+ { Action.Window.SHOW_MENU, on_show_window_menu },
{ ACTION_FIND_IN_CONVERSATION, on_find_in_conversation_action },
{ ACTION_SEARCH, on_search_activated },
{ ACTION_NAVIGATION_BACK, focus_previous_pane},
+
// Message actions
{ ACTION_REPLY_CONVERSATION, on_reply_conversation },
{ ACTION_REPLY_ALL_CONVERSATION, on_reply_all_conversation },
@@ -880,6 +882,17 @@ public class Application.MainWindow :
}
}
+ /** Shows the appopriate window menu, if any. */
+ public void show_window_menu() {
+ if (this.main_leaflet.folded) {
+ this.main_leaflet.navigate(Hdy.NavigationDirection.BACK);
+ }
+ if (this.conversations_leaflet.folded) {
+ this.conversations_leaflet.navigate(Hdy.NavigationDirection.BACK);
+ }
+ this.main_toolbar.show_main_menu();
+ }
+
/** Displays and focuses the search bar for the window. */
public void show_search_bar(string? text = null) {
this.search_bar.grab_focus();
@@ -2250,6 +2263,10 @@ public class Application.MainWindow :
this.create_composer_from_viewer.begin(FORWARD);
}
+ private void on_show_window_menu() {
+ show_window_menu();
+ }
+
private void on_show_copy_menu() {
this.conversation_actions.copy_message_button.clicked();
}
diff --git a/src/client/client-action.vala b/src/client/client-action.vala
index 70997d203..3204ae89f 100644
--- a/src/client/client-action.vala
+++ b/src/client/client-action.vala
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Michael Gratton <mike vee net>
+ * Copyright 2019-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.
@@ -44,6 +44,7 @@ namespace Action {
public const string CLOSE = "close";
public const string SHORTCUT_HELP = "show-help-overlay";
+ public const string SHOW_MENU = "show-menu";
/** Returns the given action name prefixed with the group name. */
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index ab0e3ba1d..252b106c4 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -109,4 +109,9 @@ public class MainToolbar : Hdy.Leaflet {
public void add_conversation_actions(Components.ConversationActions actions) {
conversation_header.add_conversation_actions(actions);
}
+
+ public void show_main_menu() {
+ this.main_menu_button.clicked();
+ }
+
}
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 3d893d436..37172593d 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -1,6 +1,6 @@
/*
* Copyright © 2016 Software Freedom Conservancy Inc.
- * Copyright © 2017-2020 Michael Gratton <mike vee net>
+ * Copyright © 2017-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.
@@ -144,6 +144,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
private const ActionEntry[] ACTIONS = {
{ Action.Edit.COPY, on_copy },
{ Action.Window.CLOSE, on_close },
+ { Action.Window.SHOW_MENU, on_show_window_menu },
{ ACTION_ADD_ATTACHMENT, on_add_attachment },
{ ACTION_ADD_ORIGINAL_ATTACHMENTS, on_pending_attachments },
{ ACTION_CLOSE, on_close },
@@ -2440,6 +2441,16 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
conditional_close(this.container is Window);
}
+ private void on_show_window_menu() {
+ Application.MainWindow main = null;
+ if (this.container != null) {
+ main = this.container.top_window as Application.MainWindow;
+ }
+ if (main != null) {
+ main.show_window_menu();
+ }
+ }
+
private void on_discard() {
if (this.container is Window) {
conditional_close(true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]