[four-in-a-row/KaKnife/four-in-a-row-vala: 8/65] formating fixes



commit 28a920d94b80848a61f265d3c6aff583c92ba1d4
Author: Jacob Humphrey <jacob ryan humphrey gmail com>
Date:   Sat Nov 17 01:02:55 2018 -0600

    formating fixes

 src/games-controls.vala |  26 ++-
 src/gfx.vala            | 227 ++++++++++++-------------
 src/main.vala           | 428 +++++++++++++++++++++---------------------------
 src/prefs.vala          | 359 +++++++++++++++++++---------------------
 src/theme.vala          |  96 +++++------
 5 files changed, 517 insertions(+), 619 deletions(-)
---
diff --git a/src/games-controls.vala b/src/games-controls.vala
index 2371fd5..15edf2b 100644
--- a/src/games-controls.vala
+++ b/src/games-controls.vala
@@ -3,13 +3,13 @@ using Gtk;
 const string jjjj = Config.GETTEXT_PACKAGE;
 
 enum Columns {
-  CONFKEY_COLUMN = 0,
-  LABEL_COLUMN,
-  KEYCODE_COLUMN,
-  KEYMODS_COLUMN,
-  DEFAULT_KEYCODE_COLUMN,
-  DEFAULT_KEYMODS_COLUMN,
-  N_COLUMNS
+       CONFKEY_COLUMN = 0,
+       LABEL_COLUMN,
+       KEYCODE_COLUMN,
+       KEYMODS_COLUMN,
+       DEFAULT_KEYCODE_COLUMN,
+       DEFAULT_KEYMODS_COLUMN,
+       N_COLUMNS
 }
 
 public class GamesControlsList: Gtk.ScrolledWindow {
@@ -68,8 +68,7 @@ public class GamesControlsList: Gtk.ScrolledWindow {
                this.add(view);
        }
 
-       void accel_cleared_cb (string path_string)
-       {
+       void accel_cleared_cb (string path_string) {
                TreePath path;
                TreeIter iter;
                string conf_key = null;
@@ -95,9 +94,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) {
                TreePath path;
                TreeIter iter;
                string conf_key = null;
@@ -148,8 +145,7 @@ public class GamesControlsList: Gtk.ScrolledWindow {
                        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;
 
@@ -169,7 +165,7 @@ public class GamesControlsList: Gtk.ScrolledWindow {
 
        }
 
-       void add_controls (string first_gconf_key, ...) {
+       public void add_controls (string first_gconf_key, ...) {
                var args = va_list();
                string? key;
                string label;
diff --git a/src/gfx.vala b/src/gfx.vala
index cfe880a..728f55b 100644
--- a/src/gfx.vala
+++ b/src/gfx.vala
@@ -1,7 +1,4 @@
-//using GETTTEXT_PACKAGE_CONTENT;
-const string GETTEXT_PACKAGE2 = Config.GETTEXT_PACKAGE;
 Gtk.Widget drawarea;
-//extern Theme theme[];
 int[,] gboard;
 int boardsize = 0;
 int tilesize = 0;
@@ -16,7 +13,7 @@ namespace Gfx{
        Gdk.Pixbuf pb_tileset;
        Gdk.Pixbuf pb_bground;
 
-       public int get_column (int xpos) {
+       int get_column (int xpos) {
                /* Derive column from pixel position */
                int c = xpos / tilesize;
                if (c > 6)
@@ -27,11 +24,11 @@ namespace Gfx{
                return c;
        }
 
-       public void draw_tile (int r, int c) {
+       void draw_tile (int r, int c) {
                drawarea.queue_draw_area(c*tilesize, r*tilesize, tilesize, tilesize);
        }
 
-       public void draw_all () {
+       void draw_all () {
                drawarea.queue_draw_area(0, 0, boardsize, boardsize);
        }
 
@@ -113,56 +110,56 @@ namespace Gfx{
                cr.stroke();
        }
 
-    void load_error (string fname) {
-       Gtk.MessageDialog dialog;
-
-       dialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.MODAL,
-           Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE,
-       dgettext(Config.GETTEXT_PACKAGE, "Unable to load image:\n%s"), fname);
-
-       dialog.run();
-       dialog.destroy();
-    }
-
-    void paint_tile (Cairo.Context cr, int r, int c) {
-       int x = c * tilesize;
-       int y = r * tilesize;
-       int tile = gboard[r,c];
-       int os = 0;
-
-       if (tile == Tile.CLEAR && r != 0)
-           return;
-
-       switch (tile) {
-       case Tile.PLAYER1:
-           if (r == 0)
-               os = offset[Tile.PLAYER1_CURSOR];
-           else
-               os = offset[Tile.PLAYER1];
-           break;
-       case Tile.PLAYER2:
-           if (r == 0)
-               os = offset[Tile.PLAYER2_CURSOR];
-           else
-               os = offset[Tile.PLAYER2];
-           break;
-       case Tile.CLEAR:
-           if (r == 0)
-               os = offset[Tile.CLEAR_CURSOR];
-           else
-               os = offset[Tile.CLEAR];
-           break;
+       void load_error (string fname) {
+               Gtk.MessageDialog dialog;
+
+               dialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.MODAL,
+                       Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE,
+               dgettext(Config.GETTEXT_PACKAGE, "Unable to load image:\n%s"), fname);
+
+               dialog.run();
+               dialog.destroy();
        }
 
+       void paint_tile (Cairo.Context cr, int r, int c) {
+               int x = c * tilesize;
+               int y = r * tilesize;
+               int tile = gboard[r,c];
+               int os = 0;
+
+               if (tile == Tile.CLEAR && r != 0)
+                       return;
+
+               switch (tile) {
+               case Tile.PLAYER1:
+                       if (r == 0)
+                               os = offset[Tile.PLAYER1_CURSOR];
+                       else
+                               os = offset[Tile.PLAYER1];
+                       break;
+               case Tile.PLAYER2:
+                       if (r == 0)
+                               os = offset[Tile.PLAYER2_CURSOR];
+                       else
+                               os = offset[Tile.PLAYER2];
+                       break;
+               case Tile.CLEAR:
+                       if (r == 0)
+                               os = offset[Tile.CLEAR_CURSOR];
+                       else
+                               os = offset[Tile.CLEAR];
+                       break;
+               }
 
-       cr.save();
-       Gdk.cairo_set_source_pixbuf (cr, pb_tileset, x - os, y);
-       cr.rectangle (x, y, tilesize, tilesize);
 
-       cr.clip();
-       cr.paint();
-       cr.restore();
-    }
+               cr.save();
+               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 () {
                /* scale the pixbufs */
@@ -172,89 +169,67 @@ namespace Gfx{
 
 
 
-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);
-               try {
-                       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);
-                               return false;
+       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);
+                       try {
+                               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);
+                                       return false;
+                               }
                        }
+                       break;
                }
-               break;
-       }
 
-       pb_tileset_raw = pb_tileset_tmp;
+               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);
-               try {
-                       pb_bground_tmp = new Gdk.Pixbuf.from_file (fname);
-               } catch (Error e) {
-                       Gfx.load_error (fname);
-                       return false;
+               if (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);
+                       } catch (Error e) {
+                               Gfx.load_error (fname);
+                               return false;
+                       }
                }
-       }
 
-       /* If a separate background image wasn't supplied,
-       * derive the background image from the tile set
-       */
-       if (pb_bground_tmp != null) {
-               pb_bground_raw = pb_bground_tmp;
-       } else {
-               int tilesize_raw;
-               int i, j;
-
-               tilesize_raw = pb_tileset_raw.get_height();
-
-               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,
-                               tilesize_raw, tilesize_raw,
-                               pb_bground_raw, i * tilesize_raw, 0);
-                       for (j = 1; j < 7; j++) {
-                               pb_tileset_raw.copy_area (
-                                       tilesize_raw * 2, 0,
+               /* If a separate background image wasn't supplied,
+               * derive the background image from the tile set
+               */
+               if (pb_bground_tmp != null) {
+                       pb_bground_raw = pb_bground_tmp;
+               } else {
+                       int tilesize_raw;
+                       int i, j;
+
+                       tilesize_raw = pb_tileset_raw.get_height();
+
+                       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,
                                        tilesize_raw, tilesize_raw,
-                                       pb_bground_raw,
-                                       i * tilesize_raw, j * tilesize_raw);
+                                       pb_bground_raw, i * tilesize_raw, 0);
+                               for (j = 1; j < 7; j++) {
+                                       pb_tileset_raw.copy_area (
+                                               tilesize_raw * 2, 0,
+                                               tilesize_raw, tilesize_raw,
+                                               pb_bground_raw,
+                                               i * tilesize_raw, j * tilesize_raw);
+                               }
                        }
                }
-       }
-
-       return true;
-}
 
-       void free ()
-       {
-               if (pb_tileset_raw != null) {
-                       pb_tileset_raw.unref();
-                       pb_tileset_raw = null;
-               }
-               if (pb_bground_raw != null) {
-                       pb_bground_raw.unref();
-                       pb_bground_raw = null;
-               }
-               if (pb_tileset != null) {
-                       pb_tileset.unref();
-                       pb_tileset = null;
-               }
-               if (pb_bground != null) {
-                       pb_bground.unref();
-                       pb_bground = null;
-               }
+               return true;
        }
-
 }
