[gnome-music/wip/mschraal/core] albumwidget: Port to new style



commit 9e3b2554dad60f2b351efc1aa703179c0060f02b
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Jul 10 18:59:04 2019 +0200

    albumwidget: Port to new style

 data/org.gnome.Music.css                | 29 +++++++++++++++++++++++++----
 data/ui/AlbumWidget.ui                  |  6 +-----
 data/ui/DiscBox.ui                      | 14 +++++++-------
 gnomemusic/views/playlistsview.py       |  5 +----
 gnomemusic/views/songsview.py           |  2 +-
 gnomemusic/widgets/disclistboxwidget.py |  2 ++
 6 files changed, 37 insertions(+), 21 deletions(-)
---
diff --git a/data/org.gnome.Music.css b/data/org.gnome.Music.css
index 6caaa519..ecdc5d7f 100644
--- a/data/org.gnome.Music.css
+++ b/data/org.gnome.Music.css
@@ -18,6 +18,12 @@
     font-weight: bold;
 }
 
+.disc-label {
+    background-color: @theme_bg_color;
+    color: alpha(@theme_fg_color, 0.8);
+    padding: 12px 0;
+}
+
 /* ArtistAlbumsWidget */
 box#ArtistAlbumsWidget .artist-label {
     font-weight: bold;
@@ -51,12 +57,13 @@ box#ArtistAlbumsWidget .artist-label {
     font-weight: bold;
 }
 
-.songs-list {
+/* FIXME: Remove once songsview is ported to the new style */
+.songs-list-old {
     box-shadow: inset 0 -1px shade(@borders, 1.30);
     background-color: @theme_bg_color;
 }
 
-.songs-list:selected {
+.songs-list-old:selected {
     color: @theme_fg_color;
     border-color: mix(@theme_fg_color, @theme_bg_color, 0.5);
 }
@@ -95,11 +102,25 @@ box#ArtistAlbumsWidget .artist-label {
   font-weight: bold;
 }
 
-/* PlaylistDialog */
-.playlistdialog-row {
+/* Lists style */
+
+.disc-list-box > row {
+padding: 0px;
+}
+
+.songs-list {
+    border: 1px solid rgba(0, 0, 0, 0.1);
+}
+
+.songs-list > row {
+    padding: 10px 0;
     border-bottom: 1px solid rgba(0, 0, 0, 0.1);
 }
 
+.songs-list > row:last-child {
+    border-bottom: none;
+}
+
 .playlistdialog-row:selected {
     color: @theme_fg_color;
     background-color: @theme_insensitive_bg_color;
diff --git a/data/ui/AlbumWidget.ui b/data/ui/AlbumWidget.ui
index 1cad2407..7f6b770d 100644
--- a/data/ui/AlbumWidget.ui
+++ b/data/ui/AlbumWidget.ui
@@ -220,13 +220,9 @@
                 <property name="hexpand">True</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <!-- TODO: The top of the coverart is the same vertical -->
-                  <!-- position as the top of the album songs, however -->
-                  <!-- since we set a top margins for the discbox -->
-                  <!-- subtract that margin here. A cleaner solution is appreciated. -->
                   <object class="DiscListBox" id="_listbox">
                     <property name="can_focus">False</property>
-                    <property name="margin_top">48</property>
+                    <property name="margin_top">64</property>
                     <property name="margin_bottom">64</property>
                     <property name="margin_end">32</property>
                     <property name="selection_mode">0</property>
diff --git a/data/ui/DiscBox.ui b/data/ui/DiscBox.ui
index 8bc0bede..d1576f37 100644
--- a/data/ui/DiscBox.ui
+++ b/data/ui/DiscBox.ui
@@ -6,17 +6,16 @@
       <property name="visible">True</property>
       <property name="can_focus">False</property>
       <property name="orientation">vertical</property>
-      <property name="margin_top">16</property>
       <child>
         <object class="GtkLabel" id="_disc_label">
           <property name="visible">True</property>
           <property name="can_focus">False</property>
-          <property name="halign">start</property>
-          <property name="margin_start">60</property>
-          <property name="margin_bottom">4</property>
+          <property name="halign">fill</property>
+          <!-- <property name="hexpand">True</property> -->
           <property name="no_show_all">True</property>
+          <property name="xalign">0.0</property>
           <style>
-            <class name="dim-label"/>
+            <class name="disc-label"/>
           </style>
         </object>
         <packing>
@@ -28,9 +27,10 @@
           <property name="visible">True</property>
           <property name="can_focus">False</property>
           <property name="valign">start</property>
-<!--      <property name="orientation">vertical</property> -->
-<!--           <property name="homogeneous">True</property> -->
           <property name="selection_mode">none</property>
+          <style>
+            <class name="songs-list"/>
+          </style>
         </object>
         <packing>
           <property name="position">1</property>
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index 5238a27f..08af3cd2 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -62,10 +62,6 @@ class PlaylistsView(BaseView):
         self._window = window
         self.player = player
 
-        # self._view.get_style_context().add_class('songs-list')
-
-        # self._add_list_renderers()
-
         self._pl_ctrls = PlaylistControls()
         self._pl_ctrls.connect('playlist-renamed', self._on_playlist_renamed)
 
@@ -140,6 +136,7 @@ class PlaylistsView(BaseView):
         self._box.pack_start(view_container, True, True, 0)
 
         self._view = Gtk.ListBox()
+        self._view.get_style_context().add_class("songs-list")
 
         self._controller = Gtk.GestureMultiPress().new(self._view)
         self._controller.props.propagation_phase = Gtk.PropagationPhase.CAPTURE
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index 6d21ead0..3a038ead 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -58,7 +58,7 @@ class SongsView(BaseView):
         self._offset = 0
         self._iter_to_clean = None
 
-        self._view.get_style_context().add_class('songs-list')
+        self._view.get_style_context().add_class('songs-list-old')
 
         self._add_list_renderers()
 
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index 17e02ea9..10c5bf3c 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -197,6 +197,8 @@ class DiscListBox(Gtk.ListBox):
         self._selection_mode = False
         self._selected_items = []
 
+        self.get_style_context().add_class("disc-list-box")
+
     @log
     def get_selected_items(self):
         """Returns all selected items for all discs


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