[four-in-a-row/KaKnife/four-in-a-row-vala: 21/65] style update



commit e3fee5b6b5e56022a902255779546000993a4b9e
Author: Jacob Humphrey <jacob ryan humphrey gmail com>
Date:   Sun Nov 25 12:32:09 2018 -0600

    style update

 src/games-controls-list.vala |  34 ++---
 src/gfx.vala                 |  88 +++++------
 src/main.vala                | 344 +++++++++++++++++++++----------------------
 src/prefs.vala               |  74 +++++-----
 src/theme.vala               |   8 +-
 5 files changed, 274 insertions(+), 274 deletions(-)
---
diff --git a/src/games-controls-list.vala b/src/games-controls-list.vala
index 705a376..569cf54 100644
--- a/src/games-controls-list.vala
+++ b/src/games-controls-list.vala
@@ -44,7 +44,7 @@ public class GamesControlsList : Gtk.ScrolledWindow {
     Settings settings;
     ulong notify_handler_id;
 
-    public GamesControlsList (GLib.Settings settings) {
+    public GamesControlsList(GLib.Settings settings) {
         Gtk.CellRenderer label_renderer;
         Gtk.CellRendererAccel key_renderer;
         Gtk.TreeViewColumn column;
@@ -92,17 +92,17 @@ public class GamesControlsList : Gtk.ScrolledWindow {
         this.add(view);
     }
 
-    void accel_cleared_cb (string path_string) {
+    void accel_cleared_cb(string path_string) {
         Gtk.TreePath path;
         Gtk.TreeIter iter;
         string conf_key = null;
         int default_keyval = 0; //set to 0 to make valac happy
 
-        path = new Gtk.TreePath.from_string (path_string);
+        path = new Gtk.TreePath.from_string(path_string);
         if (path == null)
             return;
 
-        if (!model.get_iter (out iter, path)) {
+        if (!model.get_iter(out iter, path)) {
             return;
         }
 
@@ -118,7 +118,7 @@ public class GamesControlsList : Gtk.ScrolledWindow {
         settings.set_int(conf_key, default_keyval);
     }
 
-    void accel_edited_cb (string path_string, uint keyval, Gdk.ModifierType mask, uint hardware_keycode) {
+    void accel_edited_cb(string path_string, uint keyval, Gdk.ModifierType mask, uint hardware_keycode) {
         Gtk.TreePath path;
         Gtk.TreeIter iter;
         string conf_key = null;
@@ -126,29 +126,29 @@ public class GamesControlsList : Gtk.ScrolledWindow {
         bool unused_key = true;
 
 
-        path = new Gtk.TreePath.from_string (path_string);
+        path = new Gtk.TreePath.from_string(path_string);
         if (path == null)
             return;
 
-        if (!model.get_iter (out iter, path)) {
+        if (!model.get_iter(out iter, path)) {
             return;
         }
 
-        model.get (iter, Columns.CONFKEY_COLUMN, conf_key);
+        model.get(iter, Columns.CONFKEY_COLUMN, conf_key);
         if (conf_key == null)
             return;
 
-        valid = model.get_iter_first (out iter);
+        valid = model.get_iter_first(out iter);
         while (valid) {
             string actual_conf_key = null;
 
-            model.get (iter, Columns.CONFKEY_COLUMN, actual_conf_key);
+            model.get(iter, Columns.CONFKEY_COLUMN, actual_conf_key);
 
-            if (settings.get_int (actual_conf_key) == keyval){
+            if (settings.get_int(actual_conf_key) == keyval){
                 unused_key = false;
 
                 if (conf_key == actual_conf_key) {
-                    var dialog = new Gtk.MessageDialog.with_markup (window,
+                    var dialog = new Gtk.MessageDialog.with_markup(window,
                         Gtk.DialogFlags.DESTROY_WITH_PARENT,
                         Gtk.MessageType.WARNING,
                         Gtk.ButtonsType.OK,
@@ -160,16 +160,16 @@ public class GamesControlsList : Gtk.ScrolledWindow {
                 break;
             }
 
-            valid = store.iter_next (ref iter);
+            valid = store.iter_next(ref iter);
         }
 
         /* Note: the model is updated in the conf notification callback */
         /* FIXME: what to do with the modifiers? */
         if (unused_key)
-            settings.set_int (conf_key, (int)keyval);
+            settings.set_int(conf_key, (int)keyval);
     }
 
-    void add_control (string conf_key, string? label, uint default_keyval) {
+    void add_control(string conf_key, string? label, uint default_keyval) {
         Gtk.TreeIter iter;
         uint keyval;
 
@@ -189,7 +189,7 @@ public class GamesControlsList : Gtk.ScrolledWindow {
 
     }
 
-    public void add_controls (string first_gconf_key, ...) {
+    public void add_controls(string first_gconf_key, ...) {
         var args = va_list();
         string? key;
         string label;
@@ -199,7 +199,7 @@ public class GamesControlsList : Gtk.ScrolledWindow {
         while (key != null) {
             label = args.arg();
             keyval = args.arg();
-            this.add_control (key, label, keyval);
+            this.add_control(key, label, keyval);
             key = args.arg();
         }
     }
diff --git a/src/gfx.vala b/src/gfx.vala
index 3515e75..018bd9e 100644
--- a/src/gfx.vala
+++ b/src/gfx.vala
@@ -35,7 +35,7 @@ namespace Gfx{
     Gdk.Pixbuf pb_tileset;
     Gdk.Pixbuf pb_bground;
 
-    int get_column (int xpos) {
+    int get_column(int xpos) {
         /* Derive column from pixel position */
         int c = xpos / tilesize;
         if (c > 6)
@@ -46,30 +46,30 @@ namespace Gfx{
         return c;
     }
 
-    void draw_tile (int r, int c) {
+    void draw_tile(int r, int c) {
         drawarea.queue_draw_area(c*tilesize, r*tilesize, tilesize, tilesize);
     }
 
-    void draw_all () {
+    void draw_all() {
         drawarea.queue_draw_area(0, 0, boardsize, boardsize);
     }
 
-    bool change_theme () {
-        if (!Gfx.load_pixmaps ())
+    bool change_theme() {
+        if (!Gfx.load_pixmaps())
             return false;
 
-        Gfx.refresh_pixmaps ();
-        draw_all ();
+        Gfx.refresh_pixmaps();
+        draw_all();
         return true;
     }
 
-    void resize (Gtk.Widget w) {
+    void resize(Gtk.Widget w) {
         int width, height;
 
-        width = w.get_allocated_width ();
-        height = w.get_allocated_height ();
+        width = w.get_allocated_width();
+        height = w.get_allocated_height();
 
-        boardsize = int.min (width, height);
+        boardsize = int.min(width, height);
         tilesize = boardsize / 7;
 
         offset[Tile.PLAYER1] = 0;
@@ -79,11 +79,11 @@ namespace Gfx{
         offset[Tile.PLAYER1_CURSOR] = tilesize * 4;
         offset[Tile.PLAYER2_CURSOR] = tilesize * 5;
 
-        Gfx.refresh_pixmaps ();
-        draw_all ();
+        Gfx.refresh_pixmaps();
+        draw_all();
     }
 
-    void expose (Cairo.Context cr) {
+    void expose(Cairo.Context cr) {
         int r, c;
 
         /* draw the background */
@@ -95,32 +95,32 @@ namespace Gfx{
 
         for (r = 0; r < 7; r++) {
             for (c = 0; c < 7; c++) {
-                Gfx.paint_tile (cr, r, c);
+                Gfx.paint_tile(cr, r, c);
             }
         }
 
-        draw_grid (cr);
+        draw_grid(cr);
     }
 
-    void draw_grid (Cairo.Context cr) {
+    void draw_grid(Cairo.Context cr) {
         const double dashes[] = { 4.0, 4.0 };
         int i;
         Gdk.RGBA color = Gdk.RGBA();
 
         color.parse(theme[p.theme_id].grid_color);
-        Gdk.cairo_set_source_rgba (cr, color);
-        cr.set_operator (Cairo.Operator.SOURCE);
-        cr.set_line_width (1);
-        cr.set_line_cap (Cairo.LineCap.BUTT);
-        cr.set_line_join (Cairo.LineJoin.MITER);
-        cr.set_dash (dashes, 0);
+        Gdk.cairo_set_source_rgba(cr, color);
+        cr.set_operator(Cairo.Operator.SOURCE);
+        cr.set_line_width(1);
+        cr.set_line_cap(Cairo.LineCap.BUTT);
+        cr.set_line_join(Cairo.LineJoin.MITER);
+        cr.set_dash(dashes, 0);
 
         /* draw the grid on the background pixmap */
         for (i = 1; i < 7; i++) {
-            cr.move_to (i * tilesize + 0.5, 0);
-            cr.line_to (i * tilesize + 0.5, boardsize);
-            cr.move_to (0, i * tilesize + 0.5);
-            cr.line_to (boardsize, i * tilesize + 0.5);
+            cr.move_to(i * tilesize + 0.5, 0);
+            cr.line_to(i * tilesize + 0.5, boardsize);
+            cr.move_to(0, i * tilesize + 0.5);
+            cr.line_to(boardsize, i * tilesize + 0.5);
         }
         cr.stroke();
 
@@ -132,7 +132,7 @@ namespace Gfx{
         cr.stroke();
     }
 
-    void load_error (string fname) {
+    void load_error(string fname) {
         Gtk.MessageDialog dialog;
 
         dialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.MODAL,
@@ -143,7 +143,7 @@ namespace Gfx{
         dialog.destroy();
     }
 
-    void paint_tile (Cairo.Context cr, int r, int c) {
+    void paint_tile(Cairo.Context cr, int r, int c) {
         int x = c * tilesize;
         int y = r * tilesize;
         int tile = gboard[r,c];
@@ -175,38 +175,38 @@ namespace Gfx{
 
 
         cr.save();
-        Gdk.cairo_set_source_pixbuf (cr, pb_tileset, x - os, y);
-        cr.rectangle (x, y, tilesize, tilesize);
+        Gdk.cairo_set_source_pixbuf(cr, pb_tileset, x - os, y);
+        cr.rectangle(x, y, tilesize, tilesize);
 
         cr.clip();
         cr.paint();
         cr.restore();
     }
 
-    void refresh_pixmaps () {
+    void refresh_pixmaps() {
         /* scale the pixbufs */
-        pb_tileset = pb_tileset_raw.scale_simple (tilesize * 6, tilesize, Gdk.InterpType.BILINEAR);
-        pb_bground = pb_bground_raw.scale_simple (boardsize, boardsize, Gdk.InterpType.BILINEAR);
+        pb_tileset = pb_tileset_raw.scale_simple(tilesize * 6, tilesize, Gdk.InterpType.BILINEAR);
+        pb_bground = pb_bground_raw.scale_simple(boardsize, boardsize, Gdk.InterpType.BILINEAR);
     }
 
 
 
-    bool load_pixmaps () {
+    bool load_pixmaps() {
         string fname;
         Gdk.Pixbuf pb_tileset_tmp;
         Gdk.Pixbuf pb_bground_tmp = null;
 
         /* Try the theme pixmaps, fallback to the default and then give up */
         while (true) {
-            fname = Path.build_filename (Config.DATA_DIRECTORY, theme[p.theme_id].fname_tileset, null);
+            fname = Path.build_filename(Config.DATA_DIRECTORY, theme[p.theme_id].fname_tileset, null);
             try {
-                pb_tileset_tmp = new Gdk.Pixbuf.from_file (fname);
+                pb_tileset_tmp = new Gdk.Pixbuf.from_file(fname);
             } catch (Error e) {
                 if (p.theme_id != 0) {
                     p.theme_id = 0;
                     continue;
                 } else {
-                    Gfx.load_error (fname);
+                    Gfx.load_error(fname);
                     return false;
                 }
             }
@@ -216,11 +216,11 @@ namespace Gfx{
         pb_tileset_raw = pb_tileset_tmp;
 
         if (theme[p.theme_id].fname_bground != null) {
-            fname = Path.build_filename (Config.DATA_DIRECTORY, theme[p.theme_id].fname_bground, null);
+            fname = Path.build_filename(Config.DATA_DIRECTORY, theme[p.theme_id].fname_bground, null);
             try {
-                pb_bground_tmp = new Gdk.Pixbuf.from_file (fname);
+                pb_bground_tmp = new Gdk.Pixbuf.from_file(fname);
             } catch (Error e) {
-                Gfx.load_error (fname);
+                Gfx.load_error(fname);
                 return false;
             }
         }
@@ -236,14 +236,14 @@ namespace Gfx{
 
             tilesize_raw = pb_tileset_raw.get_height();
 
-            pb_bground_raw = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8,
+            pb_bground_raw = new Gdk.Pixbuf(Gdk.Colorspace.RGB, true, 8,
                 tilesize_raw * 7, tilesize_raw * 7);
             for (i = 0; i < 7; i++) {
-                pb_tileset_raw.copy_area (tilesize_raw * 3, 0,
+                pb_tileset_raw.copy_area(tilesize_raw * 3, 0,
                     tilesize_raw, tilesize_raw,
                     pb_bground_raw, i * tilesize_raw, 0);
                 for (j = 1; j < 7; j++) {
-                    pb_tileset_raw.copy_area (
+                    pb_tileset_raw.copy_area(
                         tilesize_raw * 2, 0,
                         tilesize_raw, tilesize_raw,
                         pb_bground_raw,
diff --git a/src/main.vala b/src/main.vala
index cf611fa..1a95bbb 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -109,11 +109,11 @@ bool blink_on = false;
 uint timeout = 0;
 
 void on_game_new(SimpleAction a, Variant? v) {
-    stop_anim ();
-    game_reset ();
+    stop_anim();
+    game_reset();
 }
 
-void draw_line (int r1, int c1, int r2, int c2, int tile) {
+void draw_line(int r1, int c1, int r2, int c2, int tile) {
     /* draw a line of 'tile' from r1,c1 to r2,c2 */
 
     bool done = false;
@@ -133,7 +133,7 @@ void draw_line (int r1, int c1, int r2, int c2, int tile) {
     do {
         done = (r1 == r2 && c1 == c2);
         gboard[r1, c1] = tile;
-        Gfx.draw_tile (r1, c1);
+        Gfx.draw_tile(r1, c1);
         if (r1 != r2)
             r1 += d_row;
         if (c1 != c2)
@@ -141,7 +141,7 @@ void draw_line (int r1, int c1, int r2, int c2, int tile) {
     } while (!done);
 }
 
-public int main (string[] argv) {
+public int main(string[] argv) {
     gboard = new int[7,7];
     Intl.setlocale();
 
@@ -180,39 +180,39 @@ public int main (string[] argv) {
     return app_retval;
 }
 
-public void activate () {
+public void activate() {
     if (!window.is_visible()) {
         window.show_all();
         Gfx.refresh_pixmaps();
-        Gfx.draw_all ();
-        scorebox_update ();       /* update visible player descriptions */
-        prompt_player ();
-        game_reset ();
+        Gfx.draw_all();
+        scorebox_update();       /* update visible player descriptions */
+        prompt_player();
+        game_reset();
     }
 }
 
 class NextMove {
     int c;
 
-    public NextMove (int c) {
+    public NextMove(int c) {
         this.c = c;
     }
 
-    public bool exec () {
+    public bool exec() {
         return next_move(c);
     }
 }
 
-public bool next_move (int c) {
+public bool next_move(int c) {
     process_move(c);
     return false;
 }
 
-public void game_process_move (int c) {
+public void game_process_move(int c) {
     process_move(c);
 }
 
-public void game_init () {
+public void game_init() {
     //Random.set_seed ((uint) Linux.timegm(null));
 
     anim = AnimID.NONE;
@@ -226,10 +226,10 @@ public void game_init () {
 
     who_starts = PlayerID.PLAYER2;     /* This gets reversed immediately. */
 
-    clear_board ();
+    clear_board();
 }
 
-void clear_board () {
+void clear_board() {
     int r, c, i;
 
     for (r = 0; r < 7; r++) {
@@ -246,7 +246,7 @@ void clear_board () {
     moves = 0;
 }
 
-int first_empty_row (int c) {
+int first_empty_row(int c) {
     int r = 1;
 
     while (r < 7 && gboard[r, c] == Tile.CLEAR)
@@ -254,7 +254,7 @@ int first_empty_row (int c) {
     return r - 1;
 }
 
-int get_n_human_players () {
+int get_n_human_players() {
     if (p.level[PlayerID.PLAYER1] != Level.HUMAN && p.level[PlayerID.PLAYER2] != Level.HUMAN)
         return 0;
     if (p.level[PlayerID.PLAYER1] != Level.HUMAN || p.level[PlayerID.PLAYER2] != Level.HUMAN)
@@ -262,61 +262,61 @@ int get_n_human_players () {
     return 2;
 }
 
-bool is_player_human () {
+bool is_player_human() {
     return player == PLAYER1 ? p.level[PlayerID.PLAYER1] == Level.HUMAN
         : p.level[PlayerID.PLAYER2] == Level.HUMAN;
 }
 
-static void drop_marble (int r, int c) {
+static void drop_marble(int r, int c) {
     int tile;
     tile = player == PlayerID.PLAYER1 ? Tile.PLAYER1 : Tile.PLAYER2;
 
     gboard[r, c] = tile;
-    Gfx.draw_tile (r, c);
+    Gfx.draw_tile(r, c);
 
     column = column_moveto = c;
     row = row_dropto = r;
 }
 
-void drop () {
+void drop() {
     Tile tile = player == PLAYER1 ? Tile.PLAYER1 : Tile.PLAYER2;
 
     gboard[row, column] = Tile.CLEAR;
-    Gfx.draw_tile (row, column);
+    Gfx.draw_tile(row, column);
 
     row++;
     gboard[row, column] = tile;
-    Gfx.draw_tile (row, column);
+    Gfx.draw_tile(row, column);
 }
 
-void move (int c) {
+void move(int c) {
     gboard[0, column] = Tile.CLEAR;
-    Gfx.draw_tile (0, column);
+    Gfx.draw_tile(0, column);
 
     column = c;
     gboard[0, c] = player == PlayerID.PLAYER1 ? Tile.PLAYER1 : Tile.PLAYER2;
 
-    Gfx.draw_tile (0, c);
+    Gfx.draw_tile(0, c);
 }
 
-static void move_cursor (int c) {
-    move (c);
+static void move_cursor(int c) {
+    move(c);
     column = column_moveto = c;
     row = row_dropto = 0;
 }
 
-void swap_player () {
+void swap_player() {
     player = (player == PlayerID.PLAYER1) ? PlayerID.PLAYER2 : PlayerID.PLAYER1;
-    move_cursor (3);
-    prompt_player ();
+    move_cursor(3);
+    prompt_player();
 }
 
 
-void set_status_message (string? message) {
+void set_status_message(string? message) {
     headerbar.set_title(message);
 }
 
-static void blink_tile (int r, int c, int t, int n) {
+static void blink_tile(int r, int c, int t, int n) {
     if (timeout != 0)
         return;
     blink_r1 = r;
@@ -328,10 +328,10 @@ static void blink_tile (int r, int c, int t, int n) {
     blink_on = false;
     anim = AnimID.BLINK;
     var temp = new Animate(0);
-    timeout = Timeout.add (SPEED_BLINK, temp.exec);
+    timeout = Timeout.add(SPEED_BLINK, temp.exec);
 }
 
-void stop_anim () {
+void stop_anim() {
     if (timeout == 0)
         return;
     anim = AnimID.NONE;
@@ -339,55 +339,55 @@ void stop_anim () {
     timeout = 0;
 }
 
-bool on_drawarea_resize (Gtk.Widget w, Gdk.EventConfigure e) {
-    Gfx.resize (w);
+bool on_drawarea_resize(Gtk.Widget w, Gdk.EventConfigure e) {
+    Gfx.resize(w);
     return true;
 }
 
-bool on_drawarea_draw (Gtk.Widget w, Cairo.Context cr) {
-    Gfx.expose (cr);
+bool on_drawarea_draw(Gtk.Widget w, Cairo.Context cr) {
+    Gfx.expose(cr);
     return false;
 }
 
-void on_game_undo (SimpleAction action, Variant? parameter) {
+void on_game_undo(SimpleAction action, Variant? parameter) {
     int r, c;
 
     if (timeout != 0)
         return;
     c = vstr[moves] - '0' - 1;
-    r = first_empty_row (c) + 1;
+    r = first_empty_row(c) + 1;
     vstr[moves] = '0';
     vstr[moves + 1] = '\0';
     moves--;
 
     if (gameover) {
         score[winner]--;
-        scorebox_update ();
+        scorebox_update();
         gameover = false;
-        prompt_player ();
+        prompt_player();
     } else {
-        swap_player ();
+        swap_player();
     }
-    move_cursor (c);
+    move_cursor(c);
 
     gboard[r, c] = Tile.CLEAR;
-    Gfx.draw_tile (r, c);
+    Gfx.draw_tile(r, c);
 
-    if (get_n_human_players () == 1 && !is_player_human ()) {
+    if (get_n_human_players() == 1 && !is_player_human()) {
         if (moves > 0) {
             c = vstr[moves] - '0' - 1;
-            r = first_empty_row (c) + 1;
+            r = first_empty_row(c) + 1;
             vstr[moves] = '0';
             vstr[moves + 1] = '\0';
             moves--;
-            swap_player ();
-            move_cursor (c);
+            swap_player();
+            move_cursor(c);
             gboard[r, c] = Tile.CLEAR;
-            Gfx.draw_tile (r, c);
+            Gfx.draw_tile(r, c);
         }
     }
 }
-void on_game_scores (SimpleAction action, Variant? parameter) {
+void on_game_scores(SimpleAction action, Variant? parameter) {
     Gtk.Grid grid, grid2;
     Gtk.Widget icon;
 
@@ -419,32 +419,32 @@ void on_game_scores (SimpleAction action, Variant? parameter) {
     grid2.set_column_spacing(6);
 
     label_name[PlayerID.PLAYER1] = new Gtk.Label(null);
-    grid2.attach (label_name[PlayerID.PLAYER1], 0, 0, 1, 1);
+    grid2.attach(label_name[PlayerID.PLAYER1], 0, 0, 1, 1);
     label_name[PlayerID.PLAYER1].set_xalign(0);
     label_name[PlayerID.PLAYER1].set_yalign(0.5f);
 
     label_score[PlayerID.PLAYER1] = new Gtk.Label(null);
-    grid2.attach (label_score[PlayerID.PLAYER1], 1, 0, 1, 1);
+    grid2.attach(label_score[PlayerID.PLAYER1], 1, 0, 1, 1);
     label_score[PlayerID.PLAYER1].set_xalign(0);
     label_score[PlayerID.PLAYER1].set_yalign(0.5f);
 
     label_name[PlayerID.PLAYER2] = new Gtk.Label(null);
-    grid2.attach (label_name[PlayerID.PLAYER2], 0, 1, 1, 1);
+    grid2.attach(label_name[PlayerID.PLAYER2], 0, 1, 1, 1);
     label_name[PlayerID.PLAYER2].set_xalign(0);
     label_name[PlayerID.PLAYER2].set_yalign(0.5f);
 
     label_score[PlayerID.PLAYER2] = new Gtk.Label(null);
-    grid2.attach (label_score[PlayerID.PLAYER2], 1, 0, 1, 1);
+    grid2.attach(label_score[PlayerID.PLAYER2], 1, 0, 1, 1);
     label_score[PlayerID.PLAYER2].set_xalign(0);
     label_score[PlayerID.PLAYER2].set_yalign(0.5f);
 
     label_name[PlayerID.NOBODY] = new Gtk.Label(_("Drawn:"));
-    grid2.attach (label_name[PlayerID.NOBODY], 0, 2, 1, 1);
+    grid2.attach(label_name[PlayerID.NOBODY], 0, 2, 1, 1);
     label_name[PlayerID.NOBODY].set_xalign(0);
     label_name[PlayerID.NOBODY].set_yalign(0.5f);
 
     label_score[PlayerID.NOBODY] = new Gtk.Label(null);
-    grid2.attach (label_score[PlayerID.NOBODY], 1, 0, 1, 1);
+    grid2.attach(label_score[PlayerID.NOBODY], 1, 0, 1, 1);
     label_score[PlayerID.NOBODY].set_xalign(0);
     label_score[PlayerID.NOBODY].set_yalign(0.5f);
 
@@ -452,16 +452,16 @@ void on_game_scores (SimpleAction action, Variant? parameter) {
 
     scorebox.show_all();
 
-    scorebox_update ();
+    scorebox_update();
 }
 
-void on_game_exit (SimpleAction action, Variant? parameter) {
-    stop_anim ();
+void on_game_exit(SimpleAction action, Variant? parameter) {
+    stop_anim();
     application.quit();
 }
 
-void process_move2 (int c) {
-    int r = first_empty_row (c);
+void process_move2(int c) {
+    int r = first_empty_row(c);
     if (r > 0) {
         row = 0;
         row_dropto = r;
@@ -469,11 +469,11 @@ void process_move2 (int c) {
         var temp = new Animate(c);
         timeout = Timeout.add(SPEED_DROP, temp.exec);
     } else {
-        play_sound (SoundID.COLUMN_FULL);
+        play_sound(SoundID.COLUMN_FULL);
     }
 }
 
-bool is_vline_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
+bool is_vline_at(PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
     *r1 = *r2 = r;
     *c1 = *c2 = c;
     while (*r1 > 1 && gboard[*r1 - 1, c] == p)
@@ -485,7 +485,7 @@ bool is_vline_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int *
     return false;
 }
 
-bool is_dline1_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
+bool is_dline1_at(PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
     /* upper left to lower right */
     *r1 = *r2 = r;
     *c1 = *c2 = c;
@@ -502,16 +502,16 @@ bool is_dline1_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int *
     return false;
 }
 
-bool is_line_at (PlayerID p, int r, int c) {
+bool is_line_at(PlayerID p, int r, int c) {
     int r1, r2, c1, c2;
 
-    return is_hline_at (p, r, c, &r1, &c1, &r2, &c2) ||
-        is_vline_at (p, r, c, &r1, &c1, &r2, &c2) ||
-        is_dline1_at (p, r, c, &r1, &c1, &r2, &c2) ||
-        is_dline2_at (p, r, c, &r1, &c1, &r2, &c2);
+    return is_hline_at(p, r, c, &r1, &c1, &r2, &c2) ||
+        is_vline_at(p, r, c, &r1, &c1, &r2, &c2) ||
+        is_dline1_at(p, r, c, &r1, &c1, &r2, &c2) ||
+        is_dline2_at(p, r, c, &r1, &c1, &r2, &c2);
 }
 
-bool is_dline2_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
+bool is_dline2_at(PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
     /* upper right to lower left */
     *r1 = *r2 = r;
     *c1 = *c2 = c;
@@ -528,7 +528,7 @@ bool is_dline2_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int *
     return false;
 }
 
-bool is_hline_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
+bool is_hline_at(PlayerID p, int r, int c, int * r1, int * c1, int * r2, int * c2) {
     *r1 = *r2 = r;
     *c1 = *c2 = c;
     while (*c1 > 0 && gboard[r, *c1 - 1] == p)
@@ -540,14 +540,14 @@ bool is_hline_at (PlayerID p, int r, int c, int * r1, int * c1, int * r2, int *
     return false;
 }
 
-void scorebox_reset () {
+void scorebox_reset() {
     score[PlayerID.PLAYER1] = 0;
     score[PlayerID.PLAYER2] = 0;
     score[PlayerID.NOBODY] = 0;
-    scorebox_update ();
+    scorebox_update();
 }
 
-void process_move (int c) {
+void process_move(int c) {
     if (timeout != 0) {
         var temp = new Animate(c);
         Timeout.add(SPEED_DROP, temp.exec);
@@ -560,7 +560,7 @@ void process_move (int c) {
     timeout = Timeout.add(SPEED_DROP, temp.exec);
 }
 
-void on_help_about (SimpleAction action, Variant? parameter) {
+void on_help_about(SimpleAction action, Variant? parameter) {
     const string authors[] = {"Tim Musson <trmusson ihug co nz>",
         "David Neary <bolsh gimp org>",
         "Nikhar Agrawal <nikharagrawal2006 gmail com>"
@@ -588,55 +588,55 @@ void on_help_about (SimpleAction action, Variant? parameter) {
         );
 }
 
-void check_game_state () {
-    if (is_line_at (player, row, column)) {
+void check_game_state() {
+    if (is_line_at(player, row, column)) {
         gameover = true;
         winner = player;
-        switch (get_n_human_players ()) {
+        switch (get_n_human_players()) {
         case 1:
-            play_sound (is_player_human () ? SoundID.YOU_WIN : SoundID.I_WIN);
+            play_sound(is_player_human() ? SoundID.YOU_WIN : SoundID.I_WIN);
             break;
         case 0:
         case 2:
-            play_sound (SoundID.PLAYER_WIN);
+            play_sound(SoundID.PLAYER_WIN);
             break;
         }
-        blink_winner (6);
+        blink_winner(6);
     } else if (moves == 42) {
         gameover = true;
         winner = NOBODY;
-        play_sound (SoundID.DRAWN_GAME);
+        play_sound(SoundID.DRAWN_GAME);
     }
 }
 
-void on_help_contents (SimpleAction action, Variant? parameter) {
+void on_help_contents(SimpleAction action, Variant? parameter) {
     try {
-        Gtk.show_uri (window.get_screen(),
+        Gtk.show_uri(window.get_screen(),
             "help:four-in-a-row",
-            Gtk.get_current_event_time ());
+            Gtk.get_current_event_time());
     } catch(Error error) {
-        warning ("Failed to show help: %s", error.message);
+        warning("Failed to show help: %s", error.message);
     }
 }
 
-void process_move3 (int c) {
-    play_sound (SoundID.DROP);
+void process_move3(int c) {
+    play_sound(SoundID.DROP);
 
     vstr[++moves] = '1' + (char)c;
     vstr[moves + 1] = '0';
 
-    check_game_state ();
+    check_game_state();
 
     if (gameover) {
         score[winner]++;
-        scorebox_update ();
-        prompt_player ();
+        scorebox_update();
+        prompt_player();
     } else {
-        swap_player ();
-        if (!is_player_human ()) {
+        swap_player();
+        if (!is_player_human()) {
             vstr[0] = player == PlayerID.PLAYER1 ? vlevel[p.level[PlayerID.PLAYER1]]
                 : vlevel[p.level[PlayerID.PLAYER2]];
-            c = playgame ((string)vstr) - 1;
+            c = playgame((string)vstr) - 1;
             if (c < 0)
                 gameover = true;
             var nm = new NextMove(c);
@@ -645,8 +645,8 @@ void process_move3 (int c) {
     }
 }
 
-void game_reset () {
-    stop_anim ();
+void game_reset() {
+    stop_anim();
 
     undo_action.set_enabled(false);
     hint_action.set_enabled(false);
@@ -663,21 +663,21 @@ void game_reset () {
     row = 0;
     row_dropto = 0;
 
-    clear_board ();
-    set_status_message (null);
-    Gfx.draw_all ();
+    clear_board();
+    set_status_message(null);
+    Gfx.draw_all();
 
-    move_cursor (column);
+    move_cursor(column);
     gameover = false;
-    prompt_player ();
-    if (!is_player_human ()) {
+    prompt_player();
+    if (!is_player_human()) {
         vstr[0] = player == PLAYER1 ? vlevel[p.level[PlayerID.PLAYER1]]
             : vlevel[p.level[PlayerID.PLAYER2]];
-        game_process_move (playgame ((string)vstr) - 1);
+        game_process_move(playgame((string)vstr) - 1);
     }
 }
 
-void play_sound (SoundID id) {
+void play_sound(SoundID id) {
     string name;
 
     if (!p.do_sound)
@@ -710,7 +710,7 @@ void play_sound (SoundID id) {
     string filename, path;
 
     filename = name + ".ogg";
-    path = Path.build_filename (Config.SOUND_DIRECTORY, filename);
+    path = Path.build_filename(Config.SOUND_DIRECTORY, filename);
 
     CanberraGtk.context_get().play(
             id,
@@ -721,16 +721,16 @@ void play_sound (SoundID id) {
 
 class Animate {
     int c;
-    public Animate (int c) {
+    public Animate(int c) {
         this.c = c;
     }
 
-    public bool exec () {
+    public bool exec() {
         return on_animate(c);
     }
 }
 
-bool on_animate (int c = 0) {
+bool on_animate(int c = 0) {
     if (anim == AnimID.NONE)
         return false;
 
@@ -740,14 +740,14 @@ bool on_animate (int c = 0) {
     case AnimID.HINT:
     case AnimID.MOVE:
         if (column < column_moveto) {
-            move (column + 1);
+            move(column + 1);
         } else if (column > column_moveto) {
-            move (column - 1);
+            move(column - 1);
         } else {
             timeout = 0;
             if (anim == AnimID.MOVE) {
                 anim = AnimID.NONE;
-                process_move2 (c);
+                process_move2(c);
             } else {
                 anim = AnimID.NONE;
             }
@@ -756,16 +756,16 @@ bool on_animate (int c = 0) {
         break;
     case AnimID.DROP:
         if (row < row_dropto) {
-            drop ();
+            drop();
         } else {
             anim = AnimID.NONE;
             timeout = 0;
-            process_move3 (c);
+            process_move3(c);
             return false;
         }
         break;
     case AnimID.BLINK:
-        draw_line (blink_r1, blink_c1, blink_r2, blink_c2, blink_on ? blink_t
+        draw_line(blink_r1, blink_c1, blink_r2, blink_c2, blink_on ? blink_t
             : Tile.CLEAR);
         blink_n--;
         if (blink_n <= 0 && blink_on) {
@@ -779,7 +779,7 @@ bool on_animate (int c = 0) {
     return true;
 }
 
-bool on_key_press (Gtk.Widget  w, Gdk.EventKey  e) {
+bool on_key_press(Gtk.Widget  w, Gdk.EventKey  e) {
     if ((player_active) || timeout != 0 ||
             (e.keyval != p.keypress[Move.LEFT] &&
             e.keyval != p.keypress[Move.RIGHT] &&
@@ -788,93 +788,93 @@ bool on_key_press (Gtk.Widget  w, Gdk.EventKey  e) {
     }
 
     if (gameover) {
-        blink_winner (2);
+        blink_winner(2);
         return true;
     }
 
     if (e.keyval == p.keypress[Move.LEFT] && column != 0) {
         column_moveto--;
-        move_cursor (column_moveto);
+        move_cursor(column_moveto);
     } else if (e.keyval == p.keypress[Move.RIGHT] && column < 6) {
         column_moveto++;
-        move_cursor (column_moveto);
+        move_cursor(column_moveto);
     } else if (e.keyval == p.keypress[Move.DROP]) {
-        game_process_move (column);
+        game_process_move(column);
     }
     return true;
 }
 
-void blink_winner (int n) {
+void blink_winner(int n) {
     /* blink the winner's line(s) n times */
 
     if (winner == NOBODY)
         return;
 
     blink_t = winner;
-    if (is_hline_at (winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
+    if (is_hline_at(winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
         anim = AnimID.BLINK;
         blink_on = false;
         blink_n = n;
         var temp = new Animate(0);
-        timeout = Timeout.add (SPEED_BLINK,  temp.exec);
+        timeout = Timeout.add(SPEED_BLINK,  temp.exec);
         while (timeout!=0)
             Gtk.main_iteration();
     }
 
-    if (is_vline_at (winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
+    if (is_vline_at(winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
         anim = AnimID.BLINK;
         blink_on = false;
         blink_n = n;
         var temp = new Animate(0);
-        timeout = Timeout.add (SPEED_BLINK,  temp.exec);
+        timeout = Timeout.add(SPEED_BLINK,  temp.exec);
         while (timeout!=0)
             Gtk.main_iteration();
     }
 
-    if (is_dline1_at (winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
+    if (is_dline1_at(winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
         anim = AnimID.BLINK;
         blink_on = false;
         blink_n = n;
         var temp = new Animate(0);
-        timeout = Timeout.add (SPEED_BLINK,  temp.exec);
+        timeout = Timeout.add(SPEED_BLINK,  temp.exec);
         while (timeout!=0)
             Gtk.main_iteration();
     }
 
-    if (is_dline2_at (winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
+    if (is_dline2_at(winner, row, column, &blink_r1, &blink_c1, &blink_r2, &blink_c2)) {
         anim = AnimID.BLINK;
         blink_on = false;
         blink_n = n;
         var temp = new Animate(0);
-        timeout = Timeout.add (SPEED_BLINK,  temp.exec);
+        timeout = Timeout.add(SPEED_BLINK,  temp.exec);
         while (timeout!=0)
             Gtk.main_iteration();
     }
 }
 
-bool on_button_press (Gtk.Widget w, Gdk.EventButton e) {
+bool on_button_press(Gtk.Widget w, Gdk.EventButton e) {
     int x, y;
     if (player_active) {
         return false;
     }
 
     if (gameover && timeout == 0) {
-        blink_winner (2);
-    } else if (is_player_human () && timeout == 0) {
-        w.get_window().get_device_position (e.device, out x, out y, null);
-        game_process_move (Gfx.get_column (x));
+        blink_winner(2);
+    } else if (is_player_human() && timeout == 0) {
+        w.get_window().get_device_position(e.device, out x, out y, null);
+        game_process_move(Gfx.get_column(x));
     }
 
     return true;
 }
 
-void scorebox_update () {
+void scorebox_update() {
     string s;
 
     if (scorebox == null)
         return;
 
-    if (get_n_human_players () == 1) {
+    if (get_n_human_players() == 1) {
         if (p.level[PlayerID.PLAYER1] == Level.HUMAN) {
             label_score[PlayerID.PLAYER1].set_text(_("You:"));
             label_score[PlayerID.PLAYER2].set_text(_("Me:"));
@@ -893,11 +893,11 @@ void scorebox_update () {
 
 }
 
-void on_settings_preferences (SimpleAction action, Variant? parameter) {
-    prefsbox_open ();
+void on_settings_preferences(SimpleAction action, Variant? parameter) {
+    prefsbox_open();
 }
 
-void on_game_hint (SimpleAction action, Variant? parameter) {
+void on_game_hint(SimpleAction action, Variant? parameter) {
     string s;
     int c;
 
@@ -909,25 +909,25 @@ void on_game_hint (SimpleAction action, Variant? parameter) {
     hint_action.set_enabled(false);
     undo_action.set_enabled(false);
 
-    set_status_message (_("I’m Thinking…"));
+    set_status_message(_("I’m Thinking…"));
 
     vstr[0] = vlevel[Level.STRONG];
-    c = playgame ((string)vstr) - 1;
+    c = playgame((string)vstr) - 1;
 
     column_moveto = c;
     while (timeout != 0)
-        Gtk.main_iteration ();
+        Gtk.main_iteration();
     anim = AnimID.HINT;
     var temp = new Animate(0);
-    timeout = Timeout.add (SPEED_MOVE, temp.exec);
+    timeout = Timeout.add(SPEED_MOVE, temp.exec);
 
-    blink_tile (0, c, gboard[0, c], 6);
+    blink_tile(0, c, gboard[0, c], 6);
 
     s = _("Hint: Column ")+ (c + 1).to_string();
-    set_status_message (s);
-    g_free (s);
+    set_status_message(s);
+    g_free(s);
 
-    if (moves <= 0 || (moves == 1 && is_player_human ()))
+    if (moves <= 0 || (moves == 1 && is_player_human()))
         undo_action.set_enabled(false);
     else
         undo_action.set_enabled(true);
@@ -944,7 +944,7 @@ const GLib.ActionEntry app_entries[] = {
     {"about", on_help_about, null, null, null}
 };
 
-void create_app (GLib.Application app) {
+void create_app(GLib.Application app) {
     Gtk.AspectFrame frame;
     GLib.Menu app_menu, section;
 
@@ -954,7 +954,7 @@ void create_app (GLib.Application app) {
 
     Gtk.Window.set_default_icon_name("four-in-a-row");
 
-    css_provider = new Gtk.CssProvider ();
+    css_provider = new Gtk.CssProvider();
     try {
         css_provider.load_from_data("GtkButtonBox{-GtkButtonBox-child-internal-pad-x:0;}\0");
     } catch (Error error){
@@ -964,13 +964,13 @@ void create_app (GLib.Application app) {
     Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
 
 
-    builder = new Gtk.Builder.from_file (Config.DATA_DIRECTORY + "/four-in-a-row.ui");
+    builder = new Gtk.Builder.from_file(Config.DATA_DIRECTORY + "/four-in-a-row.ui");
 
-    window = (Gtk.Window) builder.get_object ("fiar-window");
+    window = (Gtk.Window) builder.get_object("fiar-window");
     window.application = application;
     window.set_default_size(DEFAULT_WIDTH, DEFAULT_HEIGHT); // TODO save size & state
 
-    headerbar = (Gtk.HeaderBar) builder.get_object ("headerbar");
+    headerbar = (Gtk.HeaderBar) builder.get_object("headerbar");
 
     application.add_action_entries(app_entries, application);
     application.add_accelerator("<Primary>n", "app.new-game", null);
@@ -1000,7 +1000,7 @@ void create_app (GLib.Application app) {
 
     drawarea = new Gtk.DrawingArea();
     /* set a min size to avoid pathological behavior of gtk when scaling down */
-    drawarea.set_size_request (350, 350);
+    drawarea.set_size_request(350, 350);
     drawarea.halign = Gtk.Align.FILL;
     drawarea.valign = Gtk.Align.FILL;
     frame.add(drawarea);
@@ -1015,13 +1015,13 @@ void create_app (GLib.Application app) {
     undo_action.set_enabled(false);
 }
 
-void on_dialog_close (Gtk.Widget w, int response_id) {
+void on_dialog_close(Gtk.Widget w, int response_id) {
     w.hide();
 }
 
-void prompt_player () {
-    int players = get_n_human_players ();
-    bool human = is_player_human ();
+void prompt_player() {
+    int players = get_n_human_players();
+    bool human = is_player_human();
     string who;
     string str;
 
@@ -1041,9 +1041,9 @@ void prompt_player () {
 
     if (gameover && winner == PlayerID.NOBODY) {
         if (score[PlayerID.NOBODY] == 0)
-            set_status_message (null);
+            set_status_message(null);
         else
-            set_status_message (_("It’s a draw!"));
+            set_status_message(_("It’s a draw!"));
         return;
     }
 
@@ -1051,33 +1051,33 @@ void prompt_player () {
     case 1:
         if (human) {
             if (gameover)
-                set_status_message (_("You win!"));
+                set_status_message(_("You win!"));
             else
-                set_status_message (_("Your Turn"));
+                set_status_message(_("Your Turn"));
         } else {
             if (gameover)
-                set_status_message (_("I win!"));
+                set_status_message(_("I win!"));
             else
-                set_status_message (_("I’m Thinking…"));
+                set_status_message(_("I’m Thinking…"));
         }
         break;
     case 2:
     case 0:
 
         if (gameover) {
-            who = player == PLAYER1 ? theme_get_player_win (PlayerID.PLAYER1)
-                : theme_get_player_win (PlayerID.PLAYER2);
+            who = player == PLAYER1 ? theme_get_player_win(PlayerID.PLAYER1)
+                : theme_get_player_win(PlayerID.PLAYER2);
             str =  _(who);
         } else if (player_active) {
-            set_status_message (_("Your Turn"));
+            set_status_message(_("Your Turn"));
             return;
         } else {
-            who = player == PLAYER1 ? theme_get_player_turn (PlayerID.PLAYER1)
-                : theme_get_player_turn (PlayerID.PLAYER2);
+            who = player == PLAYER1 ? theme_get_player_turn(PlayerID.PLAYER1)
+                : theme_get_player_turn(PlayerID.PLAYER2);
             str =  _(who);
         }
 
-        set_status_message (str);
+        set_status_message(str);
         break;
     }
 }
diff --git a/src/prefs.vala b/src/prefs.vala
index 4d91e50..76ecd76 100644
--- a/src/prefs.vala
+++ b/src/prefs.vala
@@ -44,13 +44,13 @@ const uint DEFAULT_KEY_DROP = Gdk.Key.Down;
 const int DEFAULT_THEME_ID = 0;
 
 
-static int sane_theme_id (int val) {
+static int sane_theme_id(int val) {
     if (val < 0 || val >= theme.length)
     return DEFAULT_THEME_ID;
     return val;
 }
 
-public int sane_player_level (int val) {
+public int sane_player_level(int val) {
     if (val < Level.HUMAN)
         return Level.HUMAN;
     if (val > Level.STRONG)
@@ -58,70 +58,70 @@ public int sane_player_level (int val) {
     return val;
 }
 
-public void on_select_theme (Gtk.ComboBox combo) {
-    int id = combo.get_active ();
-    settings.set_int ("theme-id", id);
+public void on_select_theme(Gtk.ComboBox combo) {
+    int id = combo.get_active();
+    settings.set_int("theme-id", id);
 }
 
-public void on_toggle_sound (Gtk.ToggleButton t) {
-    p.do_sound = t.get_active ();
-    settings.set_boolean ("sound", t.get_active());
+public void on_toggle_sound(Gtk.ToggleButton t) {
+    p.do_sound = t.get_active();
+    settings.set_boolean("sound", t.get_active());
 }
 
-void prefs_init () {
-    p.do_sound = settings.get_boolean ("sound");
+void prefs_init() {
+    p.do_sound = settings.get_boolean("sound");
     p.level[PlayerID.PLAYER1] = Level.HUMAN;           /* Human. Always human. */
-    p.level[PlayerID.PLAYER2] = (Level) settings.get_int ("opponent");
-    p.keypress[Move.LEFT] = settings.get_int ("key-left");
-    p.keypress[Move.RIGHT] = settings.get_int ("key-right");
-    p.keypress[Move.DROP] = settings.get_int ("key-drop");
-    p.theme_id = settings.get_int ("theme-id");
+    p.level[PlayerID.PLAYER2] = (Level) settings.get_int("opponent");
+    p.keypress[Move.LEFT] = settings.get_int("key-left");
+    p.keypress[Move.RIGHT] = settings.get_int("key-right");
+    p.keypress[Move.DROP] = settings.get_int("key-drop");
+    p.theme_id = settings.get_int("theme-id");
 
     settings.changed.connect(settings_changed_cb);
 
-    p.level[PlayerID.PLAYER1] = (Level) sane_player_level (p.level[PlayerID.PLAYER1]);
-    p.level[PlayerID.PLAYER2] = (Level) sane_player_level (p.level[PlayerID.PLAYER2]);
-    p.theme_id = sane_theme_id (p.theme_id);
+    p.level[PlayerID.PLAYER1] = (Level) sane_player_level(p.level[PlayerID.PLAYER1]);
+    p.level[PlayerID.PLAYER2] = (Level) sane_player_level(p.level[PlayerID.PLAYER2]);
+    p.theme_id = sane_theme_id(p.theme_id);
 }
 
-public void settings_changed_cb (string key) {
+public void settings_changed_cb(string key) {
     if (key == "sound") {
-        p.do_sound = settings.get_boolean ("sound");
-        ((Gtk.ToggleButton)checkbutton_sound).set_active (p.do_sound);
+        p.do_sound = settings.get_boolean("sound");
+        ((Gtk.ToggleButton)checkbutton_sound).set_active(p.do_sound);
     } else if (key == "key-left") {
-        p.keypress[Move.LEFT] = settings.get_int ( "key-left");
+        p.keypress[Move.LEFT] = settings.get_int( "key-left");
     } else if (key == "key-right") {
-        p.keypress[Move.RIGHT] = settings.get_int ( "key-right");
+        p.keypress[Move.RIGHT] = settings.get_int( "key-right");
     } else if (key == "key-drop") {
-        p.keypress[Move.DROP] = settings.get_int ( "key-drop");
+        p.keypress[Move.DROP] = settings.get_int( "key-drop");
     } else if (key == "theme-id") {
-        int val = sane_theme_id (settings.get_int ("theme-id"));
+        int val = sane_theme_id(settings.get_int("theme-id"));
         if (val != p.theme_id) {
             p.theme_id = val;
-            if (!Gfx.change_theme ())
+            if (!Gfx.change_theme())
                 return;
         if (prefsbox == null)
             return;
-        combobox_theme.set_active (p.theme_id);
+        combobox_theme.set_active(p.theme_id);
         }
     }
 }
 
-public void on_select_opponent (Gtk.ComboBox w) {
+public void on_select_opponent(Gtk.ComboBox w) {
     Gtk.TreeIter iter;
     int value;
 
-    w.get_active_iter (out iter);
-    w.get_model().get (iter, 1, out value);
+    w.get_active_iter(out iter);
+    w.get_model().get(iter, 1, out value);
 
     p.level[PlayerID.PLAYER2] = (Level)value;
-    settings.set_int ("opponent", value);
-    scorebox_reset ();
+    settings.set_int("opponent", value);
+    scorebox_reset();
     who_starts = PlayerID.PLAYER2;             /* This gets reversed in game_reset. */
-    game_reset ();
+    game_reset();
 }
 
-public void prefsbox_open () {
+public void prefsbox_open() {
     Gtk.Notebook notebook;
     Gtk.Grid grid;
     GamesControlsList controls_list;
@@ -132,11 +132,11 @@ public void prefsbox_open () {
     // gint i;
 
     if (prefsbox != null) {
-        prefsbox.present ();
+        prefsbox.present();
         return;
     }
 
-    prefsbox = new Gtk.Dialog.with_buttons (_("Preferences"),
+    prefsbox = new Gtk.Dialog.with_buttons(_("Preferences"),
                         window,
                         Gtk.DialogFlags.DESTROY_WITH_PARENT);
 
@@ -204,7 +204,7 @@ public void prefsbox_open () {
 
     /* keyboard tab */
 
-    label = new Gtk.Label.with_mnemonic (_("Keyboard Controls"));
+    label = new Gtk.Label.with_mnemonic(_("Keyboard Controls"));
 
     controls_list = new GamesControlsList(settings);
     controls_list.add_controls("key-left", _("Move left"), DEFAULT_KEY_LEFT,
diff --git a/src/theme.vala b/src/theme.vala
index 6fa87b0..11cd8a0 100644
--- a/src/theme.vala
+++ b/src/theme.vala
@@ -38,23 +38,23 @@ struct Theme {
  */
 const string theme_gettext_package = Config.GETTEXT_PACKAGE;
 
-string theme_get_title (int id) {
+string theme_get_title(int id) {
     return theme[id].title;
 }
 
-string theme_get_player_turn (PlayerID who) {
+string theme_get_player_turn(PlayerID who) {
     if (who == PlayerID.PLAYER1)
         return theme[p.theme_id].player1_turn;
     return theme[p.theme_id].player2_turn;
 }
 
-string theme_get_player_win (PlayerID who) {
+string theme_get_player_win(PlayerID who) {
     if (who == PlayerID.PLAYER1)
         return theme[p.theme_id].player1_win;
     return theme[p.theme_id].player2_win;
 }
 
-string theme_get_player (PlayerID who) {
+string theme_get_player(PlayerID who) {
     if (who == PlayerID.PLAYER1)
         return theme[p.theme_id].player1;
     return theme[p.theme_id].player2;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]