[gnome-games] game-icon-view: Show star on covers for favorite games



commit 07ca078cceabee20b789e3c0433910d22193f872
Author: Neville <nevilleantony98 gmail com>
Date:   Thu Jun 18 21:39:56 2020 +0530

    game-icon-view: Show star on covers for favorite games
    
    Game's is_favorite prop is bound to the visiblity of the star in
    GameIconView.

 data/ui/game-icon-view.ui  | 11 +++++++++++
 src/ui/game-icon-view.vala |  2 ++
 2 files changed, 13 insertions(+)
---
diff --git a/data/ui/game-icon-view.ui b/data/ui/game-icon-view.ui
index e1acdef2..ed636e58 100644
--- a/data/ui/game-icon-view.ui
+++ b/data/ui/game-icon-view.ui
@@ -34,6 +34,17 @@
                   </child>
                 </object>
               </child>
+              <child type="overlay">
+                  <object class="GtkImage">
+                    <property name="visible" bind-source="GamesGameIconView" bind-property="is-favorite"/>
+                    <property name="icon-name">starred-symbolic</property>
+                    <property name="halign">end</property>
+                    <property name="valign">start</property>
+                    <style>
+                      <class name="favorite-star"/>
+                    </style>
+                  </object>
+              </child>
             </object>
           </child>
           <child>
diff --git a/src/ui/game-icon-view.vala b/src/ui/game-icon-view.vala
index 1b3ba241..d946ff34 100644
--- a/src/ui/game-icon-view.vala
+++ b/src/ui/game-icon-view.vala
@@ -24,12 +24,14 @@ private class Games.GameIconView : Gtk.FlowBoxChild {
                        thumbnail.game = game;
                        title.label = game.name;
 
+                       game.bind_property ("is-favorite", this, "is-favorite", BindingFlags.SYNC_CREATE);
                        game_replaced_id = game.replaced.connect (game_replaced);
                }
        }
 
        public bool checked { get; set; }
        public bool is_selection_mode { get; set; }
+       public bool is_favorite { get; set; }
 
        public GameIconView (Game game) {
                Object (game: game);


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