[gnome-2048] Don't allow opening scores dialog if no scores exist
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048] Don't allow opening scores dialog if no scores exist
- Date: Sun, 22 Feb 2015 23:46:09 +0000 (UTC)
commit 34134f17268e3ab7b53b350c715941c15005d59e
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Feb 22 12:26:57 2015 -0600
Don't allow opening scores dialog if no scores exist
The scores dialog seems to be pretty broken right now, but pretty sure
the code in GNOME 2048 is correct.
https://bugzilla.gnome.org/show_bug.cgi?id=744975
src/application.vala | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/application.vala b/src/application.vala
index 5a958eb..5e8b26b 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -143,6 +143,7 @@ public class Application : Gtk.Application
try {
Scores.Category cat = (_settings.get_int ("rows") == 4) ? _grid4_cat : _grid5_cat;
_scores_ctx.add_score (_game.score, cat);
+ ((SimpleAction) lookup_action ("scores")).set_enabled (true);
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
}
@@ -310,6 +311,9 @@ public class Application : Gtk.Application
_scores_ctx = new Scores.Context ("gnome-2048", "", _window, Scores.Style.PLAIN_DESCENDING);
_grid4_cat = new Scores.Category ("grid4", "Grid 4 x 4");
_grid5_cat = new Scores.Category ("grid5", "Grid 5 x 5");
+
+ if (!_scores_ctx.has_scores ())
+ ((SimpleAction) lookup_action ("scores")).set_enabled (false);
}
private void new_game_cb ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]