[swell-foop/arnaudb/code-improvements: 7/9] Add comments for translators.



commit 7706c409376b8de7e4dbd9455e9998d27936b906
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat May 2 16:16:00 2020 +0200

    Add comments for translators.
    
    And other cleanings.

 data/first-run-stack.ui |  3 ++
 data/preferences.ui     | 78 ++++++++++++++++++++-----------------------------
 src/game-view.vala      | 76 ++++++++++++++++++++++++-----------------------
 src/game.vala           | 64 ++++++++++++++++++++--------------------
 src/history.vala        | 36 ++++++++++-------------
 src/score-dialog.vala   | 14 +++++++--
 src/swell-foop.vala     | 53 +++++++++++++++++++++++----------
 src/window.vala         | 23 ++++++++++-----
 8 files changed, 184 insertions(+), 163 deletions(-)
---
diff --git a/data/first-run-stack.ui b/data/first-run-stack.ui
index ee9a91c..fe280b7 100644
--- a/data/first-run-stack.ui
+++ b/data/first-run-stack.ui
@@ -39,6 +39,7 @@
         <child>
           <object class="GtkLabel">
             <property name="visible">True</property>
+            <!-- Translators: text appearing on the first-run screen; to test, run `gsettings set 
org.gnome.swell-foop first-run true` before launching application -->
             <property name="label" translatable="yes">Welcome to Swell Foop</property>
             <style>
               <class name="welcome"/>
@@ -48,6 +49,7 @@
         <child>
           <object class="GtkLabel" id="tip_label">
             <property name="visible">True</property>
+            <!-- label cannot be set there because it is multi-line; see window.vala -->
             <property name="justify">center</property>
             <style>
               <class name="tip"/>
@@ -58,6 +60,7 @@
           <object class="GtkButton" id="play_button">
             <property name="visible">True</property>
             <property name="use-underline">True</property>
+            <!-- Translators: label of the button of the first-run screen; to test, run `gsettings set 
org.gnome.swell-foop first-run true` before launching application -->
             <property name="label" translatable="yes">Let’s _Play</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
diff --git a/data/preferences.ui b/data/preferences.ui
index 6baca7e..6290b74 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -7,64 +7,49 @@
     <property name="upper">4</property>
     <property name="step_increment">1</property>
   </object>
-  <object class="GtkAdjustment" id="columns-adjustment">
-    <property name="lower">3</property>
-    <property name="upper">21</property>
-    <property name="step_increment">1</property>
-  </object>
-  <object class="GtkListStore" id="liststore1">
-    <columns>
-      <!-- column-name str -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
-  <object class="GtkListStore" id="liststore2">
-    <columns>
-      <!-- column-name str -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
   <object class="GtkDialog" id="preferences">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="use_header_bar">1</property>
+    <!-- Translators: title of the Preferences dialog -->
     <property name="title" translatable="yes">Preferences</property>
     <property name="icon_name">gnome-swell-foop</property>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+      <object class="GtkBox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
-          <object class="GtkBox" id="box1">
+          <object class="GtkBox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="border_width">5</property>
             <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <child>
-              <object class="GtkFrame" id="frame3">
+              <object class="GtkFrame">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment3">
+                  <object class="GtkAlignment">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_start">12</property>
                     <child>
-                      <object class="GtkGrid" id="grid1">
+                      <object class="GtkGrid">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="row_spacing">6</property>
                         <property name="column_spacing">10</property>
                         <child>
-                          <object class="GtkLabel" id="label3">
+                          <object class="GtkLabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
+                            <!-- Translators: in the Preferences dialog, text of the label that introduces 
the combobox for choosing the board size -->
                             <property name="label" translatable="yes">_Board size:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">size-selector</property>
@@ -77,10 +62,11 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label9">
+                          <object class="GtkLabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
+                            <!-- Translators: in the Preferences dialog, text of the label that introduces 
the combobox for choosing the number of colors -->
                             <property name="label" translatable="yes">_Number of colors:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">colors-spinner</property>
@@ -96,10 +82,10 @@
                           <object class="GtkComboBox" id="size-selector">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="model">size_model</property>
+                            <property name="model">size-model</property>
                             <signal name="changed" handler="update_size" swapped="no"/>
                             <child>
-                              <object class="GtkCellRendererText" id="size_cellrenderer"/>
+                              <object class="GtkCellRendererText"/>
                               <attributes>
                                 <attribute name="text">0</attribute>
                               </attributes>
