[gnome-klotski] Use internal.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-klotski] Use internal.
- Date: Wed, 5 Feb 2020 17:12:25 +0000 (UTC)
commit 8f0c325c55decb272a148ef5598da0ae0fe5af21
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Feb 5 15:05:13 2020 +0100
Use internal.
src/gnome-klotski.vala | 6 +++---
src/klotski-window.vala | 6 +++---
src/puzzle-view.vala | 10 +++++-----
src/puzzle.vala | 37 +++++++++++++++++++------------------
4 files changed, 30 insertions(+), 29 deletions(-)
---
diff --git a/src/gnome-klotski.vala b/src/gnome-klotski.vala
index ff0e54d..45e27f7 100644
--- a/src/gnome-klotski.vala
+++ b/src/gnome-klotski.vala
@@ -19,7 +19,7 @@
using Gtk;
-public class Klotski : Gtk.Application
+private class Klotski : Gtk.Application
{
private const OptionEntry [] option_entries =
{
@@ -39,7 +39,7 @@ public class Klotski : Gtk.Application
* * Application init
\*/
- public static int main (string [] args)
+ private static int main (string [] args)
{
Intl.setlocale (LocaleCategory.ALL, "");
Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
@@ -50,7 +50,7 @@ public class Klotski : Gtk.Application
return app.run (args);
}
- public Klotski ()
+ private Klotski ()
{
Object (application_id: "org.gnome.Klotski", flags: ApplicationFlags.FLAGS_NONE);
diff --git a/src/klotski-window.vala b/src/klotski-window.vala
index 415bca2..701a695 100644
--- a/src/klotski-window.vala
+++ b/src/klotski-window.vala
@@ -30,7 +30,7 @@ private struct LevelInfo
}
[GtkTemplate (ui = "/org/gnome/Klotski/ui/klotski.ui")]
-public class KlotskiWindow : ApplicationWindow
+private class KlotskiWindow : ApplicationWindow
{
/* Settings */
private GLib.Settings settings;
@@ -512,7 +512,7 @@ public class KlotskiWindow : ApplicationWindow
category = score_categories[level];
}
- public KlotskiWindow ()
+ internal KlotskiWindow ()
{
var css_provider = new CssProvider ();
css_provider.load_from_resource ("/org/gnome/Klotski/ui/klotski.css");
@@ -841,7 +841,7 @@ public class KlotskiWindow : ApplicationWindow
});
}
- public void show_scores ()
+ internal void show_scores ()
{
scores_context.run_dialog ();
}
diff --git a/src/puzzle-view.vala b/src/puzzle-view.vala
index 3cc922f..605a634 100644
--- a/src/puzzle-view.vala
+++ b/src/puzzle-view.vala
@@ -17,7 +17,7 @@
with GNOME Klotski. If not, see <https://www.gnu.org/licenses/>.
*/
-public class PuzzleView : Gtk.DrawingArea
+private class PuzzleView : Gtk.DrawingArea
{
private const int SPACE_OFFSET = 4;
private const int SPACE_PADDING = 5;
@@ -49,10 +49,10 @@ public class PuzzleView : Gtk.DrawingArea
private Cairo.Surface surface = null;
private Puzzle? _puzzle = null;
- public Puzzle? puzzle
+ internal Puzzle? puzzle
{
- get { return _puzzle; }
- set
+ private get { return _puzzle; }
+ internal set
{
if (_puzzle != null)
SignalHandler.disconnect_by_func (_puzzle, null, this);
@@ -77,7 +77,7 @@ public class PuzzleView : Gtk.DrawingArea
}
}
- public PuzzleView ()
+ internal PuzzleView ()
{
set_size_request (250, 250); // TODO enough? Taquin is in 350^2
set_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.BUTTON_PRESS_MASK |
Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK);
diff --git a/src/puzzle.vala b/src/puzzle.vala
index c2e9015..2dd8ac8 100644
--- a/src/puzzle.vala
+++ b/src/puzzle.vala
@@ -17,7 +17,7 @@
with GNOME Klotski. If not, see <https://www.gnu.org/licenses/>.
*/
-public class Puzzle : Object
+private class Puzzle : Object
{
/*
1 2 4
@@ -102,21 +102,22 @@ public class Puzzle : Object
-1, -1
};
- public int width;
- public int height;
+ [CCode (notify = false)] internal int width { internal get; private set; }
+ [CCode (notify = false)] internal int height { internal get; private set; }
- public char[] map;
- public char[] move_map;
- public char[] orig_map;
- public char[] lastmove_map;
- public char[] undomove_map;
+ // Type `char []' can not be used for a GLib.Object property
+ internal char [] map;
+ internal char [] move_map;
+ internal char [] orig_map;
+ internal char [] lastmove_map;
+ internal char [] undomove_map;
- public int moves = 0;
+ [CCode (notify = false)] internal int moves { internal get; internal set; default = 0; }
- public signal void changed ();
- public signal void moved ();
+ internal signal void changed ();
+ internal signal void moved ();
- public Puzzle (int width, int height, string? data)
+ internal Puzzle (int width, int height, string? data)
{
this.width = width;
this.height = height;
@@ -139,7 +140,7 @@ public class Puzzle : Object
lastmove_map = map;
}
- public char get_piece_id (char[] src, int x, int y)
+ internal char get_piece_id (char[] src, int x, int y)
{
return src[x + 1 + (y + 1) * (width + 2)];
}
@@ -149,7 +150,7 @@ public class Puzzle : Object
src[x + 1 + (y + 1) * (width + 2)] = id;
}
- public int get_piece_nr (int x, int y)
+ internal int get_piece_nr (int x, int y)
{
x++;
y++;
@@ -187,7 +188,7 @@ public class Puzzle : Object
return image_map[i + 1];
}
- public bool game_over ()
+ internal bool game_over ()
{
var over = true;
for (var y = 0; y < height; y++)
@@ -197,7 +198,7 @@ public class Puzzle : Object
return over;
}
- public bool mapcmp (char[] m1, char[] m2)
+ internal bool mapcmp (char[] m1, char[] m2)
{
for (var y = 0; y < height; y++)
for (var x = 0; x < width; x++)
@@ -206,14 +207,14 @@ public class Puzzle : Object
return false;
}
- public bool movable (int id)
+ internal bool movable (int id)
{
if (id == '#' || id == '.' || id == ' ' || id == '-')
return false;
return true;
}
- public bool move_piece (char id, int x1, int y1, int x2, int y2)
+ internal bool move_piece (char id, int x1, int y1, int x2, int y2)
{
var return_value = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]