[gnome-games/wip/aplazas/thumbnail-size: 2/3] game-icon-view: Add the size property



commit 23e1169e77f8fc5164ec6d50711154e3ad2134c2
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Jul 16 14:34:59 2018 +0200

    game-icon-view: Add the size property
    
    Make the size of the game icon view parametrable via a simple property.
    This will be used in the next commit to allow smaller thumbnails on
    small windows.

 data/ui/game-icon-view.ui  |  4 ----
 src/ui/game-icon-view.vala | 12 ++++++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/game-icon-view.ui b/data/ui/game-icon-view.ui
index f3c9e882..75e02cf8 100644
--- a/data/ui/game-icon-view.ui
+++ b/data/ui/game-icon-view.ui
@@ -9,8 +9,6 @@
     <child>
       <object class="GamesGameThumbnail" id="thumbnail">
         <property name="visible">True</property>
-        <property name="width-request">256</property>
-        <property name="height-request">256</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -20,7 +18,6 @@
     <child>
       <object class="GtkLabel" id="title">
         <property name="visible">True</property>
-        <property name="width-request">256</property>
         <property name="ellipsize">middle</property>
         <property name="justify">center</property>
         <property name="lines">2</property>
@@ -36,7 +33,6 @@
     <child>
       <object class="GtkLabel" id="subtitle">
         <property name="visible">True</property>
-        <property name="width-request">256</property>
         <property name="ellipsize">middle</property>
         <property name="justify">center</property>
         <property name="lines">1</property>
diff --git a/src/ui/game-icon-view.vala b/src/ui/game-icon-view.vala
index 7cda0b8f..e6fde0d9 100644
--- a/src/ui/game-icon-view.vala
+++ b/src/ui/game-icon-view.vala
@@ -19,10 +19,22 @@ private class Games.GameIconView : Gtk.Box {
                }
        }
 
+       public int size {
+               set {
+                       thumbnail.width_request = value;
+                       thumbnail.height_request = value;
+                       title.width_request = value;
+                       subtitle.width_request = value;
+               }
+               default = 256;
+       }
+
        [GtkChild]
        private GameThumbnail thumbnail;
        [GtkChild]
        private Gtk.Label title;
+       [GtkChild]
+       private Gtk.Label subtitle;
 
        public GameIconView (Game game) {
                this.game = game;


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