[gnome-games/wip/exalm/ds: 19/21] shortcuts-window: Integrate plugins
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/ds: 19/21] shortcuts-window: Integrate plugins
- Date: Sat, 19 Jan 2019 14:06:29 +0000 (UTC)
commit d4796af6b5d6a9e8d2e12c01568f261441b5506f
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 | 21 +++++++++++++++++++++
2 files changed, 22 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..127f4b31 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,24 @@ 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) {
+ try {
+ var plugin = plugin_registrar.get_plugin ();
+
+ var group = plugin.get_shortcuts_group ();
+
+ if (group != null)
+ shortcuts_section.add (group);
+ }
+ catch (Error e) {
+ debug ("Error: %s", e.message);
+ }
}
static GLib.Icon icon_for_uri (string uri) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]