[gnome-nibbles] Change headerbar title according to the current level



commit 66d6a3c7aa9f7923333edabe6d9ea3e773089777
Author: Razvan Chitu <razvan ch95 gmail com>
Date:   Thu Sep 17 22:10:15 2015 +0300

    Change headerbar title according to the current level
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754608

 src/gnome-nibbles.vala |    7 +++++--
 src/nibbles-game.vala  |    1 +
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index b3765d6..7aa81fb 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -297,8 +297,6 @@ public class Nibbles : Gtk.Application
     {
         settings.set_boolean ("first-run", false);
 
-        game.current_level = game.start_level;
-
         view.new_level (game.current_level);
         view.connect_worm_signals ();
 
@@ -419,6 +417,8 @@ public class Nibbles : Gtk.Application
         if (game.is_running)
             game.stop ();
 
+        headerbar.set_title (_("Nibbles"));
+
         new_game_action.set_enabled (false);
         pause_action.set_enabled (false);
         back_action.set_enabled (true);
@@ -470,6 +470,7 @@ public class Nibbles : Gtk.Application
 
         back_action.set_enabled (false);
 
+        headerbar.set_title (_("Level %d").printf(game.current_level));
         main_stack.set_visible_child_name ("game_box");
     }
 
@@ -646,6 +647,8 @@ public class Nibbles : Gtk.Application
             new_game_action.set_enabled (true);
             pause_action.set_enabled (true);
 
+            headerbar.set_title (_("Level %d").printf(game.current_level));
+
             restart_game_cb ();
         });
 
diff --git a/src/nibbles-game.vala b/src/nibbles-game.vala
index d211de3..742a65c 100644
--- a/src/nibbles-game.vala
+++ b/src/nibbles-game.vala
@@ -87,6 +87,7 @@ public class NibblesGame : Object
 
         Random.set_seed ((uint32) time_t ());
         load_properties (settings);
+        current_level = start_level;
     }
 
     /*\


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