[gnome-2048] add_score is now asynchronous
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048] add_score is now asynchronous
- Date: Sun, 20 Sep 2015 19:15:06 +0000 (UTC)
commit e7f1913818aff7e7358cc2cb98be471d2f4ee83c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 20 14:13:55 2015 -0500
add_score is now asynchronous
src/application.vala | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/application.vala b/src/application.vala
index 88b09b6..aad63b3 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -144,13 +144,16 @@ public class Application : Gtk.Application
_header_bar.subtitle = _("Game Over");
if (!_game_restored) {
- try {
- Scores.Category cat = (_settings.get_int ("rows") == 4) ? _grid4_cat : _grid5_cat;
- _scores_ctx.add_score (_game.score, cat);
+ Scores.Category cat = (_settings.get_int ("rows") == 4) ? _grid4_cat : _grid5_cat;
+ _scores_ctx.add_score.begin (_game.score, cat, (object, result) => {
+ try {
+ _scores_ctx.add_score.end (result);
+ } catch (GLib.Error e) {
+ stderr.printf ("%s\n", e.message);
+ }
((SimpleAction) lookup_action ("scores")).set_enabled (true);
- } catch (GLib.Error e) {
- stderr.printf ("%s\n", e.message);
- }
+ debug ("score added");
+ });
}
debug ("finished");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]