[gnome-games/wip/exalm/libhandy2: 10/22] preferences-page-controllers: Simplify layout
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/libhandy2: 10/22] preferences-page-controllers: Simplify layout
- Date: Sun, 16 Sep 2018 12:39:33 +0000 (UTC)
commit 6d441b8551a8b8daa13babe01f0e41faad11ad55
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 12 17:57:38 2018 +0500
preferences-page-controllers: Simplify layout
Now that both gamepad and keyboard configurations are independent subpages,
the controllers page can be a simple box, like other pages.
data/ui/preferences-page-controllers.ui | 19 +++-----------
src/ui/preferences-page-controllers.vala | 44 ++++++++++----------------------
2 files changed, 16 insertions(+), 47 deletions(-)
---
diff --git a/data/ui/preferences-page-controllers.ui b/data/ui/preferences-page-controllers.ui
index 321edc9e..042ad8b6 100644
--- a/data/ui/preferences-page-controllers.ui
+++ b/data/ui/preferences-page-controllers.ui
@@ -1,19 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="GamesPreferencesPageControllers" parent="GtkStack">
+ <template class="GamesPreferencesPageControllers" parent="GtkBin">
<property name="visible">True</property>
- <property name="visible-child">main_stack_child_holder</property>
- <property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT</property>
<child>
- <object class="GtkBox" id="extra_stack_child_holder">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="name">extra_stack_child</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="main_stack_child_holder">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="hscrollbar-policy">never</property>
<child>
@@ -76,12 +66,9 @@
</object>
</child>
</object>
- <packing>
- <property name="name">main_stack_child</property>
- </packing>
</child>
</template>
- <object class="GtkHeaderBar" id="default_header_bar">
+ <object class="GtkHeaderBar" id="header_bar">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="title" translatable="yes">Controllers</property>
diff --git a/src/ui/preferences-page-controllers.vala b/src/ui/preferences-page-controllers.vala
index dd9b62a0..95daa742 100644
--- a/src/ui/preferences-page-controllers.vala
+++ b/src/ui/preferences-page-controllers.vala
@@ -1,9 +1,19 @@
// This file is part of GNOME Games. License: GPL-3.0+.
[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-page-controllers.ui")]
-private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
- public Gtk.HeaderBar header_bar { get; protected set; }
- public bool immersive_mode { get; protected set; }
+private class Games.PreferencesPageControllers: Gtk.Bin, PreferencesPage {
+ [GtkChild (name = "header_bar")]
+ private Gtk.HeaderBar _header_bar;
+ public Gtk.HeaderBar header_bar {
+ protected set {}
+ get { return _header_bar; }
+ }
+
+ public bool immersive_mode {
+ protected set {}
+ get { return false; }
+ }
+
public PreferencesSubpage subpage { get; protected set; }
[GtkChild]
@@ -14,21 +24,12 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
private Gtk.ListBox gamepads_list_box;
[GtkChild]
private Gtk.ListBox keyboard_list_box;
- [GtkChild]
- private Gtk.Box extra_stack_child_holder;
- [GtkChild]
- private Gtk.HeaderBar default_header_bar;
private Manette.Monitor monitor;
- private Binding header_bar_binding;
- private Binding immersive_mode_binding;
private ulong back_handler_id;
construct {
- header_bar = default_header_bar;
- immersive_mode = false;
-
monitor = new Manette.Monitor ();
monitor.device_connected.connect (rebuild_gamepad_list);
monitor.device_disconnected.connect (rebuild_gamepad_list);
@@ -36,10 +37,6 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
build_keyboard_list ();
}
- public void visible_page_changed () {
- on_back_old (null);
- }
-
private void rebuild_gamepad_list () {
clear_gamepad_list ();
build_gamepad_list ();
@@ -105,19 +102,4 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
subpage.disconnect (back_handler_id);
subpage = null;
}
-
- private void on_back_old (Object? emitter) {
- header_bar_binding = null;
- immersive_mode_binding = null;
- if (back_handler_id != 0) {
- if (emitter != null)
- emitter.disconnect (back_handler_id);
- back_handler_id = 0;
- }
-
- header_bar = default_header_bar;
- immersive_mode = false;
- visible_child_name = "main_stack_child";
- extra_stack_child_holder.foreach ((child) => child.destroy ());
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]