[gnome-music/wip/mschraal/core] songwidget: Disable sizegroup when artist and album are hidden



commit ea702d09c858668b36a18ca17083ed3560976750
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Jul 11 01:13:21 2019 +0200

    songwidget: Disable sizegroup when artist and album are hidden

 data/ui/SongWidget.ui            | 14 +++++++-------
 gnomemusic/widgets/songwidget.py |  7 ++++++-
 2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/data/ui/SongWidget.ui b/data/ui/SongWidget.ui
index 4f424c21..3a73b42a 100644
--- a/data/ui/SongWidget.ui
+++ b/data/ui/SongWidget.ui
@@ -90,15 +90,15 @@
           </object>
         </child>
         <child>
-          <object class="GtkBox" id="artist_box">
-            <property name="visible">True</property>
+          <object class="GtkBox" id="_artist_box">
+            <property name="visible">False</property>
             <property name="can_focus">False</property>
             <property name="margin_top">1</property>
             <property name="margin_bottom">1</property>
             <property name="hexpand">True</property>
             <child>
               <object class="GtkLabel" id="_artist_label">
-                <property name="visible">False</property>
+                <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
                 <property name="halign">start</property>
@@ -113,7 +113,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkBox" id="album_duration_box">
+          <object class="GtkBox" id="_album_duration_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="margin_top">1</property>
@@ -174,12 +174,12 @@
       </object>
     </child>
   </template>
-  <object class="GtkSizeGroup">
+  <object class="GtkSizeGroup" id="_size_group">
     <property name="mode">horizontal</property>
   <widgets>
     <widget name="title_box"/>
-    <widget name="artist_box"/>
-    <widget name="album_duration_box"/>
+    <widget name="_artist_box"/>
+    <widget name="_album_duration_box"/>
   </widgets>
 </object>
 </interface>
diff --git a/gnomemusic/widgets/songwidget.py b/gnomemusic/widgets/songwidget.py
index c51c6ba3..54079c18 100644
--- a/gnomemusic/widgets/songwidget.py
+++ b/gnomemusic/widgets/songwidget.py
@@ -65,6 +65,8 @@ class SongWidget(Gtk.EventBox):
     _playlists = Playlists.get_default()
 
     _album_label = Gtk.Template.Child()
+    _album_duration_box = Gtk.Template.Child()
+    _artist_box = Gtk.Template.Child()
     _artist_label = Gtk.Template.Child()
     _dnd_eventbox = Gtk.Template.Child()
     _select_button = Gtk.Template.Child()
@@ -74,6 +76,7 @@ class SongWidget(Gtk.EventBox):
     _star_eventbox = Gtk.Template.Child()
     _star_image = Gtk.Template.Child()
     _play_icon = Gtk.Template.Child()
+    _size_group = Gtk.Template.Child()
 
     class State(IntEnum):
         """The state of the SongWidget
@@ -119,7 +122,9 @@ class SongWidget(Gtk.EventBox):
             self._album_label.props.visible = True
             artist = self.props.coresong.props.artist
             self._artist_label.props.label = artist
-            self._artist_label.props.visible = True
+            self._artist_box.props.visible = True
+        else:
+            self._size_group.remove_widget(self._album_duration_box)
 
         self._select_button.set_visible(False)
 


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