[five-or-more/gsoc-vala-port: 19/29] Simplify category creation and category name retreival
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [five-or-more/gsoc-vala-port: 19/29] Simplify category creation and category name retreival
- Date: Mon, 13 Aug 2018 05:50:47 +0000 (UTC)
commit ae4df68bae90d700d48260e4f1c9412a84609a2b
Author: Ruxandra Simion <ruxandra simion93 gmail com>
Date: Fri Aug 3 18:18:22 2018 +0300
Simplify category creation and category name retreival
src-vala/window.vala | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src-vala/window.vala b/src-vala/window.vala
index edec5fb..9779ea0 100644
--- a/src-vala/window.vala
+++ b/src-vala/window.vala
@@ -91,23 +91,20 @@ public class GameWindow : Gtk.ApplicationWindow
}
- private Games.Scores.Category create_category_from_key (string key)
+ private Games.Scores.Category? create_category_from_key (string key)
{
- string name = category_name_from_key (key);
- if (name == null)
- return (Games.Scores.Category) null;
-
+ string? name = category_name_from_key (key);
return new Games.Scores.Category (key, name);
}
private string category_name_from_key (string key)
{
for (int i = 0; i < game.n_categories; i++) {
- if (strcmp (Game.scorecats[i].key, key) == 0)
+ if (Game.scorecats[i].key == key)
{
return Game.scorecats[i].name;
}
}
- return (string) null;
+ return "";
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]