[gnome-games/wip/exalm/uid: 15/16] platform-model: Use Platform.compare() instead of reinventing it
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/uid: 15/16] platform-model: Use Platform.compare() instead of reinventing it
- Date: Thu, 5 Mar 2020 17:59:31 +0000 (UTC)
commit 5d96b4296b8636e5e548392bdb4d7dc471321438
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu Mar 5 22:53:25 2020 +0500
platform-model: Use Platform.compare() instead of reinventing it
src/core/platform-model.vala | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/core/platform-model.vala b/src/core/platform-model.vala
index 504129ef..8309b0e1 100644
--- a/src/core/platform-model.vala
+++ b/src/core/platform-model.vala
@@ -25,7 +25,7 @@ private class Games.PlatformModel : Object, ListModel {
n_games[platform] = n_games[platform] + 1;
}
- sequence.sort (compare_func);
+ sequence.sort (Platform.compare);
items_changed (0, get_n_items (), 0);
@@ -51,7 +51,7 @@ private class Games.PlatformModel : Object, ListModel {
var platform = game.platform;
if (n_games[platform] == 0) {
- var iter = sequence.insert_sorted (platform, compare_func);
+ var iter = sequence.insert_sorted (platform, Platform.compare);
items_changed (iter.get_position (), 0, 1);
}
@@ -64,14 +64,10 @@ private class Games.PlatformModel : Object, ListModel {
n_games[platform] = n_games[platform] - 1;
if (n_games[platform] == 0) {
- var iter = sequence.lookup (platform, compare_func);
+ var iter = sequence.lookup (platform, Platform.compare);
var pos = iter.get_position ();
iter.remove ();
items_changed (pos, 1, 0);
}
}
-
- private int compare_func (Platform a, Platform b) {
- return a.get_name ().collate (b.get_name ());
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]