[gnome-games] ui: Show keyboard in PreferencesPageControllers
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] ui: Show keyboard in PreferencesPageControllers
- Date: Fri, 22 Jun 2018 20:44:06 +0000 (UTC)
commit a0b09d9cff5a3c8eba69455cb794e57a214e6324
Author: theawless <theawless gmail com>
Date: Mon Feb 19 19:13:30 2018 +0530
ui: Show keyboard in PreferencesPageControllers
This will allow the user to edit the settings related to keyboard.
https://bugzilla.gnome.org/show_bug.cgi?id=780755
data/ui/preferences-page-controllers.ui | 73 +++++++++++++++++++++++++-------
src/ui/preferences-page-controllers.vala | 23 ++++++++++
2 files changed, 81 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/preferences-page-controllers.ui b/data/ui/preferences-page-controllers.ui
index 09bd294..14f3a14 100644
--- a/data/ui/preferences-page-controllers.ui
+++ b/data/ui/preferences-page-controllers.ui
@@ -23,35 +23,78 @@
<property name="can_focus">False</property>
<property name="visible">True</property>
<child>
- <object class="GtkFrame">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">12</property>
- <property name="valign">start</property>
- <property name="shadow_type">none</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkAlignment">
+ <object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="top_padding">12</property>
+ <property name="border_width">12</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkListBox" id="gamepads_list_box">
+ <object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="selection_mode">none</property>
- <signal name="row-activated" handler="gamepads_list_box_row_activated"/>
+ <property name="top_padding">12</property>
+ <child>
+ <object class="GtkListBox" id="gamepads_list_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="selection_mode">none</property>
+ <signal name="row-activated" handler="gamepads_list_box_row_activated"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Gamepads</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
</child>
- <child type="label">
- <object class="GtkLabel">
+ <child>
+ <object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Gamepads</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="border_width">12</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">12</property>
+ <child>
+ <object class="GtkListBox" id="keyboard_list_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="selection_mode">none</property>
+ <signal name="row-activated" handler="keyboard_list_box_row_activated"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Keyboard</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/ui/preferences-page-controllers.vala b/src/ui/preferences-page-controllers.vala
index 23a762f..a943571 100644
--- a/src/ui/preferences-page-controllers.vala
+++ b/src/ui/preferences-page-controllers.vala
@@ -8,6 +8,8 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
[GtkChild]
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;
@@ -26,6 +28,7 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
monitor.device_connected.connect (rebuild_gamepad_list);
monitor.device_disconnected.connect (rebuild_gamepad_list);
build_gamepad_list ();
+ build_keyboard_list ();
}
public void visible_page_changed () {
@@ -81,6 +84,26 @@ private class Games.PreferencesPageControllers: Gtk.Stack, PreferencesPage {
set_visible_child_name ("extra_stack_child");
}
+ private void build_keyboard_list () {
+ var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
+ box.pack_start (new Gtk.Label (_("Keyboard")), false, false);
+ box.margin = 6;
+ box.show_all ();
+ keyboard_list_box.add (box);
+ }
+
+ [GtkCallback]
+ private void keyboard_list_box_row_activated (Gtk.ListBoxRow row_item) {
+ var configurer = new KeyboardConfigurer ();
+ back_handler_id = configurer.back.connect (on_back);
+ 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);
+ set_visible_child_name ("extra_stack_child");
+ }
+
private void on_back (Object? emitter) {
header_bar_binding = null;
immersive_mode_binding = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]