[gnome-mines/wip/libgames-support: 2/5] Update for new libgames-support API
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mines/wip/libgames-support: 2/5] Update for new libgames-support API
- Date: Mon, 15 Feb 2016 02:47:57 +0000 (UTC)
commit 774a66ddaf054ac0ddc963dfe70907a81c207215
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Sun Feb 14 20:22:13 2016 -0600
Update for new libgames-support API
configure.ac | 2 +-
src/Makefile.am | 3 ++-
src/gnome-mines.vala | 32 +++++++++++++++++++++-----------
3 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bc012f8..dc0171f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ PKG_CHECK_MODULES(GNOME_MINES, [
glib-2.0 >= $GLIB_REQUIRED
gtk+-3.0 >= $GTK_REQUIRED
librsvg-2.0 >= $RSVG_REQUIRED
- libgames-support
+ libgames-support-1.0
])
AC_SUBST([GLIB_REQUIRED])
diff --git a/src/Makefile.am b/src/Makefile.am
index 8089049..6d42749 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,7 +22,8 @@ gnome_mines_VALAFLAGS = \
--pkg librsvg-2.0 \
--pkg pango \
--pkg pangocairo \
- --pkg games-support \
+ --pkg libgames-support-1.0 \
+ --pkg gee-0.8 \
--target-glib $(GLIB_REQUIRED)
gnome_mines_LDADD = \
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 641c45d..6ac72f6 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -311,8 +311,12 @@ public class Mines : Gtk.Application
/* Initialize Custom Game Screen */
startup_custom_game_screen (ui_builder);
- context = new Games.Scores.Context ("gnome-mines", "Mines", window,
Games.Scores.Style.TIME_ASCENDING);
- context.category_request.connect (create_category_from_key);
+ context = new Games.Scores.Context ("gnome-mines",
+ /* Label on the scores dialog */
+ _("Minefield:"),
+ window,
+ create_category_from_key,
+ Games.Scores.Style.TIME_LESS_IS_BETTER);
flag_label = (Gtk.Label) ui_builder.get_object ("flag_label");
clock_label = (Gtk.Label) ui_builder.get_object ("clock_label");
@@ -750,16 +754,22 @@ public class Mines : Gtk.Application
var duration = (uint) (minefield.elapsed + 0.5);
string key = minefield.width.to_string () + "-" + minefield.height.to_string () + "-" +
minefield.n_mines.to_string ();
- try
- {
- context.add_score (duration, create_category_from_key (key)) ;
- }
- catch (Error e)
- {
- warning ("%s", e.message);
- }
+ new_game_action.set_enabled (false);
+ pause_action.set_enabled (false);
+ repeat_size_action.set_enabled (false);
- show_new_game_screen ();
+ context.add_score.begin (duration, create_category_from_key (key), null, (object, result) => {
+ try
+ {
+ context.add_score.end (result);
+ }
+ catch (Error e)
+ {
+ warning ("%s", e.message);
+ }
+ new_game_action.set_enabled (true);
+ show_new_game_screen ();
+ });
}
private void clock_started_cb ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]