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




commit 958d2a9d2c4bfc24153cc51b2dde3f0024d6e92d
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            | 37 ++++++++++++++++++++++++++++---------
 gnomemusic/widgets/playlisttile.py |  3 +++
 3 files changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/data/org.gnome.Music.css b/data/org.gnome.Music.css
index 18c01ddaf..3e82d10ac 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%;
+    background-color: alpha(@theme_fg_color, 0.1);
+}
+
 .disc-label {
     color: alpha(@theme_fg_color, 0.8);
     padding: 12px 0;
diff --git a/data/ui/PlaylistTile.ui b/data/ui/PlaylistTile.ui
index e29bb791d..c229972e6 100644
--- a/data/ui/PlaylistTile.ui
+++ b/data/ui/PlaylistTile.ui
@@ -3,16 +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-bottom">16</property>
-        <property name="margin-end">16</property>
-        <property name="margin-start">16</property>
-        <property name="margin-top">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">20</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-bottom">16</property>
+            <property name="margin-end">10</property>
+            <property name="margin-start">10</property>
+            <property name="margin-top">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]