[gnome-games] game-model: Add always_replace prop
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] game-model: Add always_replace prop
- Date: Thu, 16 Jul 2020 14:51:54 +0000 (UTC)
commit 83f494046a43ffec3f7991b720cfbefa396dc51b
Author: Neville <nevilleantony98 gmail com>
Date: Thu Jul 16 19:42:32 2020 +0530
game-model: Add always_replace prop
This is a workaround to "hard" replace games in a collection's GameModel
unconditionally so that when the GameModel is bound to a collection
subpage thumbnails are not created for already "soft" replaced games in
the GameModel
src/collection/favorites-collection.vala | 1 +
src/core/game-model.vala | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/collection/favorites-collection.vala b/src/collection/favorites-collection.vala
index ea52503a..445cffe0 100644
--- a/src/collection/favorites-collection.vala
+++ b/src/collection/favorites-collection.vala
@@ -17,6 +17,7 @@ private class Games.FavoritesCollection : Object, Collection {
favorite_game_uids = new GenericSet<Uid> (Uid.hash, Uid.equal);
game_model = new GameModel ();
+ game_model.always_replace = true;
}
public FavoritesCollection (Database database) {
diff --git a/src/core/game-model.vala b/src/core/game-model.vala
index fe3e8872..c62dd7a5 100644
--- a/src/core/game-model.vala
+++ b/src/core/game-model.vala
@@ -7,6 +7,8 @@ private class Games.GameModel : Object, ListModel {
private Sequence<Game> sequence;
private int n_games;
+ public bool always_replace;
+
construct {
sequence = new Sequence<Game> ();
n_games = 0;
@@ -36,7 +38,8 @@ private class Games.GameModel : Object, ListModel {
public void replace_game (Game game, Game prev_game) {
// Title changed, just hope it doesn't happen too often
- if (prev_game.name != game.name) {
+ // FIX ME always_replace is a temporary hack until on_game_replaced is redone
+ if (prev_game.name != game.name || always_replace) {
remove_game (prev_game);
add_game (game);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]