[gnome-music/wip/jfelder/sidebar-icons: 1/2] playlisttile: Add the playlist icon




commit 22e15752d5b8368cb8076cd3ba9c05d0da240dcd
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Jan 28 22:49:02 2021 +0100

    playlisttile: Add the playlist icon

 data/org.gnome.Music.css           |  6 ++++++
 data/ui/PlaylistTile.ui            | 34 ++++++++++++++++++++++++++++------
 gnomemusic/widgets/playlisttile.py |  3 +++
 3 files changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.Music.css b/data/org.gnome.Music.css
index 980aae0ca..0ac47b3ac 100644
--- a/data/org.gnome.Music.css
+++ b/data/org.gnome.Music.css
@@ -17,6 +17,12 @@
     background-color: transparent;
 }
 
+.playlist-icon {
+    padding: 10px;
+    border-radius: 50%;
+    border: 1px solid @borders;
+}
+
 /* AlbumWidget */
 .title-artist {
     font-size: larger;
diff --git a/data/ui/PlaylistTile.ui b/data/ui/PlaylistTile.ui
index dceea3c99..cf10c2718 100644
--- a/data/ui/PlaylistTile.ui
+++ b/data/ui/PlaylistTile.ui
@@ -3,13 +3,35 @@
   <template class="PlaylistTile" parent="GtkListBoxRow">
     <property name="visible">True</property>
     <child>
-      <object class="GtkLabel" id="_label">
-        <property name="can_focus">False</property>
-        <property name="ellipsize">end</property>
-        <property name="halign">start</property>
-        <property name="hexpand">False</property>
-        <property name="margin">16</property>
+      <object class="GtkBox">
+        <property name="orientation">horizontal</property>
         <property name="visible">True</property>
+        <property name="margin_start">10</property>
+        <child>
+          <object class="GtkImage" id="_icon">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="icon_size">0</property>
+            <property name="pixel_size">16</property>
+            <property name="valign">center</property>
+            <style>
+              <class name="playlist-icon"/>
+            </style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="_label">
+            <property name="can_focus">False</property>
+            <property name="ellipsize">end</property>
+            <property name="halign">start</property>
+            <property name="hexpand">False</property>
+            <property name="margin_start">10</property>
+            <property name="margin_end">10</property>
+            <property name="margin_top">16</property>
+            <property name="margin_bottom">16</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/gnomemusic/widgets/playlisttile.py b/gnomemusic/widgets/playlisttile.py
index 9d9a64415..d756a7a8b 100644
--- a/gnomemusic/widgets/playlisttile.py
+++ b/gnomemusic/widgets/playlisttile.py
@@ -36,6 +36,7 @@ class PlaylistTile(Gtk.ListBoxRow):
 
     __gtype_name__ = "PlaylistTile"
 
+    _icon = Gtk.Template.Child()
     _label = Gtk.Template.Child()
 
     playlist = GObject.Property(type=Playlist, default=None)
@@ -46,6 +47,8 @@ class PlaylistTile(Gtk.ListBoxRow):
 
         self.props.playlist = playlist
 
+        self._icon.props.icon_name = playlist.props.icon_name
+
         self.props.playlist.bind_property(
             "title", self._label, "label", GObject.BindingFlags.SYNC_CREATE)
         self.props.playlist.bind_property(


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