[gnome-games/wip/aplazas/libmanette: 9/15] configurer
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/libmanette: 9/15] configurer
- Date: Wed, 8 Nov 2017 20:25:50 +0000 (UTC)
commit 6b8297a77fce713ac6586bd5c1b6aa9c52f7f4f6
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Nov 8 11:24:20 2017 +0100
configurer
src/ui/gamepad-configurer.vala | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/ui/gamepad-configurer.vala b/src/ui/gamepad-configurer.vala
index a46e0aa..7ecee36 100644
--- a/src/ui/gamepad-configurer.vala
+++ b/src/ui/gamepad-configurer.vala
@@ -69,14 +69,15 @@ private class Games.GamepadConfigurer : Gtk.Box {
switch (value) {
case State.TEST:
- var user_mapping = mappings_manager.get_user_mapping (gamepad.guid);
+ var user_mapping = mappings_manager.get_user_mapping (device.get_guid ());
reset_button.set_sensitive (user_mapping != null);
+ reset_button.set_sensitive (true);
back_button.show ();
cancel_button.hide ();
action_bar.show ();
/* translators: testing a gamepad, %s is its name */
- header_bar.title = _("Testing %s").printf (gamepad.name);
+ header_bar.title = _("Testing %s").printf (device.get_name ());
header_bar.get_style_context ().remove_class ("selection-mode");
stack.set_visible_child_name ("gamepad_tester");
@@ -90,7 +91,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
cancel_button.show ();
action_bar.hide ();
/* translators: configuring a gamepad, %s is its name */
- header_bar.title = _("Configuring %s").printf (gamepad.name);
+ header_bar.title = _("Configuring %s").printf (device.get_name ());
header_bar.get_style_context ().add_class ("selection-mode");
stack.set_visible_child_name ("gamepad_mapper");
@@ -128,7 +129,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
[GtkChild]
private Gtk.Button cancel_button;
- private Gamepad gamepad;
+ private Manette.Device device;
private GamepadMapper mapper;
private GamepadTester tester;
private GamepadMappingsManager mappings_manager;
@@ -137,11 +138,11 @@ private class Games.GamepadConfigurer : Gtk.Box {
mappings_manager = GamepadMappingsManager.get_instance ();
}
- public GamepadConfigurer (Gamepad gamepad) {
- this.gamepad = gamepad;
- mapper = new GamepadMapper (gamepad, STANDARD_GAMEPAD_VIEW_CONFIGURATION,
STANDARD_GAMEPAD_INPUTS);
+ public GamepadConfigurer (Manette.Device device) {
+ this.device = device;
+ mapper = new GamepadMapper (device, STANDARD_GAMEPAD_VIEW_CONFIGURATION,
STANDARD_GAMEPAD_INPUTS);
gamepad_mapper_holder.pack_start (mapper);
- tester = new GamepadTester (gamepad, STANDARD_GAMEPAD_VIEW_CONFIGURATION);
+ tester = new GamepadTester (device, STANDARD_GAMEPAD_VIEW_CONFIGURATION);
gamepad_tester_holder.pack_start (tester);
state = State.TEST;
@@ -173,8 +174,8 @@ private class Games.GamepadConfigurer : Gtk.Box {
message_dialog.response.connect ((response) => {
switch (response) {
case Gtk.ResponseType.ACCEPT:
- mappings_manager.delete_mapping (gamepad.guid);
- var sdl_string = mappings_manager.get_default_mapping (gamepad.guid);
+ mappings_manager.delete_mapping (device.get_guid ());
+ var sdl_string = mappings_manager.get_default_mapping
(device.get_guid ());
set_gamepad_mapping (sdl_string);
reset_button.set_sensitive (false);
@@ -189,7 +190,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
}
private void on_mapper_finished (string sdl_string) {
- mappings_manager.save_mapping (gamepad.guid, gamepad.name, sdl_string);
+ mappings_manager.save_mapping (device.get_guid (), device.get_name (), sdl_string);
set_gamepad_mapping (sdl_string);
state = State.TEST;
@@ -197,13 +198,15 @@ private class Games.GamepadConfigurer : Gtk.Box {
private void set_gamepad_mapping (string? sdl_string) {
if (sdl_string == null) {
- gamepad.set_mapping (null);
+ // FIXME
+ // device.set_mapping (null);
return;
}
try {
- var mapping = new GamepadMapping.from_sdl_string (sdl_string);
- gamepad.set_mapping (mapping);
+ // FIXME
+ // var mapping = new GamepadMapping.from_sdl_string (sdl_string);
+ // device.set_mapping (mapping);
}
catch (Error e) {
critical (e.message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]