[gnome-games] favorites-collection: Connect to is-favorite only after changing it



commit a878fe989c0147c1c57c7b8b0352a71f9066d377
Author: Neville <nevilleantony98 gmail com>
Date:   Fri Jul 24 17:22:37 2020 +0530

    favorites-collection: Connect to is-favorite only after changing it
    
    Only connect to new game's is-favorite changed signal after setting the
    new game's is-favorite as prev_game's is-favorite.

 src/collection/favorites-collection.vala | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/collection/favorites-collection.vala b/src/collection/favorites-collection.vala
index 25a4f95df..b611a64b6 100644
--- a/src/collection/favorites-collection.vala
+++ b/src/collection/favorites-collection.vala
@@ -98,14 +98,14 @@ private class Games.FavoritesCollection : Object, Collection {
        }
 
        public void on_game_replaced (Game game, Game prev_game) {
-               SignalHandler.disconnect_by_data (prev_game, this);
-               game.notify["is-favorite"].connect (() => {
-                       on_is_favorite_changed (game);
-               });
-
                if (prev_game.is_favorite) {
                        game.is_favorite = true;
                        game_model.replace_game (game, prev_game);
                }
+
+               SignalHandler.disconnect_by_data (prev_game, this);
+               game.notify["is-favorite"].connect (() => {
+                       on_is_favorite_changed (game);
+               });
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]