[gnome-mines] Code Cleanup
- From: Sahil Sareen <ssareen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mines] Code Cleanup
- Date: Sat, 28 Feb 2015 09:41:50 +0000 (UTC)
commit 56900de853ced9c943d5c31b5b635f2e44a32001
Author: Sahil Sareen <sahil sareen hotmail com>
Date: Sat Feb 28 15:10:27 2015 +0530
Code Cleanup
src/gnome-mines.vala | 4 ++--
src/minefield-view.vala | 34 +++++++++++++++++-----------------
src/minefield.vala | 10 +++++-----
src/theme-selector-dialog.vala | 2 +-
src/tile.vala | 18 +++++++++---------
5 files changed, 34 insertions(+), 34 deletions(-)
---
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 58de877..d07aa2a 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -416,7 +416,7 @@ public class Mines : Gtk.Application
private bool window_focus_in_event_cb (Gdk.EventFocus event)
{
- if (minefield != null && !pause_requested &&
+ if (minefield != null && !pause_requested &&
(theme_dialog == null || theme_dialog.visible == false))
minefield.paused = false;
@@ -497,7 +497,7 @@ public class Mines : Gtk.Application
private int show_theme_selector ()
{
- theme_dialog = new ThemeSelectorDialog ( window );
+ theme_dialog = new ThemeSelectorDialog (window);
var result = theme_dialog.run ();
theme_dialog.destroy ();
diff --git a/src/minefield-view.vala b/src/minefield-view.vala
index 633efb4..f5ccc5b 100644
--- a/src/minefield-view.vala
+++ b/src/minefield-view.vala
@@ -134,7 +134,7 @@ public class MinefieldView : Gtk.Grid
return int.min (get_allocated_width () / (int) minefield.width, get_allocated_height () / (int)
minefield.height);
}
}
-
+
private uint minimum_size
{
get
@@ -164,15 +164,15 @@ public class MinefieldView : Gtk.Grid
get_style_context ().add_class ("minefield");
selected = new Position ();
- selected.set_x.connect ( (x) => { return x; });
- selected.set_y.connect ( (y) => { return y; });
+ selected.set_x.connect ((x) => { return x; });
+ selected.set_y.connect ((y) => { return y; });
selected.redraw.connect (redraw_sector_cb);
keyboard_cursor = new Position ();
keyboard_cursor.redraw.connect (redraw_sector_cb);
- keyboard_cursor.validate.connect ( (x, y) => { return true; });
+ keyboard_cursor.validate.connect ((x, y) => { return true; });
}
-
+
private Minefield _minefield;
public Minefield minefield
{
@@ -187,32 +187,32 @@ public class MinefieldView : Gtk.Grid
get_style_context ().remove_class ("explodedField");
get_style_context ().remove_class ("completedField");
mines = new Tile[_minefield.width, _minefield.height];
- forall ( (child) => { remove (child);});
+ forall ((child) => { remove (child); });
for (int i = 0; i < _minefield.width; i++)
{
for (int j = 0; j < _minefield.height; j++)
{
mines[i,j] = new Tile (i, j);
mines[i,j].show ();
- mines[i,j].tile_mouse_over.connect ( (x, y) => { tile_mouse_over_cb (x, y); });
- mines[i,j].tile_pressed.connect ( (x, y, event) => { tile_pressed_cb (x, y, event); });
- mines[i,j].tile_released.connect ( (x, y, event) => { tile_released_cb (x, y, event); });
+ mines[i,j].tile_mouse_over.connect ((x, y) => { tile_mouse_over_cb (x, y); });
+ mines[i,j].tile_pressed.connect ((x, y, event) => { tile_pressed_cb (x, y, event); });
+ mines[i,j].tile_released.connect ((x, y, event) => { tile_released_cb (x, y, event); });
add (mines[i,j], i, j);
}
}
selected.is_set = false;
- selected.redraw.connect ( (x, y) => { if (_minefield.is_cleared (x, y)) redraw_adjacent (x, y);
});
+ selected.redraw.connect ((x, y) => { if (_minefield.is_cleared (x, y)) redraw_adjacent (x, y);
});
selected.validate.connect (_minefield.is_location);
keyboard_cursor.is_set = false;
keyboard_cursor.position = {0, 0};
- keyboard_cursor.set_x.connect ( (x) => { return x; }); // (int) (x % _minefield.width); });
- keyboard_cursor.set_y.connect ( (y) => { return y; }); // (int) (y % _minefield.height); });
+ keyboard_cursor.set_x.connect ((x) => { return x; }); // (int) (x % _minefield.width); });
+ keyboard_cursor.set_y.connect ((y) => { return y; }); // (int) (y % _minefield.height); });
_minefield.redraw_sector.connect (redraw_sector_cb);
_minefield.explode.connect (explode_cb);
- _minefield.paused_changed.connect ( () => { queue_draw (); });
+ _minefield.paused_changed.connect (() => { queue_draw (); });
_minefield.cleared.connect (complete_cb);
queue_resize ();
}
@@ -401,7 +401,7 @@ public class MinefieldView : Gtk.Grid
{
mines[x,y].add_class ("mine");
}
-
+
}
}
@@ -487,7 +487,7 @@ public class MinefieldView : Gtk.Grid
if (n_mines == n_flags)
do_clear = true;
else if (use_autoflag && n_unknown == n_mines)
- do_clear = false;
+ do_clear = false;
else
return;
@@ -500,7 +500,7 @@ public class MinefieldView : Gtk.Grid
var ny = (int) y + neighbour.y;
if (!m.is_location (nx, ny))
continue;
-
+
if (do_clear && m.get_flag (nx, ny) != FlagType.FLAG)
m.clear_mine (nx, ny);
else
@@ -590,7 +590,7 @@ public class MinefieldView : Gtk.Grid
return true;
}
- public void refresh()
+ public void refresh ()
{
if (_minefield != null)
for (int i = 0; i < _minefield.width; i++)
diff --git a/src/minefield.vala b/src/minefield.vala
index 81e2046..413353d 100644
--- a/src/minefield.vala
+++ b/src/minefield.vala
@@ -19,7 +19,7 @@ protected class Location : Object
{
/* true if contains a mine */
public bool has_mine = false;
-
+
/* true if cleared */
public bool cleared = false;
@@ -50,7 +50,7 @@ public class Minefield : Object
/* Size of map */
public uint width = 0;
public uint height = 0;
-
+
/* Number of mines in map */
public uint n_mines = 0;
@@ -146,7 +146,7 @@ public class Minefield : Object
{
return elapsed > 0;
}
-
+
public bool has_mine (uint x, uint y)
{
return locations[x, y].has_mine;
@@ -255,7 +255,7 @@ public class Minefield : Object
marks_changed ();
}
-
+
public FlagType get_flag (uint x, uint y)
{
return locations[x, y].flag;
@@ -302,7 +302,7 @@ public class Minefield : Object
{
var rx = Random.int_range (0, (int32) width);
var ry = Random.int_range (0, (int32) height);
-
+
if (rx == x && ry == y)
continue;
diff --git a/src/theme-selector-dialog.vala b/src/theme-selector-dialog.vala
index 4fc253c..28852fc 100644
--- a/src/theme-selector-dialog.vala
+++ b/src/theme-selector-dialog.vala
@@ -74,7 +74,7 @@ public class ThemeSelectorDialog : Gtk.Dialog
return frame;
}
- public ThemeSelectorDialog ( Gtk.Window parent )
+ public ThemeSelectorDialog (Gtk.Window parent)
{
var desktop = Environment.get_variable ("XDG_CURRENT_DESKTOP");
bool use_headerbar = desktop == null || desktop != "Unity";
diff --git a/src/tile.vala b/src/tile.vala
index d003b6a..6ead583 100644
--- a/src/tile.vala
+++ b/src/tile.vala
@@ -20,7 +20,7 @@ public class Tile : Gtk.Button
get { return _column; }
}
- public void refresh_icon()
+ public void refresh_icon ()
{
string name;
Gtk.IconSize size;
@@ -38,25 +38,25 @@ public class Tile : Gtk.Button
can_focus = false;
add_class ("tile");
set_image (scaling_image);
- enter_notify_event.connect ( (event) =>
+ enter_notify_event.connect ((event) =>
{
tile_mouse_over (prow, pcol);
return false;
- } );
- size_allocate.connect ( (allocation) =>
+ });
+ size_allocate.connect ((allocation) =>
{
scaling_image.set_pixel_size (allocation.height/3*2);
- } );
- button_press_event.connect ( (event) =>
+ });
+ button_press_event.connect ((event) =>
{
tile_pressed (prow, pcol, event);
return false;
- } );
- button_release_event.connect ( (event) =>
+ });
+ button_release_event.connect ((event) =>
{
tile_released (prow, pcol, event);
return false;
- } );
+ });
}
public void add_class (string style_class)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]