[geary: 1/3] application-main-window: Add shortcut to select inbox
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary: 1/3] application-main-window: Add shortcut to select inbox
- Date: Mon, 18 Jan 2021 08:58:09 +0000 (UTC)
commit e0fab92d3c7e981d217ea1f134f4a27cc4723f88
Author: Jeremias Ortega <jeremias ortega tech>
Date: Sun Jan 17 16:55:49 2021 -0600
application-main-window: Add shortcut to select inbox
Closes: https://gitlab.gnome.org/GNOME/geary/-/issues/1108
.../application/application-main-window.vala | 25 ++++++++++++++++++++++
ui/gtk/help-overlay.ui | 7 ++++++
2 files changed, 32 insertions(+)
---
diff --git a/src/client/application/application-main-window.vala
b/src/client/application/application-main-window.vala
index 589dc6cf1..d5255a415 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -25,6 +25,7 @@ public class Application.MainWindow :
public const string ACTION_REPLY_ALL_CONVERSATION = "reply-all-conversation";
public const string ACTION_REPLY_CONVERSATION = "reply-conversation";
public const string ACTION_SEARCH = "search";
+ public const string ACTION_SELECT_INBOX = "select-inbox";
public const string ACTION_SHOW_COPY_MENU = "show-copy-menu";
public const string ACTION_SHOW_MARK_MENU = "show-mark-menu";
public const string ACTION_SHOW_MOVE_MENU = "show-move-menu";
@@ -44,6 +45,7 @@ public class Application.MainWindow :
{ ACTION_FIND_IN_CONVERSATION, on_find_in_conversation_action },
{ ACTION_SEARCH, on_search_activated },
+ { ACTION_SELECT_INBOX, on_select_inbox, "i" },
{ ACTION_NAVIGATION_BACK, focus_previous_pane},
// Message actions
@@ -221,6 +223,12 @@ public class Application.MainWindow :
public static void add_accelerators(Client owner) {
+ for (int i = 1; i <= 9; i++) {
+ owner.add_window_accelerators(
+ ACTION_SELECT_INBOX+("(%d)".printf(i - 1)), { "<ALT>%d".printf(i) }
+ );
+ }
+
// Zoom
owner.add_window_accelerators(
ACTION_ZOOM+("('in')"), { "<Ctrl>equal", "<Ctrl>plus" }
@@ -2187,6 +2195,23 @@ public class Application.MainWindow :
this.select_folder.begin(folder, true);
}
+ private void on_select_inbox(SimpleAction action, Variant? parameter) {
+ if (parameter != null) {
+ int account_number = parameter.get_int32();
+ try {
+ Gee.Collection<Geary.Account> accounts =
+ this.application.engine.get_accounts();
+ if (account_number < accounts.size) {
+ Geary.Account account = accounts.to_array()[account_number];
+ Geary.Folder inbox = account.get_special_folder(INBOX);
+ this.select_folder.begin(inbox, true);
+ }
+ } catch (GLib.Error error) {
+ debug("Error getting accounts");
+ }
+ }
+ }
+
private void on_search(string text) {
if (Geary.String.is_empty_or_whitespace(text)) {
stop_search(true);
diff --git a/ui/gtk/help-overlay.ui b/ui/gtk/help-overlay.ui
index af6574517..7e8336fdc 100644
--- a/ui/gtk/help-overlay.ui
+++ b/ui/gtk/help-overlay.ui
@@ -389,6 +389,13 @@
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Keyboard
navigation</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Select inbox</property>
+ <property name="accelerator"><Alt>1...9</property>
+ </object>
+ </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]