[gnome-games] ui: Add GameThumbnail.cover



commit 930d4599033cce6e5e438149ff55e4dde38a4c8c
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri May 13 09:34:01 2016 +0200

    ui: Add GameThumbnail.cover
    
    This will be used in the next commit to display the cover of games
    providing one.

 src/ui/game-icon-view.vala |    1 +
 src/ui/game-thumbnail.vala |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/game-icon-view.vala b/src/ui/game-icon-view.vala
index a2b3b90..2140e25 100644
--- a/src/ui/game-icon-view.vala
+++ b/src/ui/game-icon-view.vala
@@ -12,6 +12,7 @@ private class Games.GameIconView : Gtk.Box {
                        _game = value;
 
                        thumbnail.icon = game.get_icon ();
+                       thumbnail.cover = game.get_cover ();
                        title.label = game.name;
 
                        queue_draw ();
diff --git a/src/ui/game-thumbnail.vala b/src/ui/game-thumbnail.vala
index 2f3d016..b02789c 100644
--- a/src/ui/game-thumbnail.vala
+++ b/src/ui/game-thumbnail.vala
@@ -26,6 +26,27 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
                default = null;
        }
 
+       private ulong cover_changed_id;
+       private Cover _cover;
+       public Cover cover {
+               get { return _cover; }
+               set {
+                       if (_cover == value)
+                               return;
+
+                       if (_cover != null)
+                               _cover.disconnect (cover_changed_id);
+
+                       _cover = value;
+
+                       if (_cover != null)
+                               _cover.changed.connect (queue_draw);
+
+                       queue_draw ();
+               }
+               default = null;
+       }
+
        public struct DrawingContext {
                Cairo.Context cr;
                Gdk.Window? window;


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