From 97647f9b5251dfc7a5a84d7432a1914fa7ec66b9 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 17 Dec 2019 22:54:08 +0100 Subject: [PATCH] Add shortcuts window --- main/CMakeLists.txt | 1 + main/data/menu_app.ui | 6 +++++ main/data/shortcuts.ui | 52 ++++++++++++++++++++++++++++++++++++ main/po/dino.pot | 20 ++++++++++++++ main/src/ui/application.vala | 9 +++++++ 5 files changed, 88 insertions(+) create mode 100644 main/data/shortcuts.ui diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index e6387894..2e9e6632 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -61,6 +61,7 @@ set(RESOURCE_LIST occupant_list_item.ui search_autocomplete.ui settings_dialog.ui + shortcuts.ui unified_main_content.ui unified_window_placeholder.ui diff --git a/main/data/menu_app.ui b/main/data/menu_app.ui index eadbc81e..20bd66b6 100644 --- a/main/data/menu_app.ui +++ b/main/data/menu_app.ui @@ -11,5 +11,11 @@ Settings +
+ + app.open_shortcuts + Keyboard Shortcuts + +
diff --git a/main/data/shortcuts.ui b/main/data/shortcuts.ui new file mode 100644 index 00000000..68c71237 --- /dev/null +++ b/main/data/shortcuts.ui @@ -0,0 +1,52 @@ + + + + True + + + True + shortcuts + + + True + General + + + True + <ctrl>T + Start Conversation + + + + + True + <ctrl>G + Join Channel + + + + + + + True + Navigation + + + True + <ctrl>Tab + Jump to next conversation + + + + + True + <ctrl><Shift>Tab + Jump to previous conversation + + + + + + + + diff --git a/main/po/dino.pot b/main/po/dino.pot index 0ccc58e8..f526669d 100644 --- a/main/po/dino.pot +++ b/main/po/dino.pot @@ -678,6 +678,10 @@ msgstr "" msgid "Unencrypted" msgstr "" +#: main/data/menu_app.ui:17 +msgid "Keyboard Shortcuts" +msgstr "" + #: main/data/im.dino.Dino.appdata.xml.in:8 msgid "Modern XMPP Chat Client" msgstr "" @@ -726,6 +730,22 @@ msgstr "" msgid "Add Contact" msgstr "" +#: main/data/shortcuts.ui:12 +msgid "General" +msgstr "" + +#: main/data/shortcuts.ui:32 +msgid "Navigation" +msgstr "" + +#: main/data/shortcuts.ui:37 +msgid "Jump to next conversation" +msgstr "" + +#: main/data/shortcuts.ui:44 +msgid "Jump to previous conversation" +msgstr "" + #: main/data/global_search.ui:37 msgid "No active search" msgstr "" diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index f031bf43..0f932d18 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -140,6 +140,15 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { loop_conversations_bw_action.activate.connect(() => { window.loop_conversations(true); }); add_action(loop_conversations_bw_action); set_accels_for_action("app.loop_conversations_bw", new string[]{"Tab"}); + + SimpleAction open_shortcuts_action = new SimpleAction("open_shortcuts", null); + open_shortcuts_action.activate.connect((variant) => { + Builder builder = new Builder.from_resource("/im/dino/Dino/shortcuts.ui"); + var dialog = (ShortcutsWindow) builder.get_object("shortcuts-window"); + dialog.set_transient_for(get_active_window()); + dialog.present(); + }); + add_action(open_shortcuts_action); } public bool use_csd() {