[gnome-games/wip/abhinavsingh/gamepad-config: 3/25] ui: Add basic preference screen for inputs
- From: Abhinav Singh <abhinavsingh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/abhinavsingh/gamepad-config: 3/25] ui: Add basic preference screen for inputs
- Date: Mon, 10 Jul 2017 15:43:15 +0000 (UTC)
commit 74757e3d4989f52500217c5673684868849e3339
Author: theawless <theawless gmail com>
Date: Tue May 23 20:13:26 2017 +0530
ui: Add basic preference screen for inputs
Currently, it shows the gamepad names and their orders. This screen
will allow the user to do inputs related settings.
https://bugzilla.gnome.org/show_bug.cgi?id=780754
data/Makefile.am | 1 +
data/org.gnome.Games.gresource.xml | 1 +
data/ui/preferences-page-input.ui | 53 ++++++++++++++++++++++++++++++++++++
data/ui/preferences-window.ui | 9 ++++++
src/Makefile.am | 1 +
src/ui/preferences-page-input.vala | 30 ++++++++++++++++++++
6 files changed, 95 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 87b56b8..34d94ac 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -39,6 +39,7 @@ EXTRA_DIST = \
ui/game-icon-view.ui \
ui/media-menu-button.ui \
ui/media-selector.ui \
+ ui/preferences-page-input.ui \
ui/preferences-page-plugins-item.ui \
ui/preferences-page-plugins.ui \
ui/preferences-page-video.ui \
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index e66ccca..7f51ee3 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -18,6 +18,7 @@
<file preprocess="xml-stripblanks">ui/game-icon-view.ui</file>
<file preprocess="xml-stripblanks">ui/media-menu-button.ui</file>
<file preprocess="xml-stripblanks">ui/media-selector.ui</file>
+ <file preprocess="xml-stripblanks">ui/preferences-page-input.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-plugins.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-plugins-item.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-video.ui</file>
diff --git a/data/ui/preferences-page-input.ui b/data/ui/preferences-page-input.ui
new file mode 100644
index 0000000..877dd49
--- /dev/null
+++ b/data/ui/preferences-page-input.ui
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GamesPreferencesPageInput" parent="GtkBin">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="can_focus">False</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkFrame">
+ <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>
+ <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="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>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index 36026a6..97f14d2 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -95,6 +95,15 @@
</packing>
</child>
<child>
+ <object class="GamesPreferencesPageInput" id="input_page">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="name">input</property>
+ <property name="title" translatable="yes">Input</property>
+ </packing>
+ </child>
+ <child>
<object class="GamesPreferencesPagePlugins" id="plugins_page">
<property name="visible">True</property>
</object>
diff --git a/src/Makefile.am b/src/Makefile.am
index dfbf6a3..f2cd399 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -129,6 +129,7 @@ gnome_games_SOURCES = \
ui/media-selector.vala \
ui/media-menu-button.vala \
ui/preferences-page.vala \
+ ui/preferences-page-input.vala \
ui/preferences-page-plugins.vala \
ui/preferences-page-plugins-item.vala \
ui/preferences-page-video.vala \
diff --git a/src/ui/preferences-page-input.vala b/src/ui/preferences-page-input.vala
new file mode 100644
index 0000000..a64be1b
--- /dev/null
+++ b/src/ui/preferences-page-input.vala
@@ -0,0 +1,30 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-page-input.ui")]
+private class Games.PreferencesPageInput: Gtk.Bin, PreferencesPage {
+ public string title {
+ get { return _("Input"); }
+ }
+
+ [GtkChild]
+ private Gtk.ListBox gamepads_list_box;
+
+ construct {
+ var gamepad_monitor = GamepadMonitor.get_instance ();
+ var i = 0;
+ gamepad_monitor.foreach_gamepad ((gamepad) => {
+ i += 1;
+ var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
+ box.pack_start (new Gtk.Label (gamepad.name), false, false);
+ box.pack_end (new Gtk.Label (i.to_string ()), false, false);
+ box.margin = 6;
+ box.show_all ();
+ gamepads_list_box.add (box);
+ });
+ }
+
+ [GtkCallback]
+ private void gamepads_list_box_row_activated (Gtk.ListBoxRow row_item) {
+ // open the gamepad configurer here
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]