[gnome-games/wip/exalm/actions: 2/2] ui: Stop managing shortcuts window manually



commit 79a2a1cb2ec0d755b40f037327dde8655c9acc36
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Nov 12 01:13:35 2018 +0500

    ui: Stop managing shortcuts window manually
    
    Switch to 'win.show-help-overlay' action and use
    GtkApplicationWindow.set_help_overlay() instead of managing shortcuts
    window manually.

 data/ui/collection-header-bar.ui |  2 +-
 src/ui/application-window.vala   |  2 ++
 src/ui/application.vala          | 22 ----------------------
 3 files changed, 3 insertions(+), 23 deletions(-)
---
diff --git a/data/ui/collection-header-bar.ui b/data/ui/collection-header-bar.ui
index a7407a8d..20c043e8 100644
--- a/data/ui/collection-header-bar.ui
+++ b/data/ui/collection-header-bar.ui
@@ -117,7 +117,7 @@
           <object class="GtkModelButton">
             <property name="can-focus">True</property>
             <property name="text" translatable="yes">Keyboard Shortcuts</property>
-            <property name="action-name">app.shortcuts</property>
+            <property name="action-name">win.show-help-overlay</property>
             <property name="visible">True</property>
           </object>
         </child>
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 7082d393..8c7ff13c 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -158,6 +158,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
 
                if (Config.PROFILE == "Devel")
                        get_style_context ().add_class ("devel");
+
+               set_help_overlay (new ShortcutsWindow ());
        }
 
        public void run_game (Game game) {
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 7d1797fe..79e40bee 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -8,7 +8,6 @@ public class Games.Application : Gtk.Application {
        private Database database;
 
        private PreferencesWindow preferences_window;
-       private ShortcutsWindow shortcuts_window;
        private ApplicationWindow window;
        private bool game_list_loaded;
 
@@ -52,10 +51,6 @@ public class Games.Application : Gtk.Application {
                preferences_action.activate.connect (preferences);
                add_action (preferences_action);
 
-               SimpleAction shortcuts_action = new SimpleAction ("shortcuts", null);
-               shortcuts_action.activate.connect (shortcuts);
-               add_action (shortcuts_action);
-
                SimpleAction help_action = new SimpleAction ("help", null);
                help_action.activate.connect (help);
                add_action (help_action);
@@ -354,23 +349,6 @@ public class Games.Application : Gtk.Application {
                });
        }
 
-       private void shortcuts () {
-               if (shortcuts_window != null) {
-                       shortcuts_window.present ();
-
-                       return;
-               }
-
-               shortcuts_window = new ShortcutsWindow ();
-               shortcuts_window.destroy_with_parent = true;
-               shortcuts_window.transient_for = window;
-               shortcuts_window.destroy.connect (() => {
-                       shortcuts_window = null;
-               });
-
-               shortcuts_window.present ();
-       }
-
        private void help () {
                try {
                        Gtk.show_uri_on_window (active_window, HELP_URI, Gtk.get_current_event_time ());


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]