diff --git a/src/main.vala b/src/main.vala
index 116a538..4ef9fee 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -1,7 +1,6 @@
 using Config;
 using Intl;
 using Gtk;
-//using temp;
 
 public enum AnimID {
        NONE,
@@ -97,8 +96,7 @@ void on_game_new(SimpleAction a, Variant? v) {
        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;
@@ -197,12 +195,7 @@ public void game_process_move(int c) {
        process_move(c);
 }
 
-public void game_free() {
-       Gfx.free();
-}
-
-public void game_init ()
-{
+public void game_init () {
        //Random.set_seed ((uint) Linux.timegm(null));
 
        anim = AnimID.NONE;
@@ -236,7 +229,7 @@ void clear_board () {
        moves = 0;
 }
 
-static int first_empty_row (int c) {
+int first_empty_row (int c) {
        int r = 1;
 
        while (r < 7 && gboard[r, c] == Tile.CLEAR)
@@ -244,7 +237,7 @@ static int first_empty_row (int c) {
        return r - 1;
 }
 
-static 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)
@@ -252,14 +245,12 @@ static int get_n_human_players () {
        return 2;
 }
 
-static 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;
 
@@ -271,8 +262,7 @@ static void drop_marble (int r, int c)
 }
 
 void drop () {
-       int tile;
-       tile = player == PLAYER1 ? Tile.PLAYER1 : Tile.PLAYER2;
+       Tile tile = player == PLAYER1 ? Tile.PLAYER1 : Tile.PLAYER2;
 
        gboard[row, column] = Tile.CLEAR;
        Gfx.draw_tile (row, column);
@@ -292,226 +282,210 @@ void move (int c) {
        Gfx.draw_tile (0, c);
 }
 
-static void move_cursor (int c)
-{
+static void move_cursor (int c) {
        move (c);
        column = column_moveto = c;
        row = row_dropto = 0;
 }
 
-void swap_player ()
-{
-  player = (player == PlayerID.PLAYER1) ? PlayerID.PLAYER2 : PlayerID.PLAYER1;
-  move_cursor (3);
-  prompt_player ();
+void swap_player () {
+       player = (player == PlayerID.PLAYER1) ? PlayerID.PLAYER2 : PlayerID.PLAYER1;
+       move_cursor (3);
+       prompt_player ();
 }
 
 
-void set_status_message (string? message)
-{
-    headerbar.set_title(message);
+void set_status_message (string? message) {
+       headerbar.set_title(message);
 }
 
 static void blink_tile (int r, int c, int t, int n) {
-  if (timeout != 0)
-    return;
-  blink_r1 = r;
-  blink_c1 = c;
-  blink_r2 = r;
-  blink_c2 = c;
-  blink_t = t;
-  blink_n = n;
-  blink_on = false;
-  anim = AnimID.BLINK;
-  var anim = new Animate(0);
-  timeout = Timeout.add (SPEED_BLINK, anim.exec);
+       if (timeout != 0)
+               return;
+       blink_r1 = r;
+       blink_c1 = c;
+       blink_r2 = r;
+       blink_c2 = c;
+       blink_t = t;
+       blink_n = n;
+       blink_on = false;
+       anim = AnimID.BLINK;
+       var temp = new Animate(0);
+       timeout = Timeout.add (SPEED_BLINK, temp.exec);
 }
 
-void stop_anim ()
-{
-  if (timeout == 0)
-    return;
-  anim = AnimID.NONE;
-  Source.remove(timeout);
-  timeout = 0;
+void stop_anim () {
+       if (timeout == 0)
+               return;
+       anim = AnimID.NONE;
+       Source.remove(timeout);
+       timeout = 0;
 }
 
 bool on_drawarea_resize (Gtk.Widget w, Gdk.EventConfigure e) {
-  Gfx.resize (w);
-  return true;
+       Gfx.resize (w);
+       return true;
 }
 
 bool on_drawarea_draw (Gtk.Widget w, Cairo.Context cr) {
-  Gfx.expose (cr);
-  return false;
+       Gfx.expose (cr);
+       return false;
 }
 
-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;
-  vstr[moves] = '0';
-  vstr[moves + 1] = '\0';
-  moves--;
-
-  if (gameover) {
-    score[winner]--;
-    scorebox_update ();
-    gameover = false;
-    prompt_player ();
-  } else {
-    swap_player ();
-  }
-  move_cursor (c);
-
-  gboard[r, c] = Tile.CLEAR;
-  Gfx.draw_tile (r, c);
-
-  if (get_n_human_players () == 1 && !is_player_human ()) {
-    if (moves > 0) {
-      c = vstr[moves] - '0' - 1;
-      r = first_empty_row (c) + 1;
-      vstr[moves] = '0';
-      vstr[moves + 1] = '\0';
-      moves--;
-      swap_player ();
-      move_cursor (c);
-      gboard[r, c] = Tile.CLEAR;
-      Gfx.draw_tile (r, c);
-    }
-  }
+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;
+       vstr[moves] = '0';
+       vstr[moves + 1] = '\0';
+       moves--;
+
+       if (gameover) {
+               score[winner]--;
+               scorebox_update ();
+               gameover = false;
+               prompt_player ();
+       } else {
+               swap_player ();
+       }
+       move_cursor (c);
+
+       gboard[r, c] = Tile.CLEAR;
+       Gfx.draw_tile (r, c);
+
+       if (get_n_human_players () == 1 && !is_player_human ()) {
+               if (moves > 0) {
+                       c = vstr[moves] - '0' - 1;
+                       r = first_empty_row (c) + 1;
+                       vstr[moves] = '0';
+                       vstr[moves + 1] = '\0';
+                       moves--;
+                       swap_player ();
+                       move_cursor (c);
+                       gboard[r, c] = Tile.CLEAR;
+                       Gfx.draw_tile (r, c);
+               }
+       }
 }
-void on_game_scores (SimpleAction action, Variant? parameter)
-{
-    Gtk.Grid grid, grid2;
-    Gtk.Widget icon;
+void on_game_scores (SimpleAction action, Variant? parameter) {
+       Gtk.Grid grid, grid2;
+       Gtk.Widget icon;
 
-    if (scorebox != null) {
-       scorebox.present();
-       return;
-    }
+       if (scorebox != null) {
+               scorebox.present();
+               return;
+       }
 
-    scorebox = new Gtk.Dialog.with_buttons(_("Scores"), window,
+       scorebox = new Gtk.Dialog.with_buttons(_("Scores"), window,
        Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.USE_HEADER_BAR);
 
-    scorebox.set_resizable(false);
-    scorebox.set_border_width(5);
-    scorebox.get_content_area().set_spacing(2);
+       scorebox.set_resizable(false);
+       scorebox.set_border_width(5);
+       scorebox.get_content_area().set_spacing(2);
 
-  // g_signal_connect (scorebox, "destroy",
-  //                   G_CALLBACK (gtk_widget_destroyed), &scorebox);
+       // g_signal_connect (scorebox, "destroy",
+       //                   G_CALLBACK (gtk_widget_destroyed), &scorebox);
 
-    grid = new Gtk.Grid();
-    grid.set_halign(Gtk.Align.CENTER);
-    grid.set_row_spacing(6);
-    grid.set_orientation(Gtk.Orientation.VERTICAL);
-    grid.set_border_width(5);
+       grid = new Gtk.Grid();
+       grid.set_halign(Gtk.Align.CENTER);
+       grid.set_row_spacing(6);
+       grid.set_orientation(Gtk.Orientation.VERTICAL);
+       grid.set_border_width(5);
 
-    scorebox.get_content_area().pack_start(grid);
+       scorebox.get_content_area().pack_start(grid);
 
-    grid2 = new Gtk.Grid();
-    grid.add(grid2);
-    grid2.set_column_spacing(6);
+       grid2 = new Gtk.Grid();
+       grid.add(grid2);
+       grid2.set_column_spacing(6);
 
-    label_name[PlayerID.PLAYER1] = new Label(null);
-    grid2.attach (label_name[PlayerID.PLAYER1], 0, 0, 1, 1);
+       label_name[PlayerID.PLAYER1] = new Label(null);
+       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 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 Label(null);
-    grid2.attach (label_name[PlayerID.PLAYER2], 0, 1, 1, 1);
+       label_name[PlayerID.PLAYER2] = new Label(null);
+       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 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 Label(_("Drawn:"));
-    grid2.attach (label_name[PlayerID.NOBODY], 0, 2, 1, 1);
+       label_name[PlayerID.NOBODY] = new Label(_("Drawn:"));
+       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 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);
 
-    //scorebox.response.connect(on_dialog_close);
+       //scorebox.response.connect(on_dialog_close);
 
        scorebox.show_all();
 
        scorebox_update ();
 }
 
-void
-on_game_exit (SimpleAction action, Variant? parameter)
-{
-  stop_anim ();
-  application.quit();
+void on_game_exit (SimpleAction action, Variant? parameter) {
+       stop_anim ();
+       application.quit();
 }
 
-void
-process_move2 (int c)
-{
-  int r;
-
-  r = first_empty_row (c);
-  if (r > 0) {
-    row = 0;
-    row_dropto = r;
-    anim = AnimID.DROP;
-    var temp = new Animate(c);
-    timeout = Timeout.add(SPEED_DROP, temp.exec);
-    //timeout = g_timeout_add (SPEED_DROP, (GSourceFunc) on_animate, GINT_TO_POINTER (c));
-  } else {
-    play_sound (SoundID.COLUMN_FULL);
-  }
+void process_move2 (int c) {
+       int r = first_empty_row (c);
+       if (r > 0) {
+               row = 0;
+               row_dropto = r;
+               anim = AnimID.DROP;
+               var temp = new Animate(c);
+               timeout = Timeout.add(SPEED_DROP, temp.exec);
+       } else {
+               play_sound (SoundID.COLUMN_FULL);
+       }
 }
 
-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)
-    *r1 = *r1 - 1;
-  while (*r2 < 6 && gboard[*r2 + 1, c] == p)
-    *r2 = *r2 + 1;
-  if (*r2 - *r1 >= 3)
-    return true;
-  return false;
+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)
+               *r1 = *r1 - 1;
+       while (*r2 < 6 && gboard[*r2 + 1, c] == p)
+               *r2 = *r2 + 1;
+       if (*r2 - *r1 >= 3)
+               return true;
+       return false;
 }
 
 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;
-  while (*c1 > 0 && *r1 > 1 && gboard[*r1 - 1, *c1 - 1] == p) {
-    *r1 = *r1 - 1;
-    *c1 = *c1 - 1;
-  }
-  while (*c2 < 6 && *r2 < 6 && gboard[*r2 + 1, *c2 + 1] == p) {
-    *r2 = *r2 + 1;
-    *c2 = *c2 + 1;
-  }
-  if (*r2 - *r1 >= 3)
-    return true;
-  return false;
+       /* upper left to lower right */
+       *r1 = *r2 = r;
+       *c1 = *c2 = c;
+       while (*c1 > 0 && *r1 > 1 && gboard[*r1 - 1, *c1 - 1] == p) {
+               *r1 = *r1 - 1;
+               *c1 = *c1 - 1;
+       }
+       while (*c2 < 6 && *r2 < 6 && gboard[*r2 + 1, *c2 + 1] == p) {
+               *r2 = *r2 + 1;
+               *c2 = *c2 + 1;
+       }
+       if (*r2 - *r1 >= 3)
+               return true;
+       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) ||
@@ -521,48 +495,45 @@ bool is_line_at (PlayerID p, int r, int c)
 }
 
 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;
-  while (*c1 < 6 && *r1 > 1 && gboard[*r1 - 1, *c1 + 1] == p) {
-    *r1 = *r1 - 1;
-    *c1 = *c1 + 1;
-  }
-  while (*c2 > 0 && *r2 < 6 && gboard[*r2 + 1, *c2 - 1] == p) {
-    *r2 = *r2 + 1;
-    *c2 = *c2 - 1;
-  }
-  if (*r2 - *r1 >= 3)
-    return true;
-  return false;
+       /* upper right to lower left */
+       *r1 = *r2 = r;
+       *c1 = *c2 = c;
+       while (*c1 < 6 && *r1 > 1 && gboard[*r1 - 1, *c1 + 1] == p) {
+               *r1 = *r1 - 1;
+               *c1 = *c1 + 1;
+       }
+       while (*c2 > 0 && *r2 < 6 && gboard[*r2 + 1, *c2 - 1] == p) {
+               *r2 = *r2 + 1;
+               *c2 = *c2 - 1;
+       }
+       if (*r2 - *r1 >= 3)
+               return true;
+       return false;
 }
 
-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)
-    *c1 = *c1 - 1;
-  while (*c2 < 6 && gboard[r, *c2 + 1] == p)
-    *c2 = *c2 + 1;
-  if (*c2 - *c1 >= 3)
-    return true;
-  return false;
+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)
+               *c1 = *c1 - 1;
+       while (*c2 < 6 && gboard[r, *c2 + 1] == p)
+               *c2 = *c2 + 1;
+       if (*c2 - *c1 >= 3)
+               return true;
+       return false;
 }
 
-void scorebox_reset ()
-{
+void scorebox_reset () {
        score[PlayerID.PLAYER1] = 0;
        score[PlayerID.PLAYER2] = 0;
        score[PlayerID.NOBODY] = 0;
        scorebox_update ();
 }
 
-void process_move (int c)
-{
+void process_move (int c) {
        if (timeout != 0) {
-               //Timeout.add(SPEED_DROP, next_move, c.to_pointer());
-               //g_timeout_add (SPEED_DROP, (GSourceFunc) next_move, GINT_TO_POINTER (c));
+               var temp = new Animate(c);
+               Timeout.add(SPEED_DROP, temp.exec);
                return;
        }
 
@@ -572,8 +543,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>"
@@ -601,8 +571,7 @@ void on_help_about (SimpleAction action, Variant? parameter)
                );
 }
 
-void check_game_state ()
-{
+void check_game_state () {
        if (is_line_at (player, row, column)) {
                gameover = true;
                winner = player;
@@ -623,9 +592,7 @@ void check_game_state ()
        }
 }
 
-void
-on_help_contents (SimpleAction action, Variant? parameter)
-{
+void on_help_contents (SimpleAction action, Variant? parameter) {
        try {
                Gtk.show_uri (window.get_screen(),
                        "help:four-in-a-row",
@@ -635,8 +602,7 @@ on_help_contents (SimpleAction action, Variant? parameter)
        }
 }
 
-void process_move3 (int c)
-{
+void process_move3 (int c) {
        play_sound (SoundID.DROP);
 
        vstr[++moves] = '1' + (char)c;
@@ -662,8 +628,7 @@ void process_move3 (int c)
        }
 }
 
-void game_reset ()
-{
+void game_reset () {
        stop_anim ();
 
        undo_action.set_enabled(false);
@@ -695,9 +660,7 @@ void game_reset ()
        }
 }
 
-void
-play_sound (SoundID id)
-{
+void play_sound (SoundID id) {
        string name;
 
        if (!p.do_sound)
@@ -750,8 +713,7 @@ class Animate {
        }
 }
 
-bool on_animate (int c = 0)
-{
+bool on_animate (int c = 0) {
        if (anim == AnimID.NONE)
                return false;
 
@@ -800,8 +762,7 @@ bool on_animate (int c = 0)
        return true;
 }
 
-bool on_key_press (Widget  w, Gdk.EventKey  e)
-{
+bool on_key_press (Widget  w, Gdk.EventKey  e) {
        if ((player_active) || timeout != 0 ||
                        (e.keyval != p.keypress[Move.LEFT] &&
                        e.keyval != p.keypress[Move.RIGHT] &&
@@ -826,9 +787,7 @@ bool on_key_press (Widget  w, Gdk.EventKey  e)
        return true;
 }
 
-void
-blink_winner (int n)
-{
+void blink_winner (int n) {
        /* blink the winner's line(s) n times */
 
        if (winner == NOBODY)
@@ -876,8 +835,7 @@ blink_winner (int n)
        }
 }
 
-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;
@@ -893,9 +851,7 @@ bool on_button_press (Gtk.Widget w, Gdk.EventButton e)
        return true;
 }
 
-void
-scorebox_update ()
-{
+void scorebox_update () {
        string s;
 
        if (scorebox == null)
@@ -920,14 +876,11 @@ scorebox_update ()
 
 }
 
-void on_settings_preferences (SimpleAction action, Variant? parameter)
-{
+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;
 
@@ -974,9 +927,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;
 
@@ -1047,14 +998,11 @@ 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 ()
-{
+void prompt_player () {
        int players = get_n_human_players ();
        bool human = is_player_human ();
        string who;
diff --git a/src/prefs.vala b/src/prefs.vala
index 5a279aa..9e10cfc 100644
--- a/src/prefs.vala
+++ b/src/prefs.vala
@@ -1,11 +1,8 @@
-//public const int DEFAULT_THEME_ID = 0;
-//extern int n_themes;
-
 struct Prefs {
-  bool do_sound;
-  int theme_id;
-  Level level[2];
-  int keypress[3];
+       bool do_sound;
+       int theme_id;
+       Level level[2];
+       int keypress[3];
 }
 
 Settings settings;
@@ -22,207 +19,189 @@ const uint DEFAULT_KEY_DROP = Gdk.Key.Down;
 const int DEFAULT_THEME_ID = 0;
 
 
-static int sane_theme_id (int val)
-{
-  if (val < 0 || val >= theme.length)
-    return DEFAULT_THEME_ID;
-  return 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)
-{
-  if (val < Level.HUMAN)
-    return Level.HUMAN;
-  if (val > Level.STRONG)
-    return Level.STRONG;
-  return val;
+public int sane_player_level (int val) {
+       if (val < Level.HUMAN)
+               return Level.HUMAN;
+       if (val > Level.STRONG)
+               return Level.STRONG;
+       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");
-  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");
-
-    settings.changed.connect(settings_changed_cb);
-  //g_signal_connect (settings, "changed", G_CALLBACK (settings_changed_cb), NULL);
-
-  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);
+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");
+
+       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);
 }
 
-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);
-  } else if (key == "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");
-  } else if (key == "key-drop") {
-    p.keypress[Move.DROP] = settings.get_int ( "key-drop");
-  } else if (key == "theme-id") {
-    int val;
-
-    val = sane_theme_id (settings.get_int ("theme-id"));
-    if (val != p.theme_id) {
-      p.theme_id = val;
-      if (!Gfx.change_theme ())
-        return;
-      if (prefsbox == null)
-        return;
-      ((Gtk.ComboBox)combobox_theme).set_active (p.theme_id);
-    }
-  }
+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);
+       } else if (key == "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");
+       } else if (key == "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"));
+               if (val != p.theme_id) {
+                       p.theme_id = val;
+                       if (!Gfx.change_theme ())
+                               return;
+               if (prefsbox == null)
+                       return;
+               combobox_theme.set_active (p.theme_id);
+               }
+       }
 }
 
-public void on_select_opponent (Gtk.ComboBox w)
-{
-  Gtk.TreeIter iter;
-  int value;
+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 ();
-  who_starts = PlayerID.PLAYER2;               /* This gets reversed in game_reset. */
-  game_reset ();
+       p.level[PlayerID.PLAYER2] = (Level)value;
+       settings.set_int ("opponent", value);
+       scorebox_reset ();
+       who_starts = PlayerID.PLAYER2;          /* This gets reversed in game_reset. */
+       game_reset ();
 }
 
-[CCode(cheader_filename="config.h")]
-public void prefsbox_open ()
-{
-    Gtk.Notebook notebook;
-    Gtk.Grid grid;
-    // GtkWidget *controls_list;
-    Gtk.Label label;
-    Gtk.CellRendererText renderer;
-    Gtk.ListStore model;
-    Gtk.TreeIter iter;
-    // gint i;
-
-    if (prefsbox != null) {
-        ((Gtk.Window)prefsbox).present ();
-        return;
-    }
-
-    prefsbox = new Gtk.Dialog.with_buttons (_("Preferences"),
-                                         window,
-                                         Gtk.DialogFlags.DESTROY_WITH_PARENT);
-
-    prefsbox.set_border_width(5);
-    prefsbox.get_content_area().set_spacing(2);
-
-  // g_signal_connect (G_OBJECT (prefsbox), "destroy",
-               //     G_CALLBACK (gtk_widget_destroyed), &prefsbox);
-
-    notebook = new Gtk.Notebook();
-    notebook.set_border_width(5);
-    prefsbox.get_content_area().pack_start(notebook, true, true, 0);
-
-    /* game tab */
-
-    grid = new Gtk.Grid();
-    grid.set_row_spacing(6);
-    grid.set_column_spacing(12);
-    grid.set_border_width(12);
-
-    label = new Gtk.Label(_("Game"));
-    notebook.append_page(grid, label);
-
-    label = new Gtk.Label(_("Opponent:"));
-    label.set_hexpand(true);
-    grid.attach(label,0,0 ,1, 1);
-
-    combobox = new Gtk.ComboBox();
-    renderer = new Gtk.CellRendererText();
-    combobox.pack_start(renderer, true);
-    combobox.add_attribute(renderer, "text", 0);
-    model = new Gtk.ListStore(2, typeof(string), typeof(int));
-    combobox.set_model(model);
-    model.append(out iter);
-    model.set(iter, 0, _("Human"), 1, Level.HUMAN);
-    if (p.level[PlayerID.PLAYER2] == Level.HUMAN)
-        combobox.set_active_iter(iter);
-    model.append(out iter);
-    model.set(iter, 0, _("Level one"), 1, Level.WEAK);
-    if (p.level[PlayerID.PLAYER2] == Level.WEAK)
-        combobox.set_active_iter(iter);
-    model.append(out iter);
-    model.set(iter, 0, _("Level two"), 1, Level.MEDIUM);
-    if (p.level[PlayerID.PLAYER2] == Level.MEDIUM)
-        combobox.set_active_iter(iter);
-    model.append(out iter);
-    model.set(iter, 0, _("Level thre"), 1, Level.STRONG);
-    if (p.level[PlayerID.PLAYER2] == Level.STRONG)
-        combobox.set_active_iter(iter);
-
-    combobox.changed.connect(on_select_opponent);
-    grid.attach(combobox, 1, 0, 1, 1);
-
-    label = new Gtk.Label.with_mnemonic(_("_Theme:"));
-    label.set_xalign((float)0.0);
-    label.set_yalign((float)0.5);
-    grid.attach(label, 0, 1, 1, 1);
-
-    combobox_theme = new Gtk.ComboBoxText();
-    for (int i = 0; i < theme.length; i++) {
-        combobox_theme.append_text(_(theme_get_title(i)));
-    }
-    label.set_mnemonic_widget(combobox_theme);
-    grid.attach(combobox_theme, 1, 1, 1, 1);
-
-    checkbutton_sound = new Gtk.CheckButton.with_mnemonic(_("E_nable sounds"));
-    grid.attach(checkbutton_sound, 0, 2, 2, 1);
-
-    /* keyboard tab */
-
-    label = new Gtk.Label.with_mnemonic (_("Keyboard Controls"));
-
-
-  // controls_list = games_controls_list_new (settings);
-  // games_controls_list_add_controls (GAMES_CONTROLS_LIST (controls_list),
-               //                  "key-left", _("Move left"), DEFAULT_KEY_LEFT,
-  //                                   "key-right", _("Move right"), DEFAULT_KEY_RIGHT,
-               //                  "key-drop", _("Drop marble"), DEFAULT_KEY_DROP,
-  //                                   NULL);
-  // gtk_container_set_border_width (GTK_CONTAINER (controls_list), 12);
-  // gtk_notebook_append_page (GTK_NOTEBOOK (notebook), controls_list, label);
-
-    /* fill in initial values */
-
-    combobox_theme.set_active(p.theme_id);
-    checkbutton_sound.set_active(p.do_sound);
-
-    /* connect signals */
-
-    //prefsbox.response.connect(on_dialog_close);
-  // g_signal_connect (prefsbox, "response", G_CALLBACK (on_dialog_close),
+public void prefsbox_open () {
+       Gtk.Notebook notebook;
+       Gtk.Grid grid;
+       GamesControlsList controls_list;
+       Gtk.Label label;
+       Gtk.CellRendererText renderer;
+       Gtk.ListStore model;
+       Gtk.TreeIter iter;
+       // gint i;
+
+       if (prefsbox != null) {
+               prefsbox.present ();
+               return;
+       }
+
+       prefsbox = new Gtk.Dialog.with_buttons (_("Preferences"),
+                                               window,
+                                               Gtk.DialogFlags.DESTROY_WITH_PARENT);
+
+       prefsbox.set_border_width(5);
+       prefsbox.get_content_area().set_spacing(2);
+
+       notebook = new Gtk.Notebook();
+       notebook.set_border_width(5);
+       prefsbox.get_content_area().pack_start(notebook, true, true, 0);
+
+       /* game tab */
+
+       grid = new Gtk.Grid();
+       grid.set_row_spacing(6);
+       grid.set_column_spacing(12);
+       grid.set_border_width(12);
+
+       label = new Gtk.Label(_("Game"));
+       notebook.append_page(grid, label);
+
+       label = new Gtk.Label(_("Opponent:"));
+       label.set_hexpand(true);
+       grid.attach(label,0,0 ,1, 1);
+
+       combobox = new Gtk.ComboBox();
+       renderer = new Gtk.CellRendererText();
+       combobox.pack_start(renderer, true);
+       combobox.add_attribute(renderer, "text", 0);
+       model = new Gtk.ListStore(2, typeof(string), typeof(int));
+       combobox.set_model(model);
+       model.append(out iter);
+       model.set(iter, 0, _("Human"), 1, Level.HUMAN);
+       if (p.level[PlayerID.PLAYER2] == Level.HUMAN)
+               combobox.set_active_iter(iter);
+       model.append(out iter);
+       model.set(iter, 0, _("Level one"), 1, Level.WEAK);
+       if (p.level[PlayerID.PLAYER2] == Level.WEAK)
+               combobox.set_active_iter(iter);
+       model.append(out iter);
+       model.set(iter, 0, _("Level two"), 1, Level.MEDIUM);
+       if (p.level[PlayerID.PLAYER2] == Level.MEDIUM)
+               combobox.set_active_iter(iter);
+       model.append(out iter);
+       model.set(iter, 0, _("Level thre"), 1, Level.STRONG);
+       if (p.level[PlayerID.PLAYER2] == Level.STRONG)
+               combobox.set_active_iter(iter);
+
+       combobox.changed.connect(on_select_opponent);
+       grid.attach(combobox, 1, 0, 1, 1);
+
+       label = new Gtk.Label.with_mnemonic(_("_Theme:"));
+       label.set_xalign((float)0.0);
+       label.set_yalign((float)0.5);
+       grid.attach(label, 0, 1, 1, 1);
+
+       combobox_theme = new Gtk.ComboBoxText();
+       for (int i = 0; i < theme.length; i++) {
+               combobox_theme.append_text(_(theme_get_title(i)));
+       }
+       label.set_mnemonic_widget(combobox_theme);
+       grid.attach(combobox_theme, 1, 1, 1, 1);
+
+       checkbutton_sound = new Gtk.CheckButton.with_mnemonic(_("E_nable sounds"));
+       grid.attach(checkbutton_sound, 0, 2, 2, 1);
+
+       /* keyboard tab */
+
+       label = new Gtk.Label.with_mnemonic (_("Keyboard Controls"));
+
+       controls_list = new GamesControlsList(settings);
+       controls_list.add_controls("key-left", _("Move left"), DEFAULT_KEY_LEFT,
+                                  "key-right", _("Move right"), DEFAULT_KEY_RIGHT,
+                                  "key-drop", _("Drop marble"), DEFAULT_KEY_DROP);
+       controls_list.border_width = 12;
+       notebook.append_page(controls_list, label);
+
+       /* fill in initial values */
+
+       combobox_theme.set_active(p.theme_id);
+       checkbutton_sound.set_active(p.do_sound);
+
+       /* connect signals */
+
+       //prefsbox.response.connect(on_dialog_close);
+       // g_signal_connect (prefsbox, "response", G_CALLBACK (on_dialog_close),
                //     &prefsbox);
 
-    combobox_theme.changed.connect(on_select_theme);
+       combobox_theme.changed.connect(on_select_theme);
 
-    checkbutton_sound.toggled.connect(on_toggle_sound);
+       checkbutton_sound.toggled.connect(on_toggle_sound);
 
-    prefsbox.show_all();
+       prefsbox.show_all();
 }
diff --git a/src/theme.vala b/src/theme.vala
index 38588f6..ffcda65 100644
--- a/src/theme.vala
+++ b/src/theme.vala
@@ -31,56 +31,56 @@ string theme_get_player_win (PlayerID who) {
 }
 
 string theme_get_player (PlayerID who) {
-  if (who == PlayerID.PLAYER1)
-    return theme[p.theme_id].player1;
-  return theme[p.theme_id].player2;
+       if (who == PlayerID.PLAYER1)
+               return theme[p.theme_id].player1;
+       return theme[p.theme_id].player2;
 }
 
 
 const Theme theme[] = {
-  {
-   N_("High Contrast"),
-   "tileset_50x50_hcontrast.svg",
-   null,
-   "#000000",
-   N_("Circle"), N_("Cross"),
-   N_("Circle wins!"), N_("Cross wins!"),
-   N_("Circle’s turn"), N_("Cross’s turn")
-   },
-  {
-   N_("High Contrast Inverse"),
-   "tileset_50x50_hcinverse.svg",
-   null,
-   "#FFFFFF",
-   N_("Circle"), N_("Cross"),
-   N_("Circle wins!"), N_("Cross wins!"),
-   N_("Circle’s turn"), N_("Cross’s turn")
-   },
-  {
-   N_("Red and Green Marbles"),
-   "tileset_50x50_faenza-glines-icon1.svg",
-   "bg_toplight.png",
-   "#727F8C",
-   N_("Red"), N_("Green"),
-   N_("Red wins!"), N_("Green wins!"),
-   N_("Red’s turn"), N_("Green’s turn")
-   },
-  {
-   N_("Blue and Red Marbles"),
-   "tileset_50x50_faenza-glines-icon2.svg",
-   "bg_toplight.png",
-   "#727F8C",
-   N_("Blue"), N_("Red"),
-   N_("Blue wins!"), N_("Red wins!"),
-   N_("Blue’s turn"), N_("Red’s turn")
-   },
-  {
-   N_("Stars and Rings"),
-   "tileset_50x50_faenza-gnect-icon.svg",
-   "bg_toplight.png",
-   "#727F8C",
-   N_("Red"), N_("Green"),
-   N_("Red wins!"), N_("Green wins!"),
-   N_("Red’s turn"), N_("Green’s turn")
-   }
+       {
+               N_("High Contrast"),
+               "tileset_50x50_hcontrast.svg",
+               null,
+               "#000000",
+               N_("Circle"), N_("Cross"),
+               N_("Circle wins!"), N_("Cross wins!"),
+               N_("Circle’s turn"), N_("Cross’s turn")
+       },
+       {
+               N_("High Contrast Inverse"),
+               "tileset_50x50_hcinverse.svg",
+               null,
+               "#FFFFFF",
+               N_("Circle"), N_("Cross"),
+               N_("Circle wins!"), N_("Cross wins!"),
+               N_("Circle’s turn"), N_("Cross’s turn")
+       },
+       {
+               N_("Red and Green Marbles"),
+               "tileset_50x50_faenza-glines-icon1.svg",
+               "bg_toplight.png",
+               "#727F8C",
+               N_("Red"), N_("Green"),
+               N_("Red wins!"), N_("Green wins!"),
+               N_("Red’s turn"), N_("Green’s turn")
+       },
+       {
+               N_("Blue and Red Marbles"),
+               "tileset_50x50_faenza-glines-icon2.svg",
+               "bg_toplight.png",
+               "#727F8C",
+               N_("Blue"), N_("Red"),
+               N_("Blue wins!"), N_("Red wins!"),
+               N_("Blue’s turn"), N_("Red’s turn")
+       },
+       {
+               N_("Stars and Rings"),
+               "tileset_50x50_faenza-gnect-icon.svg",
+               "bg_toplight.png",
+               "#727F8C",
+               N_("Red"), N_("Green"),
+               N_("Red wins!"), N_("Green wins!"),
+               N_("Red’s turn"), N_("Green’s turn")
+       }
 };



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