[gnome-games/wip/exalm/ds-popover: 15/16] shortcuts-window: Integrate plugins



commit c1faf0c1213b3c16f1ec571f3c7d6c72c44d095d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sat Jan 19 03:00:51 2019 +0500

    shortcuts-window: Integrate plugins

 data/ui/shortcuts-window.ui  |  2 +-
 src/ui/shortcuts-window.vala | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/shortcuts-window.ui b/data/ui/shortcuts-window.ui
index 2b73d330..fc2a6903 100644
--- a/data/ui/shortcuts-window.ui
+++ b/data/ui/shortcuts-window.ui
@@ -4,7 +4,7 @@
     <property name="modal">1</property>
     <signal name="direction-changed" after="yes" handler="update_direction"/>
     <child>
-      <object class="GtkShortcutsSection">
+      <object class="GtkShortcutsSection" id="shortcuts_section">
         <property name="max-height">12</property>
         <property name="section-name">shortcuts</property>
         <property name="title" translatable="yes">Shortcuts</property>
diff --git a/src/ui/shortcuts-window.vala b/src/ui/shortcuts-window.vala
index 7a665bab..5849b7ff 100644
--- a/src/ui/shortcuts-window.vala
+++ b/src/ui/shortcuts-window.vala
@@ -21,6 +21,9 @@ private class Games.ShortcutsWindow : Gtk.ShortcutsWindow {
        [GtkChild]
        private Gtk.ShortcutsShortcut ingame_shortcut_east;
 
+       [GtkChild]
+       private Gtk.ShortcutsSection shortcuts_section;
+
        construct {
                update_direction ();
 
@@ -32,6 +35,19 @@ private class Games.ShortcutsWindow : Gtk.ShortcutsWindow {
                ingame_shortcut_home.icon = icon_for_uri 
("resource:///org/gnome/Games/gesture/button-home-symbolic.svg");
                ingame_shortcut_south.icon = icon_for_uri 
("resource:///org/gnome/Games/gesture/button-south-symbolic.svg");
                ingame_shortcut_east.icon = icon_for_uri 
("resource:///org/gnome/Games/gesture/button-east-symbolic.svg");
+
+               var register = PluginRegister.get_register ();
+               foreach (var plugin_registrar in register)
+                       add_plugin_shortcuts (plugin_registrar);
+       }
+
+       private void add_plugin_shortcuts (PluginRegistrar plugin_registrar) {
+               var plugin = plugin_registrar.get_plugin ();
+
+               var group = plugin.get_shortcuts_group ();
+
+               if (group != null)
+                       shortcuts_section.add (group);
        }
 
        static GLib.Icon icon_for_uri (string uri) {


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