[gnome-games/wip/exalm/libhandy2: 9/22] ui: Convert KeyboardConfigurer into a subpage
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/libhandy2: 9/22] ui: Convert KeyboardConfigurer into a subpage
- Date: Sun, 16 Sep 2018 12:39:28 +0000 (UTC)
commit 0c0b7d6d162a9eb0eb3d5b52f93f564e8f8afeff
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 12 01:50:10 2018 +0500
ui: Convert KeyboardConfigurer into a subpage
data/org.gnome.Games.gresource.xml | 2 +-
...eyboard-configurer.ui => preferences-subpage-keyboard.ui} | 2 +-
src/meson.build | 2 +-
src/ui/preferences-page-controllers.vala | 11 +++--------
...ard-configurer.vala => preferences-subpage-keyboard.vala} | 12 ++++--------
5 files changed, 10 insertions(+), 19 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 200140eb..b9f080cb 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -25,7 +25,6 @@
<file preprocess="xml-stripblanks">ui/gamepad-mapper.ui</file>
<file preprocess="xml-stripblanks">ui/gamepad-tester.ui</file>
<file preprocess="xml-stripblanks">ui/game-icon-view.ui</file>
- <file preprocess="xml-stripblanks">ui/keyboard-configurer.ui</file>
<file preprocess="xml-stripblanks">ui/keyboard-mapper.ui</file>
<file preprocess="xml-stripblanks">ui/keyboard-tester.ui</file>
<file preprocess="xml-stripblanks">ui/media-menu-button.ui</file>
@@ -36,6 +35,7 @@
<file preprocess="xml-stripblanks">ui/preferences-page-plugins-item.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-video.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-subpage-gamepad.ui</file>
+ <file preprocess="xml-stripblanks">ui/preferences-subpage-keyboard.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-window.ui</file>
<file preprocess="xml-stripblanks">ui/quit-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/remote-display.ui</file>
diff --git a/data/ui/keyboard-configurer.ui b/data/ui/preferences-subpage-keyboard.ui
similarity index 98%
rename from data/ui/keyboard-configurer.ui
rename to data/ui/preferences-subpage-keyboard.ui
index f3d4c4bb..c541a34d 100644
--- a/data/ui/keyboard-configurer.ui
+++ b/data/ui/preferences-subpage-keyboard.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="GamesKeyboardConfigurer" parent="GtkBox">
+ <template class="GamesPreferencesSubpageKeyboard" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="orientation">vertical</property>
diff --git a/src/meson.build b/src/meson.build
index f6bb3613..bc9b1317 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -144,7 +144,6 @@ vala_sources = [
'ui/game-icon-view.vala',
'ui/game-thumbnail.vala',
'ui/gamepad-view-configuration.vala',
- 'ui/keyboard-configurer.vala',
'ui/keyboard-mapper.vala',
'ui/keyboard-tester.vala',
'ui/konami-code.vala',
@@ -160,6 +159,7 @@ vala_sources = [
'ui/preferences-page-video.vala',
'ui/preferences-subpage.vala',
'ui/preferences-subpage-gamepad.vala',
+ 'ui/preferences-subpage-keyboard.vala',
'ui/preferences-window.vala',
'ui/quit-dialog.vala',
'ui/remote-display.vala',
diff --git a/src/ui/preferences-page-controllers.vala b/src/ui/preferences-page-controllers.vala
index eba78ff8..dd9b62a0 100644
--- a/src/ui/preferences-page-controllers.vala
+++ b/src/ui/preferences-page-controllers.vala
@@ -96,14 +96,9 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
[GtkCallback]
private void keyboard_list_box_row_activated (Gtk.ListBoxRow row_item) {
- var configurer = new KeyboardConfigurer ();
- back_handler_id = configurer.back.connect (on_back_old);
- header_bar_binding = configurer.bind_property ("header-bar", this, "header-bar",
- BindingFlags.SYNC_CREATE);
- immersive_mode_binding = configurer.bind_property ("immersive-mode", this, "immersive-mode",
- BindingFlags.SYNC_CREATE);
- extra_stack_child_holder.pack_start (configurer);
- visible_child_name = "extra_stack_child";
+ var subpage_keyboard = new PreferencesSubpageKeyboard ();
+ back_handler_id = subpage_keyboard.back.connect (on_back);
+ subpage = subpage_keyboard;
}
private void on_back () {
diff --git a/src/ui/keyboard-configurer.vala b/src/ui/preferences-subpage-keyboard.vala
similarity index 95%
rename from src/ui/keyboard-configurer.vala
rename to src/ui/preferences-subpage-keyboard.vala
index e18588ef..2a3619c3 100644
--- a/src/ui/keyboard-configurer.vala
+++ b/src/ui/preferences-subpage-keyboard.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
-[GtkTemplate (ui = "/org/gnome/Games/ui/keyboard-configurer.ui")]
-private class Games.KeyboardConfigurer : Gtk.Box {
+[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-subpage-keyboard.ui")]
+private class Games.PreferencesSubpageKeyboard: Gtk.Box, PreferencesSubpage {
private const GamepadInput[] KEYBOARD_GAMEPAD_INPUTS = {
{ EventCode.EV_KEY, EventCode.BTN_A },
{ EventCode.EV_KEY, EventCode.BTN_B },
@@ -56,9 +56,9 @@ private class Games.KeyboardConfigurer : Gtk.Box {
get { return _state; }
set {
_state = value;
- immersive_mode = (state == State.CONFIGURE);
back_button.visible = (state == State.TEST);
cancel_button.visible = (state == State.CONFIGURE);
+ header_bar.show_close_button = (state == State.TEST);
switch (value) {
case State.TEST:
@@ -93,11 +93,7 @@ private class Games.KeyboardConfigurer : Gtk.Box {
private Gtk.HeaderBar _header_bar;
public Gtk.HeaderBar header_bar {
get { return _header_bar; }
- private set {}
}
-
- public bool immersive_mode { get; private set; }
-
[GtkChild]
private Gtk.Stack gamepad_view_stack;
[GtkChild]
@@ -121,7 +117,7 @@ private class Games.KeyboardConfigurer : Gtk.Box {
private Binding info_message_binding;
- public KeyboardConfigurer () {
+ public PreferencesSubpageKeyboard () {
mapper = new KeyboardMapper (KEYBOARD_GAMEPAD_VIEW_CONFIGURATION, KEYBOARD_GAMEPAD_INPUTS);
gamepad_view_stack.add (mapper);
tester = new KeyboardTester (KEYBOARD_GAMEPAD_VIEW_CONFIGURATION);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]