[cheese] Added Keyboard Shortcuts window
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Added Keyboard Shortcuts window
- Date: Tue, 28 May 2019 14:53:47 +0000 (UTC)
commit 68b69ab4a4548dc9eb94b89c0174f5a4253a4d7d
Author: esoleyman <emil soleyman com>
Date: Fri May 24 14:18:07 2019 -0500
Added Keyboard Shortcuts window
Coalesce the small, yet disparate shortcut keys available to users
in a separate window.
https://gitlab.gnome.org/GNOME/cheese/issues/9
Makefile.am | 1 +
data/headerbar.ui | 4 +++
data/org.gnome.Cheese.gresource.xml | 1 +
data/shortcuts.ui | 60 +++++++++++++++++++++++++++++++++++++
po/POTFILES.in | 1 +
src/cheese-application.vala | 31 +++++++++++++++++++
6 files changed, 98 insertions(+)
---
diff --git a/Makefile.am b/Makefile.am
index 37b1ed92..72be7aeb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -194,6 +194,7 @@ noinst_resource_files = \
data/cheese-prefs.ui \
data/headerbar.ui \
data/menus.ui \
+ data/shortcuts.ui \
data/pixmaps/cheese-1.svg \
data/pixmaps/cheese-2.svg \
data/pixmaps/cheese-3.svg \
diff --git a/data/headerbar.ui b/data/headerbar.ui
index f2fb0475..8068b472 100644
--- a/data/headerbar.ui
+++ b/data/headerbar.ui
@@ -12,6 +12,10 @@
</item>
</section>
<section>
+ <item>
+ <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+ <attribute name="action">app.shortcuts</attribute>
+ </item>
<item>
<attribute name="accel">F1</attribute>
<attribute name="label" translatable="yes">_Help</attribute>
diff --git a/data/org.gnome.Cheese.gresource.xml b/data/org.gnome.Cheese.gresource.xml
index 00c2d29c..439800fc 100644
--- a/data/org.gnome.Cheese.gresource.xml
+++ b/data/org.gnome.Cheese.gresource.xml
@@ -5,6 +5,7 @@
<file>cheese-viewport.json</file>
<file preprocess="xml-stripblanks">cheese-main-window.ui</file>
<file preprocess="xml-stripblanks">cheese-prefs.ui</file>
+ <file preprocess="xml-stripblanks">shortcuts.ui</file>
<file preprocess="xml-stripblanks">headerbar.ui</file>
<file>pixmaps/cheese-1.svg</file>
<file>pixmaps/cheese-2.svg</file>
diff --git a/data/shortcuts.ui b/data/shortcuts.ui
new file mode 100644
index 00000000..3c1d0a07
--- /dev/null
+++ b/data/shortcuts.ui
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkShortcutsWindow" id="shortcuts-cheese">
+ <property name="modal">1</property>
+ <child>
+ <object class="GtkShortcutsSection">
+ <property name="visible">1</property>
+ <property name="section-name">shortcuts</property>
+ <property name="max-height">12</property>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="title" translatable="yes">Overview</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator">F11</property>
+ <property name="title" translatable="yes">Fullscreen on / off</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator"><ctrl>Q</property>
+ <property name="title" translatable="yes">Quit the application</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsGroup">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Thumbnails</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator"><ctrl>O</property>
+ <property name="title" translatable="yes">Open</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator"><ctrl>S</property>
+ <property name="title" translatable="yes">Save As</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator">Delete</property>
+ <property name="title" translatable="yes">Move to Trash</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="accelerator"><Shift>Delete</property>
+ <property name="title" translatable="yes">Delete</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9a85b355..14be4fee 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,6 +5,7 @@
[type: gettext/glade]data/cheese-prefs.ui
[type: gettext/glade]data/headerbar.ui
[type: gettext/glade]data/menus.ui
+[type: gettext/glade]data/shortcuts.ui
data/org.gnome.Cheese.appdata.xml.in
data/org.gnome.Cheese.desktop.in.in
[type: gettext/gsettings]data/org.gnome.Cheese.gschema.xml
diff --git a/src/cheese-application.vala b/src/cheese-application.vala
index ee107395..c4542be0 100644
--- a/src/cheese-application.vala
+++ b/src/cheese-application.vala
@@ -36,6 +36,8 @@ public class Cheese.Application : Gtk.Application
private Camera camera;
private PreferencesDialog preferences_dialog;
+ private Gtk.ShortcutsWindow shortcuts_window;
+
private const GLib.ActionEntry action_entries[] = {
{ "shoot", on_shoot },
{ "mode", on_action_radio, "s", "'photo'", on_mode_change },
@@ -44,6 +46,7 @@ public class Cheese.Application : Gtk.Application
{ "wide-mode", on_action_toggle, null, "false", on_wide_mode_change },
{ "effects", on_action_toggle, null, "false", on_effects_change },
{ "preferences", on_preferences },
+ { "shortcuts", on_shortcuts },
{ "help", on_help },
{ "about", on_about },
{ "quit", on_quit }
@@ -469,6 +472,34 @@ public class Cheese.Application : Gtk.Application
preferences_dialog.show ();
}
+ /**
+ * Show the keyboard shortcuts.
+ */
+ private void on_shortcuts ()
+ {
+ if (shortcuts_window == null)
+ {
+ var builder = new Gtk.Builder ();
+ try
+ {
+ builder.add_from_resource ("/org/gnome/Cheese/shortcuts.ui");
+ }
+ catch (Error e)
+ {
+ error ("Error loading shortcuts window UI: %s", e.message);
+ }
+
+ shortcuts_window = builder.get_object ("shortcuts-cheese") as Gtk.ShortcutsWindow;
+ shortcuts_window.close.connect ( (event) => { shortcuts_window = null; } );
+ }
+
+ if (get_active_window () != shortcuts_window.get_transient_for ())
+ shortcuts_window.set_transient_for (get_active_window ());
+
+ shortcuts_window.show_all ();
+ shortcuts_window.present ();
+ }
+
/**
* Show the Cheese help contents.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]