[libgames-support] Rename values in the Style enum to be less confusing
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgames-support] Rename values in the Style enum to be less confusing
- Date: Sun, 14 Feb 2016 22:38:00 +0000 (UTC)
commit a32e550290f410003d93357548fe404998726be6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Sun Feb 14 16:34:31 2016 -0600
Rename values in the Style enum to be less confusing
games/scores/context.vala | 12 ++++++------
games/scores/dialog.vala | 4 ++--
tests/test-scores.vala | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index 54ae34b..afc908d 100644
--- a/games/scores/context.vala
+++ b/games/scores/context.vala
@@ -24,10 +24,10 @@ namespace Scores {
public enum Style
{
- PLAIN_DESCENDING,
- PLAIN_ASCENDING,
- TIME_DESCENDING,
- TIME_ASCENDING
+ POINTS_GREATER_IS_BETTER,
+ POINTS_LESS_IS_BETTER,
+ TIME_GREATER_IS_BETTER,
+ TIME_LESS_IS_BETTER
}
public class Context : Object
@@ -88,7 +88,7 @@ public class Context : Object
this.style = style;
this.importer = importer;
- if (style == Style.PLAIN_DESCENDING || style == Style.TIME_DESCENDING)
+ if (style == Style.POINTS_GREATER_IS_BETTER || style == Style.TIME_GREATER_IS_BETTER)
{
scorecmp = (a,b) => {
return (int) (b.score > a.score) - (int) (a.score > b.score);
@@ -183,7 +183,7 @@ public class Context : Object
var lowest = best_scores get (9).score;
- if (style == Style.PLAIN_ASCENDING || style == Style.TIME_ASCENDING)
+ if (style == Style.POINTS_LESS_IS_BETTER || style == Style.TIME_LESS_IS_BETTER)
return score_value < lowest;
return score_value > lowest;
diff --git a/games/scores/dialog.vala b/games/scores/dialog.vala
index 0aad866..5066ed6 100644
--- a/games/scores/dialog.vala
+++ b/games/scores/dialog.vala
@@ -56,7 +56,7 @@ private class Dialog : Gtk.Dialog
if (new_high_score != null)
/* Appears at the top of the dialog, as the heading of the dialog */
headerbar.title = _("Congratulations!");
- else if (scores_style == Style.PLAIN_ASCENDING || scores_style == Style.PLAIN_DESCENDING)
+ else if (scores_style == Style.POINTS_GREATER_IS_BETTER || scores_style ==
Style.POINTS_LESS_IS_BETTER)
headerbar.title = _("High Scores");
else
headerbar.title = _("Best Times");
@@ -140,7 +140,7 @@ private class Dialog : Gtk.Dialog
string score_or_time = "";
- if (scores_style == Style.PLAIN_ASCENDING || scores_style == Style.PLAIN_DESCENDING)
+ if (scores_style == Style.POINTS_GREATER_IS_BETTER || scores_style == Style.POINTS_LESS_IS_BETTER)
/* A column heading in the scores dialog */
score_or_time = _("Score");
else
diff --git a/tests/test-scores.vala b/tests/test-scores.vala
index 65c7042..72a14c2 100644
--- a/tests/test-scores.vala
+++ b/tests/test-scores.vala
@@ -46,7 +46,7 @@ private void add_score_sync (Context context, int score, Category category) {
private void create_scores ()
{
- Context context = new Context ("libgames-support-test", "Games Type", null, category_request,
Style.PLAIN_DESCENDING);
+ Context context = new Context ("libgames-support-test", "Games Type", null, category_request,
Style.POINTS_GREATER_IS_BETTER);
Category cat = new Category ("cat1", "cat1");
add_score_sync (context, 101, cat);
add_score_sync (context, 102, cat);
@@ -184,7 +184,7 @@ private void test_import_from_score_directory ()
assert (key == "new-cat");
return category;
},
- Games.Scores.Style.PLAIN_DESCENDING,
+ Games.Scores.Style.POINTS_GREATER_IS_BETTER,
new Games.Scores.DirectoryImporter.with_convert_func ((old_key) => {
assert (old_key == "old-cat");
return "new-cat";
@@ -231,7 +231,7 @@ private void test_import_from_history_file ()
assert (key == "new-cat");
return category;
},
- Games.Scores.Style.PLAIN_DESCENDING,
+ Games.Scores.Style.POINTS_GREATER_IS_BETTER,
new Games.Scores.HistoryFileImporter ((line, out score, out out_category) => {
assert (line == "2016-02-13T23:15:45-0600 old-cat 42");
score = new Score (42, HistoryFileImporter.parse_date ("2016-02-13T23:15:45-0600"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]