[gnome-games] display-header-bar: Add input mode switcher
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] display-header-bar: Add input mode switcher
- Date: Tue, 20 Nov 2018 01:43:26 +0000 (UTC)
commit 47005b223efe95063ae64431b7b4fc066feba06a
Author: Yetizone <andreii lisita gmail com>
Date: Thu Nov 8 08:47:43 2018 +0200
display-header-bar: Add input mode switcher
Use InputModeSwitcher to implement a widget for switching between
keyboard and gamepad during the game.
data/ui/display-header-bar.ui | 8 ++++++++
src/ui/application-window.vala | 2 ++
src/ui/display-box.vala | 1 +
src/ui/display-header-bar.vala | 11 +++++++++++
4 files changed, 22 insertions(+)
---
diff --git a/data/ui/display-header-bar.ui b/data/ui/display-header-bar.ui
index 972bf0dc..a8942d2c 100644
--- a/data/ui/display-header-bar.ui
+++ b/data/ui/display-header-bar.ui
@@ -91,5 +91,13 @@
<property name="pack-type">end</property>
</packing>
</child>
+ <child>
+ <object class="GamesInputModeSwitcher" id="input_mode_switcher">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
</template>
</interface>
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 8c7ff13c..443036a7 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -350,6 +350,7 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
display_header_bar.can_fullscreen = runner.can_fullscreen;
display_box.header_bar.can_fullscreen = runner.can_fullscreen;
+ display_header_bar.runner = runner;
display_box.runner = runner;
display_header_bar.media_set = runner.media_set;
display_box.header_bar.media_set = runner.media_set;
@@ -688,6 +689,7 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
private void reset_display_page () {
display_header_bar.can_fullscreen = false;
display_box.header_bar.can_fullscreen = false;
+ display_header_bar.runner = null;
display_box.runner = null;
display_header_bar.media_set = null;
display_box.header_bar.media_set = null;
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index 7b5c8f4a..97e96039 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -18,6 +18,7 @@ private class Games.DisplayBox : Gtk.Bin {
_runner = value;
remove_display ();
+ header_bar.runner = runner;
if (runner == null)
return;
diff --git a/src/ui/display-header-bar.vala b/src/ui/display-header-bar.vala
index 709c418f..8e5bf941 100644
--- a/src/ui/display-header-bar.vala
+++ b/src/ui/display-header-bar.vala
@@ -23,6 +23,17 @@ private class Games.DisplayHeaderBar : Gtk.HeaderBar {
private MediaSelector media_selector;
+ [GtkChild]
+ private InputModeSwitcher input_mode_switcher;
+ private Runner _runner;
+ public Runner runner {
+ get { return _runner; }
+ set {
+ _runner = value;
+ input_mode_switcher.runner = value;
+ }
+ }
+
[GtkChild (name = "back")]
private Gtk.Button _back;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]