[libgames-support] Allow games to tolerate extra files in the scores directory
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgames-support] Allow games to tolerate extra files in the scores directory
- Date: Sat, 13 Feb 2016 04:27:40 +0000 (UTC)
commit f5d2210d131e0f3f92244accfacaa005aa7af939
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Fri Feb 12 22:24:57 2016 -0600
Allow games to tolerate extra files in the scores directory
games/scores/context.vala | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index d18ec25..370a525 100644
--- a/games/scores/context.vala
+++ b/games/scores/context.vala
@@ -55,7 +55,7 @@ public class Context : Object
};
/* A function provided by the game that converts the category key to a category. */
- public delegate Category CategoryRequestFunc (string category_key);
+ public delegate Category? CategoryRequestFunc (string category_key);
private CategoryRequestFunc category_request;
public Context (string app_name, string category_type, Gtk.Window? game_window, CategoryRequestFunc
category_request, Style style)
@@ -202,6 +202,9 @@ public class Context : Object
{
var category_key = file_info.get_name ();
var category = category_request (category_key);
+ if (category == null)
+ return;
+
var filename = Path.build_filename (user_score_dir, category_key);
var scores_of_single_category = new Gee.PriorityQueue<Score> ((owned) scorecmp);
var stream = FileStream.open (filename, "r");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]