@@ -134,11 +120,12 @@
                   </object>
                 </child>
                 <child type="label">
-                  <object class="GtkLabel" id="label5">
+                  <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_top">5</property>
                     <property name="margin_bottom">5</property>
+                    <!-- Translators: in the Preferences dialog, name of the section in which there are 
settings for board size and number of colors -->
                     <property name="label" translatable="yes">Setup</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -153,30 +140,31 @@
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="frame1">
+              <object class="GtkFrame">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment1">
+                  <object class="GtkAlignment">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_start">12</property>
                     <child>
-                      <object class="GtkBox" id="box3">
+                      <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="orientation">vertical</property>
                         <child>
-                          <object class="GtkBox" id="box4">
+                          <object class="GtkBox">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="spacing">6</property>
                             <child>
-                              <object class="GtkLabel" id="label1">
+                              <object class="GtkLabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <!-- Translators: in the Preferences dialog, text of the label that 
introduces the combobox for choosing the theme -->
                                 <property name="label" translatable="yes">_Theme:</property>
                                 <property name="use_underline">True</property>
                                 <property name="mnemonic_widget">theme-selector</property>
@@ -191,10 +179,10 @@
                               <object class="GtkComboBox" id="theme-selector">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="model">theme_model</property>
+                                <property name="model">theme-model</property>
                                 <signal name="changed" handler="select_theme" swapped="no"/>
                                 <child>
-                                  <object class="GtkCellRendererText" id="theme_cellrenderer"/>
+                                  <object class="GtkCellRendererText"/>
                                   <attributes>
                                     <attribute name="text">0</attribute>
                                   </attributes>
@@ -219,11 +207,12 @@
                   </object>
                 </child>
                 <child type="label">
-                  <object class="GtkLabel" id="label2">
+                  <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_top">5</property>
                     <property name="margin_bottom">5</property>
+                    <!-- Translators: in the Preferences dialog, name of the section in which there is the 
theme option -->
                     <property name="label" translatable="yes">Appearance</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -238,23 +227,24 @@
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="frame2">
+              <object class="GtkFrame">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GtkAlignment" id="alignment2">
+                  <object class="GtkAlignment">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_start">12</property>
                     <child>
-                      <object class="GtkBox" id="box2">
+                      <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkCheckButton" id="zealous-checkbox">
+                            <!-- Translators: in the Preferences dialog, text of the fast-animation checkbox 
-->
                             <property name="label" translatable="yes">_Zealous Animation</property>
                             <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
@@ -275,11 +265,12 @@
                   </object>
                 </child>
                 <child type="label">
-                  <object class="GtkLabel" id="label8">
+                  <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_top">5</property>
                     <property name="margin_bottom">5</property>
+                    <!-- Translators: in the Preferences dialog, name of the section in which there is the 
fast-animation option -->
                     <property name="label" translatable="yes">Operation</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -303,12 +294,7 @@
       </object>
     </child>
   </object>
-  <object class="GtkAdjustment" id="rows-adjustment">
-    <property name="lower">3</property>
-    <property name="upper">21</property>
-    <property name="step_increment">1</property>
-  </object>
-  <object class="GtkListStore" id="size_model">
+  <object class="GtkListStore" id="size-model">
     <columns>
       <!-- column-name label -->
       <column type="gchararray"/>
@@ -316,7 +302,7 @@
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkListStore" id="theme_model">
+  <object class="GtkListStore" id="theme-model">
     <columns>
       <!-- column-name label -->
       <column type="gchararray"/>
diff --git a/src/game-view.vala b/src/game-view.vala
index 262d2a2..decabbd 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -17,24 +17,24 @@
 
 using Config;
 
