Add shortcuts window

This commit is contained in:
fiaxh 2019-12-17 22:54:08 +01:00
parent 11c18cdf72
commit 97647f9b52
5 changed files with 88 additions and 0 deletions

View File

@ -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

View File

@ -11,5 +11,11 @@
<attribute name="label" translatable="yes">Settings</attribute>
</item>
</section>
<section>
<item>
<attribute name="action">app.open_shortcuts</attribute>
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
</item>
</section>
</menu>
</interface>

52
main/data/shortcuts.ui Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts-window">
<property name="modal">True</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">True</property>
<property name="section-name">shortcuts</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="accelerator">&lt;ctrl&gt;T</property>
<property name="title" translatable="yes">Start Conversation</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="accelerator">&lt;ctrl&gt;G</property>
<property name="title" translatable="yes">Join Channel</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes">Navigation</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="accelerator">&lt;ctrl&gt;Tab</property>
<property name="title" translatable="yes">Jump to next conversation</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Shift&gt;Tab</property>
<property name="title" translatable="yes">Jump to previous conversation</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -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 ""

View File

@ -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[]{"<Ctrl><Shift>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() {