diff options
author | esoleyman <emil@soleyman.com> | 2019-05-24 14:18:07 -0500 |
---|---|---|
committer | esoleyman <emil@soleyman.com> | 2019-05-28 09:45:36 -0500 |
commit | 68b69ab4a4548dc9eb94b89c0174f5a4253a4d7d (patch) | |
tree | 781ce42d726a9c2e5ce5ad741afce61cca6ea951 /src | |
parent | 3e40d6f1831ae45779ca17bebce8e58b32a3cad4 (diff) | |
download | cheese-68b69ab4a4548dc9eb94b89c0174f5a4253a4d7d.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/cheese-application.vala | 31 |
1 files changed, 31 insertions, 0 deletions
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 } @@ -470,6 +473,34 @@ public class Cheese.Application : Gtk.Application } /** + * 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. */ private void on_help () |