-public class GameView : Clutter.Group
+private class GameView : Clutter.Group
 {
     private TileActor highlighted = null;
 
     private CursorActor cursor;
     private bool cursor_active = false;
     private int _cursor_x;
-    public int cursor_x
+    private int cursor_x
     {
-        get { return this._cursor_x; }
-        set { this._cursor_x = value.clamp (0, game.columns - 1); }
+        private get { return this._cursor_x; }
+        private set { this._cursor_x = value.clamp (0, game.columns - 1); }
     }
 
     private int _cursor_y;
-    public int cursor_y
+    private int cursor_y
     {
-        get { return this._cursor_y; }
-        set { this._cursor_y = value.clamp (0, game.rows - 1); }
+        private get { return this._cursor_y; }
+        private set { this._cursor_y = value.clamp (0, game.rows - 1); }
     }
 
     /* A 2D array holding all tiles */
@@ -45,10 +45,10 @@ public class GameView : Clutter.Group
 
     /* Game being played */
     private Game? _game = null;
-    public Game? game
+    internal Game? game
     {
-        get { return _game; }
-        set
+        private get { return _game; }
+        internal set
         {
             if (game_actors != null)
                 game_actors.destroy ();
@@ -78,10 +78,10 @@ public class GameView : Clutter.Group
 
     /* Theme being used */
     private string _theme_name = "shapesandcolors";
-    public string theme_name
+    internal string theme_name
     {
-        get { return _theme_name; }
-        set
+        private get { return _theme_name; }
+        internal set
         {
             if (theme_name == value)
                 return;
@@ -163,9 +163,9 @@ public class GameView : Clutter.Group
         cursor.hide ();
     }
 
-    public bool is_zealous;
+    internal bool is_zealous { private get; internal set; }
 
-    public GameView ()
+    internal GameView ()
     {
         /* Initialize the theme resources */
         themes = new HashTable<string, Theme> (str_hash, str_equal);
@@ -177,13 +177,13 @@ public class GameView : Clutter.Group
     }
 
     /* When a tile in the model layer is closed, play an animation at the view layer */
-    public void close_cb (int grid_x, int grid_y)
+    private inline void close_cb (int grid_x, int grid_y)
     {
         tiles[grid_x, grid_y].animate_out ();
     }
 
     /* When a tile in the model layer is moved, play an animation at the view layer */
-    public void move_cb (int old_x, int old_y, int new_x, int new_y)
+    private inline void move_cb (int old_x, int old_y, int new_x, int new_y)
     {
         var tile = tiles[old_x, old_y];
         tiles[new_x, new_y] = tile;
@@ -252,7 +252,7 @@ public class GameView : Clutter.Group
     }
 
     /* When the mouse leaves the application window, reset all tiles to the default brightness */
-    public bool board_left_cb ()
+    internal bool board_left_cb ()
     {
         game.reset_visit ();
 
@@ -272,7 +272,7 @@ public class GameView : Clutter.Group
     }
 
     /* Move Keyboard cursor */
-    public void cursor_move (int x, int y)
+    internal void cursor_move (int x, int y)
     {
         cursor_active = true;
 
@@ -292,7 +292,7 @@ public class GameView : Clutter.Group
     }
 
     /* Keyboard Cursor Click */
-    public void cursor_click ()
+    internal void cursor_click ()
     {
         game.remove_connected_tiles (tiles[cursor_x, cursor_y].tile);
         highlighted = tiles[cursor_x, cursor_y];
@@ -300,7 +300,7 @@ public class GameView : Clutter.Group
     }
 
     /* Show flying score animation after each tile-removing click */
-    public void update_score_cb (int points_awarded)
+    private void update_score_cb (int points_awarded)
     {
         if (is_zealous)
         {
@@ -312,13 +312,14 @@ public class GameView : Clutter.Group
     }
 
     /* Show the final score when the game is over */
-    public void game_complete_cb ()
+    private void game_complete_cb ()
     {
         var text = new ScoreActor (game.rows / 5, width, height);
         game_actors.add_child (text);
         text.add_constraint (new Clutter.AlignConstraint (this, Clutter.AlignAxis.BOTH, 0.5f));
         text.animate_final_score (game.score);
 
+        /* Translators: text of a button that appears on the board at the end of a game */
         var play_again_button = new Gtk.Button.with_mnemonic (_("_Play Again"));
         play_again_button.width_request = 130;
         play_again_button.height_request = 40;
@@ -338,7 +339,6 @@ public class GameView : Clutter.Group
         button_actor.set_easing_duration (2000);
         button_actor.z_position = -50;
         button_actor.set_opacity (255);
-
     }
 }
 
@@ -346,12 +346,12 @@ public class GameView : Clutter.Group
  *  This class holds the textures for a specific theme. These textures are used for creating light
  *  actors and cursor actor.
  */
-public class Theme : Object
+private class Theme : Object
 {
-    public Clutter.Image[] textures;
-    public Clutter.Image cursor;
+    internal Clutter.Image[] textures;
+    internal Clutter.Image cursor;
 
-    public Theme (string name)
+    internal Theme (string name)
     {
         textures = new Clutter.Image [4];
         string[4] colors = {"blue", "green", "yellow", "red"};
@@ -387,9 +387,9 @@ public class Theme : Object
 private class TileActor : Clutter.Actor
 {
     /* Tile being represented */
-    public Tile tile;
+    internal Tile tile;
 
-    public TileActor (Tile tile, Clutter.Image texture, int size)
+    internal TileActor (Tile tile, Clutter.Image texture, int size)
     {
         this.tile = tile;
         opacity = 180;
@@ -401,7 +401,7 @@ private class TileActor : Clutter.Actor
     }
 
     /* Destroy the tile */
-    public void animate_out ()
+    internal void animate_out ()
     {
         /* When the animination is done, hide the actor */
         set_easing_mode (Clutter.AnimationMode.LINEAR);
@@ -417,7 +417,7 @@ private class TileActor : Clutter.Actor
     }
 
     /* Define how the tile moves */
-    public void animate_to (double new_x, double new_y, bool is_zealous = false)
+    internal void animate_to (double new_x, double new_y, bool is_zealous = false)
     {
         var anim_mode = is_zealous ? Clutter.AnimationMode.EASE_OUT_BOUNCE : 
Clutter.AnimationMode.EASE_OUT_QUAD;
         set_easing_mode (anim_mode);
@@ -426,9 +426,9 @@ private class TileActor : Clutter.Actor
     }
 }
 
-public class CursorActor : Clutter.Actor
+private class CursorActor : Clutter.Actor
 {
-   public CursorActor (Clutter.Content texture, int size)
+    internal CursorActor (Clutter.Content texture, int size)
     {
         opacity = 180;
         set_size (size, size);
@@ -442,14 +442,14 @@ public class CursorActor : Clutter.Actor
 /**
  *  This class defines the view of a score. All clutter related stuff goes here
  */
-public class ScoreActor : Clutter.Group
+private class ScoreActor : Clutter.Group
 {
     private Clutter.Text label;
     private float scene_width;
     private float scene_height;
     private int game_size;
 
-    public ScoreActor (int game_size, double width, double height)
+    internal ScoreActor (int game_size, double width, double height)
     {
         label = new Clutter.Text ();
         label.set_color (Clutter.Color.from_string ("rgba(255, 255, 255, 255)"));
@@ -463,7 +463,7 @@ public class ScoreActor : Clutter.Group
         this.game_size = game_size;
     }
 
-    public void animate_score (int points)
+    internal void animate_score (int points)
     {
         if (points <= 0)
             return;
@@ -483,11 +483,13 @@ public class ScoreActor : Clutter.Group
         transitions_completed.connect (() => { destroy (); });
     }
 
-    public void animate_final_score (uint points)
+    internal void animate_final_score (uint points)
     {
         label.set_font_name ("Bitstrem Vera Sans 30");
         var points_label = ngettext (/* Label showing the number of points at the end of the game */
                                      "%u point", "%u points", points).printf (points);
+
+        /* Translators: text of a label that appears on the board at the end of a game */
         label.set_markup ("<b>%s</b>\n%s".printf (_("Game Over!"), points_label));
         label.set_line_alignment (Pango.Alignment.CENTER);
 
diff --git a/src/game.vala b/src/game.vala
index a0d54a3..8dea8a1 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -11,14 +11,14 @@
 /**
  *  This is the model layer of a tile.
  */
-public class Tile : Object
+private class Tile : Object
 {
     /* Property */
     private bool _closed = false;
-    public bool closed
+    internal bool closed
     {
-        get { return _closed; }
-        set
+        internal get { return _closed; }
+        private set
         {
             _closed = value;
             /* Send close signal */
@@ -27,17 +27,17 @@ public class Tile : Object
         }
     }
 
-    public int grid_x;
-    public int grid_y;
-    public int color;
-    public bool visited = false;
+    internal int grid_x     { internal get; private set; }
+    internal int grid_y     { internal get; private set; }
+    internal int color      { internal get; private set; }
+    internal bool visited   { internal get; private set; default = false; }
 
     /* Signals */
-    public signal void move (int old_x, int old_y, int new_x, int new_y);
-    public signal void close (int grid_x, int grid_y);
+    internal signal void move (int old_x, int old_y, int new_x, int new_y);
+    internal signal void close (int grid_x, int grid_y);
 
     /* Constructor */
-    public Tile (int x, int y, int c)
+    internal Tile (int x, int y, int c)
     {
         grid_x = x;
         grid_y = y;
@@ -45,7 +45,7 @@ public class Tile : Object
     }
 
     /* Do not use this mothod to initialize the position. */
-    public void update_position (int new_x, int new_y)
+    internal void update_position (int new_x, int new_y)
     {
         var old_x = grid_x;
         var old_y = grid_y;
@@ -66,19 +66,19 @@ public class Tile : Object
  *  This is the model layer of the whole game. All game logic goes here. This class tries not to
  *  bring in any visual stuff to comply the separation of view-model idea.
  */
-public class Game : Object
+private class Game : Object
 {
     private Tile[,] tiles;
     private bool is_started = false;
 
     /* Game score */
-    public int score { get; set; default = 0; }
+    internal int score { internal get; private set; default = 0; }
 
     private int _color_num = 3;
     public int color_num
     {
-        get { return _color_num; }
-        set
+        internal get { return _color_num; }
+        protected construct
         {
             if (value < 2 || value > 4)
                 _color_num = 3;
@@ -88,19 +88,17 @@ public class Game : Object
     }
 
     /* Property */
-    public int rows { get; set; default = 8; }
-    public int columns { get; set; default = 8; }
+    public int rows       { internal get; protected construct; default = 8; }
+    public int columns    { internal get; protected construct; default = 8; }
 
-    public signal void update_score (int points_awarded);
-    public signal void complete ();
-    public signal void started ();
+    internal signal void update_score (int points_awarded);
+    internal signal void complete ();
+    internal signal void started ();
 
     /* Constructor */
-    public Game (int rows, int columns, int color_num)
+    internal Game (int rows, int columns, int color_num)
     {
-        _rows = rows;
-        _columns = columns;
-        _color_num = color_num;
+        Object (rows: rows, columns: columns, color_num: color_num);
 
         /* A 2D array holds all tiles */
         tiles = new Tile [rows, columns];
@@ -147,7 +145,7 @@ public class Game : Object
         return cl;
     }
 
-    public List<Tile> connected_tiles (Tile li)
+    internal List<Tile> connected_tiles (Tile li)
     {
         foreach (var l in tiles)
         {
@@ -164,12 +162,12 @@ public class Game : Object
         return cl;
     }
 
-    public Tile get_tile (int x, int y)
+    internal Tile get_tile (int x, int y)
     {
         return tiles[y, x];
     }
 
-    public bool remove_connected_tiles (Tile tile)
+    internal bool remove_connected_tiles (Tile tile)
     {
         List<Tile> cl = connected_tiles (tile);
 
@@ -251,7 +249,7 @@ public class Game : Object
         return false;
     }
 
-    public void reset_visit ()
+    internal void reset_visit ()
     {
         foreach (var l in tiles)
         {
@@ -260,7 +258,7 @@ public class Game : Object
         }
     }
 
-    public bool has_completed ()
+    internal bool has_completed ()
     {
         foreach (var l in tiles)
         {
@@ -271,7 +269,7 @@ public class Game : Object
         return true;
     }
 
-    public bool has_won ()
+    internal bool has_won ()
     {
         foreach (var l in tiles)
         {
@@ -282,7 +280,7 @@ public class Game : Object
         return true;
     }
 
-    public void increment_score_from_tiles (int n_tiles)
+    internal void increment_score_from_tiles (int n_tiles)
     {
         var points_awarded = 0;
 
@@ -292,7 +290,7 @@ public class Game : Object
         increment_score (points_awarded);
     }
 
-    public void increment_score (int increment)
+    internal void increment_score (int increment)
     {
         score += increment;
         update_score (increment);
diff --git a/src/history.vala b/src/history.vala
index 3c5c787..6fe55b8 100644
--- a/src/history.vala
+++ b/src/history.vala
@@ -8,26 +8,26 @@
  * license.
  */
 
-public class History : Object
+private class History : Object
 {
-    public string filename;
-    public List<HistoryEntry> entries;
+    internal string filename;
+    internal List<HistoryEntry> entries;
 
-    public signal void entry_added (HistoryEntry entry);
+    internal signal void entry_added (HistoryEntry entry);
 
-    public History (string filename)
+    internal History (string filename)
     {
         this.filename = filename;
         entries = new List<HistoryEntry> ();
     }
 
-    public void add (HistoryEntry entry)
+    internal void add (HistoryEntry entry)
     {
         entries.append (entry);
         entry_added (entry);
     }
 
-    public void load ()
+    internal void load ()
     {
         entries = new List<HistoryEntry> ();
 
@@ -61,7 +61,7 @@ public class History : Object
         }
     }
 
-    public void save ()
+    internal void save ()
     {
         var contents = "";
 
@@ -99,20 +99,16 @@ public class History : Object
     }
 }
 
-public class HistoryEntry : Object
+private class HistoryEntry : Object
 {
-    public DateTime date;
-    public uint width;
-    public uint height;
-    public uint n_colors;
-    public uint score;
+    public DateTime date        { internal get; protected construct; }
+    public uint     width       { internal get; protected construct; }
+    public uint     height      { internal get; protected construct; }
+    public uint     n_colors    { internal get; protected construct; }
+    public uint     score       { internal get; protected construct; }
 
-    public HistoryEntry (DateTime date, uint width, uint height, uint n_colors, uint score)
+    internal HistoryEntry (DateTime date, uint width, uint height, uint n_colors, uint score)
     {
-        this.date = date;
-        this.width = width;
-        this.height = height;
-        this.n_colors = n_colors;
-        this.score = score;
+        Object (date: date, width: width, height: height, n_colors: n_colors, score: score);
     }
 }
diff --git a/src/score-dialog.vala b/src/score-dialog.vala
index 614cc1f..823c2dc 100644
--- a/src/score-dialog.vala
+++ b/src/score-dialog.vala
@@ -8,7 +8,7 @@
  * license.
  */
  
-public class ScoreDialog : Gtk.Dialog
+private class ScoreDialog : Gtk.Dialog
 {
     private History history;
     private HistoryEntry? selected_entry = null;
@@ -17,18 +17,23 @@ public class ScoreDialog : Gtk.Dialog
     private Gtk.ComboBox size_combo;
     private Gtk.TreeView scores;
 
-    public ScoreDialog (History history, HistoryEntry? selected_entry = null, bool show_quit = false)
+    internal ScoreDialog (History history, HistoryEntry? selected_entry = null, bool show_quit = false)
     {
         this.history = history;
         history.entry_added.connect (entry_added_cb);
         this.selected_entry = selected_entry;
+        /* Translators: title of the Scores dialog */
         this.set_title (_("High Scores"));
         if (show_quit)
         {
+            /* Translations: label of one of the two buttons of the Scores dialog, as displayed when a new 
best score was maid; the other is “New Game” */
             add_button (_("_Quit"), Gtk.ResponseType.CLOSE);
+
+            /* Translations: label of one of the two buttons of the Scores dialog, as displayed when a new 
best score was maid; the other is “_Quit” */
             add_button (_("New Game"), Gtk.ResponseType.OK);
         }
         else
+            /* Translations: label of the only button of the Scores dialog, as displayed when called from 
the hamburger menu */
             add_button (_("_OK"), Gtk.ResponseType.DELETE_EVENT);
         set_size_request (200, 300);
 
@@ -41,6 +46,7 @@ public class ScoreDialog : Gtk.Dialog
         hbox.show ();
         vbox.pack_start (hbox, false, false, 0);
 
+        /* Translators: in the Scores dialog, text of the label introducing the combobox to choose of which 
category the best scores will be displayed */
         var label = new Gtk.Label (_("Size:"));
         label.show ();
         hbox.pack_start (label, false, false, 0);
@@ -66,9 +72,11 @@ public class ScoreDialog : Gtk.Dialog
 
         scores = new Gtk.TreeView ();
         renderer = new Gtk.CellRendererText ();
+        /* Translators: in the Scores dialog, name of a column of the best scores table */
         scores.insert_column_with_attributes (-1, _("Date"), renderer, "text", 0, "weight", 2);
         renderer = new Gtk.CellRendererText ();
         renderer.xalign = 1.0f;
+        /* Translators: in the Scores dialog, name of a column of the best scores table */
         scores.insert_column_with_attributes (-1, _("Score"), renderer, "text", 1, "weight", 2);
         scores.model = score_model;
         scores.show ();
@@ -78,7 +86,7 @@ public class ScoreDialog : Gtk.Dialog
             entry_added_cb (entry);
     }
 
-    public void set_size (uint width, uint height, uint n_colors)
+    private void set_size (uint width, uint height, uint n_colors)  // designed to be made public
     {
         score_model.clear ();
 
diff --git a/src/swell-foop.vala b/src/swell-foop.vala
index 833224b..c4173a7 100644
--- a/src/swell-foop.vala
+++ b/src/swell-foop.vala
@@ -21,9 +21,15 @@ public class SwellFoop : Gtk.Application
     private Gtk.Dialog? preferences_dialog = null;
 
     /* Store size options */
-    internal Size [] sizes = {{ "small",  _("Small"),   6,  5 },
-                              { "normal", _("Normal"), 15, 10 },
-                              { "large",  _("Large"),  20, 15 }};
+    internal Size [] sizes = {
+        /* Translators: name of a possible size of the grid, as seen in the Preferences dialog “board size” 
combobox */
+        { "small",  _("Small"),   6,  5 },
+
+        /* Translators: name of a possible size of the grid, as seen in the Preferences dialog “board size” 
combobox */
+        { "normal", _("Normal"), 15, 10 },
+
+        /* Translators: name of a possible size of the grid, as seen in the Preferences dialog “board size” 
combobox */
+        { "large",  _("Large"),  20, 15 }};
 
     private const GLib.ActionEntry[] action_entries =
     {
@@ -68,7 +74,7 @@ public class SwellFoop : Gtk.Application
         window.present ();
     }
 
-    public void preferences_cb ()
+    public inline void preferences_cb (/* SimpleAction action, Variant? variant */)
     {
         /* Show existing dialog */
         if (preferences_dialog != null)
@@ -88,10 +94,12 @@ public class SwellFoop : Gtk.Application
         var model = (Gtk.ListStore) theme_combo.model;
         Gtk.TreeIter iter;
         model.append (out iter);
+        /* Translators: name of a possible theme, as seen in the Preferences dialog “theme” combobox */
         model.set (iter, 0, _("Colors"), 1, "colors", -1);
         if (settings.get_string ("theme") == "colors")
             theme_combo.set_active_iter (iter);
         model.append (out iter);
+        /* Translators: name of a possible theme, as seen in the Preferences dialog “theme” combobox */
         model.set (iter, 0, _("Shapes and Colors"), 1, "shapesandcolors", -1);
         if (settings.get_string ("theme") == "shapesandcolors")
             theme_combo.set_active_iter (iter);
@@ -170,18 +178,18 @@ public class SwellFoop : Gtk.Application
         window.new_game ();
     }
 
-    private void preferences_response_cb ()
+    private inline void preferences_response_cb ()
     {
         preferences_dialog.destroy ();
         preferences_dialog = null;
     }
 
-    private void quit_cb ()
+    private inline void quit_cb (/* SimpleAction action, Variant? variant */)
     {
         window.destroy ();
     }
 
-    private void help_cb ()
+    private inline void help_cb (/* SimpleAction action, Variant? variant */)
     {
         try
         {
@@ -193,26 +201,39 @@ public class SwellFoop : Gtk.Application
         }
     }
 
-    private void about_cb ()
+    private inline void about_cb (/* SimpleAction action, Variant? variant */)
     {
-        string[] authors = { "Tim Horton", "Sophia Yu", null };
-        string[] artists = { "Tim Horton", null };
-        string[] documenters = { null };
+        string[] authors = {
+            /* Translators: About dialog text, name of an author */
+            _("Tim Horton"),
+
+
+            /* Translators: About dialog text, name of an author */
+            _("Sophia Yu")
+        };
+        string[] artists = {
+            /* Translators: About dialog text, name of an artist */
+            _("Tim Horton")
+        };
+        string[] documenters = {};
 
         Gtk.show_about_dialog (window,
+                               /* Translators: About dialog text, name of the application */
                                "program-name", _("Swell Foop"),
                                "version", Config.VERSION,
                                "comments",
+                               /* Translators: About dialog text, small description of the application */
                                _("I want to play that game!\nYou know, they all light-up and you click on 
them and they vanish!"),
-                               "copyright", _("Copyright \xc2\xa9 2009 Tim Horton"),
                                "license-type", Gtk.License.GPL_2_0,
                                "authors", authors,
+                               /* Translators: About dialog text, copyright line */
+                               "copyright", _("Copyright \xc2\xa9 2009 Tim Horton"),
                                "artists", artists,
                                "documenters", documenters,
+                               /* Translators: About dialog text, should be replaced with a credit for you 
and your team; do not translate literally! */
                                "translator-credits", _("translator-credits"),
                                "logo-icon-name", "org.gnome.SwellFoop",
-                               "website", Config.PACKAGE_URL,
-                               null);
+                               "website", Config.PACKAGE_URL);
     }
 
     public static int main (string[] args)
@@ -244,8 +265,8 @@ public class SwellFoop : Gtk.Application
             return Posix.EXIT_FAILURE;
         }
 
+        /* Translators: name of the application, as displayed in the window manager */
         Environment.set_application_name (_("Swell Foop"));
-
         Gtk.Window.set_default_icon_name ("org.gnome.SwellFoop");
 
         var app = new SwellFoop ();
@@ -254,7 +275,7 @@ public class SwellFoop : Gtk.Application
 }
 
 /* An array will store multiply game size options. */
-public struct Size
+private struct Size
 {
     public string id;
     public string name;
diff --git a/src/window.vala b/src/window.vala
index 2f39e91..44a57b4 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -106,7 +106,7 @@ private class SwellFoopWindow : ApplicationWindow
         history.load ();
     }
 
-    private Stack build_first_run_stack ()
+    private inline Stack build_first_run_stack ()
     {
         CssProvider css_provider = new CssProvider ();
         css_provider.load_from_resource ("/org/gnome/SwellFoop/ui/swell-foop.css");
@@ -117,6 +117,7 @@ private class SwellFoopWindow : ApplicationWindow
         Builder builder = new Builder.from_resource ("/org/gnome/SwellFoop/ui/first-run-stack.ui");
         var stack = (Stack) builder.get_object ("first_run_stack");
         var tip_label = (Label) builder.get_object ("tip_label");
+        /* Translators: text appearing on the first-run screen; to test, run `gsettings set 
org.gnome.swell-foop first-run true` before launching application */
         tip_label.set_label (_("Clear as many blocks as you can.\nFewer clicks means more points."));
         var play_button = (Button) builder.get_object ("play_button");
         play_button.clicked.connect (() => {
@@ -144,6 +145,7 @@ private class SwellFoopWindow : ApplicationWindow
         if (game != null)
             score = game.score;
 
+        /* Translators: subtitle of the headerbar; the %u is replaced by the score */
         headerbar.subtitle = _("Score: %u").printf (score);
     }
 
@@ -156,7 +158,7 @@ private class SwellFoopWindow : ApplicationWindow
         game_in_progress = false;
     }
 
-    private void started_cb ()
+    private inline void started_cb ()
     {
         game_in_progress = true;
     }
@@ -196,17 +198,17 @@ private class SwellFoopWindow : ApplicationWindow
         update_score_cb (0);
     }
 
-    internal void set_theme_name (string new_theme)
+    internal inline void set_theme_name (string new_theme)
     {
         view.theme_name = new_theme;
     }
 
-    internal void set_is_zealous (bool is_zealous)
+    internal inline void set_is_zealous (bool is_zealous)
     {
         view.is_zealous = is_zealous;
     }
 
-    internal void on_shutdown ()
+    internal inline void on_shutdown ()
     {
         /* Record the score if the game isn't over. */
         if (game != null && !game.has_completed () && game.score > 0)
@@ -217,7 +219,7 @@ private class SwellFoopWindow : ApplicationWindow
     * * actions
     \*/
 
-    private inline void scores_cb ()
+    private inline void scores_cb (/* SimpleAction action, Variant? variant */)
     {
         var dialog = new ScoreDialog (history);
         dialog.modal = true;
@@ -227,7 +229,7 @@ private class SwellFoopWindow : ApplicationWindow
         dialog.destroy ();
     }
 
-    private inline void new_game_cb ()
+    private inline void new_game_cb (/* SimpleAction action, Variant? variant */)
     {
         if (game_in_progress)
             show_new_game_confirmation_dialog ();
@@ -235,15 +237,20 @@ private class SwellFoopWindow : ApplicationWindow
             new_game ();
     }
 
-    private void show_new_game_confirmation_dialog ()
+    private inline void show_new_game_confirmation_dialog ()
     {
         var dialog = new MessageDialog.with_markup (this,
                                                     DialogFlags.MODAL,
                                                     MessageType.QUESTION,
                                                     ButtonsType.NONE,
                                                     "<span weight=\"bold\" size=\"larger\">%s</span>",
+                                                    /* Translators: text of a Dialog that may appear if you 
start a new game while one is running */
                                                     _("Abandon this game to start a new one?"));
+
+        /* Translators: text of one of the two buttons of a Dialog that appears if you start a new game 
while one is running; the other is “_New Game” */
         dialog.add_button (_("_Cancel"),    ResponseType.CANCEL);
+
+        /* Translators: text of one of the two buttons of a Dialog that appears if you start a new game 
while one is running; the other is “_Cancel” */
         dialog.add_button (_("_New Game"),  ResponseType.YES);
 
         var result = dialog.run ();



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