summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJamie Murphy <hello@itsjamie.dev>2022-09-01 18:13:28 -0700
committerJamie Murphy <hello@itsjamie.dev>2022-09-01 18:13:28 -0700
commit9cdc218072340dee535066e2c8e64d74e1d40acc (patch)
tree81d40c99abde00bffda62826b9430a3bafa4fdd3 /src
parent8a28f7b4415bb85fb6043a442a2e1e698ac21766 (diff)
downloadgnome-todo-9cdc218072340dee535066e2c8e64d74e1d40acc.tar.gz
application: Add Help and Quit accelerators
Closes #465
Diffstat (limited to 'src')
-rw-r--r--src/gui/gtd-application.c14
-rw-r--r--src/gui/shortcuts-dialog.ui16
2 files changed, 30 insertions, 0 deletions
diff --git a/src/gui/gtd-application.c b/src/gui/gtd-application.c
index b1768621..da3cdc9c 100644
--- a/src/gui/gtd-application.c
+++ b/src/gui/gtd-application.c
@@ -187,6 +187,17 @@ gtd_application_new (void)
}
static void
+set_accel_for_action (GtdApplication *self,
+ const gchar *detailed_action_name,
+ const gchar *accel)
+{
+ const char *accels[] = { accel, NULL };
+
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self), detailed_action_name, accels);
+}
+
+
+static void
run_window (GtdApplication *self)
{
gtk_window_present (GTK_WINDOW (self->window));
@@ -267,6 +278,9 @@ gtd_application_startup (GApplication *application)
G_N_ELEMENTS (gtd_application_entries),
self);
+ set_accel_for_action (self, "app.quit", "<Control>q");
+ set_accel_for_action (self, "app.help", "F1");
+
G_APPLICATION_CLASS (gtd_application_parent_class)->startup (application);
/* window */
diff --git a/src/gui/shortcuts-dialog.ui b/src/gui/shortcuts-dialog.ui
index dac7d4e6..b2fcfb68 100644
--- a/src/gui/shortcuts-dialog.ui
+++ b/src/gui/shortcuts-dialog.ui
@@ -18,6 +18,22 @@
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Quit</property>
+ <property name="accelerator">&lt;Control&gt;Q</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Help</property>
+ <property name="accelerator">F1</property>
+ </object>
+ </child>
+
+
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Move to the panel/view up</property>
<property name="accelerator">&lt;Control&gt;Page_Up</property>
</object>