aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Davis <christopherdavis@gnome.org>2023-07-03 21:55:11 -0400
committerfiaxh <fiaxh@users.noreply.github.com>2023-07-08 11:20:51 +0200
commit3d5dad25d8d400003bea74b4c891f041c01351b5 (patch)
tree7ce3a1c811a239deaec65a9e9cec7f7923bd009c
parenta36a63d7e42f5a21ecc3755db2570ce2b379f5ff (diff)
downloaddino-3d5dad25d8d400003bea74b4c891f041c01351b5.tar.gz
dino-3d5dad25d8d400003bea74b4c891f041c01351b5.zip
application: Load help overlay automatically
GTK automatically loads and sets up the action and keyboard shortcut for the Keyboard Shortcuts dialog. We don't need to manually do it as long as we put everything in the right place. See https://docs.gtk.org/gtk4/class.Application.html#automatic-resources
-rw-r--r--main/CMakeLists.txt2
-rw-r--r--main/data/gresource.xml3
-rw-r--r--main/data/gtk/help-overlay.ui (renamed from main/data/shortcuts.ui)2
-rw-r--r--main/data/menu_app.ui2
-rw-r--r--main/src/ui/application.vala14
5 files changed, 4 insertions, 19 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index f78a1191..9202c1c7 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -82,7 +82,7 @@ set(RESOURCE_LIST
quote.ui
search_autocomplete.ui
settings_dialog.ui
- shortcuts.ui
+ gtk/help-overlay.ui
unified_main_content.ui
unified_window_placeholder.ui
diff --git a/main/data/gresource.xml b/main/data/gresource.xml
index 603d7fd0..84c6f2b4 100644
--- a/main/data/gresource.xml
+++ b/main/data/gresource.xml
@@ -61,11 +61,10 @@
<file>quote.ui</file>
<file>search_autocomplete.ui</file>
<file>settings_dialog.ui</file>
- <file>shortcuts.ui</file>
+ <file>gtk/help-overlay.ui</file>
<file>style-dark.css</file>
<file>style.css</file>
<file>unified_main_content.ui</file>
<file>unified_window_placeholder.ui</file>
</gresource>
</gresources>
-
diff --git a/main/data/shortcuts.ui b/main/data/gtk/help-overlay.ui
index 6cc5851a..17b0555c 100644
--- a/main/data/shortcuts.ui
+++ b/main/data/gtk/help-overlay.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <object class="GtkShortcutsWindow" id="shortcuts-window">
+ <object class="GtkShortcutsWindow" id="help_overlay">
<property name="modal">True</property>
<child>
<object class="GtkShortcutsSection">
diff --git a/main/data/menu_app.ui b/main/data/menu_app.ui
index f269e219..bb33ff65 100644
--- a/main/data/menu_app.ui
+++ b/main/data/menu_app.ui
@@ -13,7 +13,7 @@
<attribute name="label" translatable="yes">Preferences</attribute>
</item>
<item>
- <attribute name="action">app.open_shortcuts</attribute>
+ <attribute name="action">win.show-help-overlay</attribute>
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
</item>
<item>
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 9ee3361a..45d958cb 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -195,20 +195,6 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application {
add_action(loop_conversations_bw_action);
set_accels_for_action("app.loop_conversations_bw", KEY_COMBINATION_LOOP_CONVERSATIONS_REV);
- 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");
- ShortcutsWindow dialog = (ShortcutsWindow) builder.get_object("shortcuts-window");
- if (!use_csd()) {
- dialog.set_titlebar(null);
- }
- dialog.title = _("Keyboard Shortcuts");
- dialog.set_transient_for(get_active_window());
- dialog.present();
- });
- add_action(open_shortcuts_action);
- set_accels_for_action("app.open_shortcuts", KEY_COMBINATION_SHOW_KEYBOARD_SHORTCUTS);
-
SimpleAction accept_call_action = new SimpleAction("accept-call", new VariantType.tuple(new VariantType[]{VariantType.INT32, VariantType.INT32}));
accept_call_action.activate.connect((variant) => {
int conversation_id = variant.get_child_value(0).get_int32();