[gnome-robots] Remove contol_keys global variable
- From: Andrey Kutejko <akutejko src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-robots] Remove contol_keys global variable
- Date: Tue, 6 Oct 2020 19:31:42 +0000 (UTC)
commit 4d1b7163383c9833d7525c8c8b87d6c3ef275079
Author: Andrey Kutejko <andy128k gmail com>
Date: Sun Oct 4 11:42:15 2020 +0200
Remove contol_keys global variable
src/cursors.vala | 3 +--
src/properties-dialog.vala | 3 ---
src/robots.vala | 15 ++++-----------
3 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/src/cursors.vala b/src/cursors.vala
index e039856..b4b94ca 100644
--- a/src/cursors.vala
+++ b/src/cursors.vala
@@ -202,8 +202,7 @@ const string cursor_down[] = {
"........................................"
};
-const string cursor_down_left[] =
-{
+const string cursor_down_left[] = {
/* width height num_colors chars_per_pixel */
" 20 20 3 2",
/* colors */
diff --git a/src/properties-dialog.vala b/src/properties-dialog.vala
index 054a3fa..03d06ef 100644
--- a/src/properties-dialog.vala
+++ b/src/properties-dialog.vala
@@ -225,7 +225,6 @@ public class PropertiesDialog : Dialog {
private void reset_keys () {
properties.reset_keys ();
- keyboard_set (properties.keys);
}
public static void show_dialog (Gtk.Window parent_window,
@@ -240,8 +239,6 @@ public class PropertiesDialog : Dialog {
dlg.show_all ();
dlg.run ();
dlg.destroy ();
-
- keyboard_set (properties.keys);
}
}
diff --git a/src/robots.vala b/src/robots.vala
index 81da7a6..4d48795 100644
--- a/src/robots.vala
+++ b/src/robots.vala
@@ -22,7 +22,6 @@ using Cairo;
using Games;
Games.Scores.Context highscores;
-uint control_keys[12];
public class RobotsWindow : ApplicationWindow {
@@ -30,6 +29,7 @@ public class RobotsWindow : ApplicationWindow {
private Label safe_teleports_label;
private GameArea game_area;
private EventControllerKey key_controller;
+ private Properties properties;
public RobotsWindow (Gtk.Application app,
Properties properties,
@@ -39,6 +39,7 @@ public class RobotsWindow : ApplicationWindow {
) throws Error {
Object (application: app);
remember_window_size (this, new WindowSizeSettings ("org.gnome.Robots"));
+ this.properties = properties;
headerbar = new HeaderBar ();
headerbar.set_title (_("Robots"));
@@ -93,8 +94,6 @@ public class RobotsWindow : ApplicationWindow {
}
});
});
-
- keyboard_set (properties.keys);
}
private Box button_box () {
@@ -186,8 +185,8 @@ public class RobotsWindow : ApplicationWindow {
char pressed = ((char) keyval).toupper ();
- for (var i = 0; i < control_keys.length; ++i) {
- if (pressed == ((char)control_keys[i]).toupper ()) {
+ for (var i = 0; i < properties.keys.length; ++i) {
+ if (pressed == ((char)properties.keys[i]).toupper ()) {
game_area.player_command ((PlayerCommand)i);
return true;
}
@@ -245,12 +244,6 @@ Games.Scores.Category? create_category_from_key (string key) {
return new Games.Scores.Category (key, name);
}
-void keyboard_set (uint[] keys) {
- for (int i = 0; i < 12; ++i) {
- control_keys[i] = keys[i];
- }
-}
-
class RobotsApplication : Gtk.Application {
private Properties properties;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]