[gnome-music/wip/jfelder/discbox-properties-visibility] discbox: Set show properties accordingly



commit 43c9b5a396d5aeffffcfe4843f0289b681b939e2
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jan 10 00:03:13 2020 +0100

    discbox: Set show properties accordingly
    
    duration, favorites and song number visibility of a SongWidget should
    depend on the DiscBox.
    
    This fixes a regression from the core rewrite.

 gnomemusic/widgets/albumwidget.py       |  4 ++--
 gnomemusic/widgets/artistalbumwidget.py |  4 ++--
 gnomemusic/widgets/disclistboxwidget.py | 12 ++++++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index c434a465..24deb5e4 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -123,8 +123,8 @@ class AlbumWidget(Gtk.EventBox):
     def _create_disc_box(self, disc_nr, album_model):
         disc_box = DiscBox(album_model)
         disc_box.set_disc_number(disc_nr)
-        disc_box.props.show_durations = False
-        disc_box.props.show_favorites = False
+        disc_box.props.show_durations = True
+        disc_box.props.show_favorites = True
         disc_box.props.show_song_numbers = True
         disc_box.connect('song-activated', self._song_activated)
 
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index 9d90fb2c..264554ed 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -99,8 +99,8 @@ class ArtistAlbumWidget(Gtk.Box):
     def _create_disc_box(self, disc_nr, album_model):
         disc_box = DiscBox(album_model)
         disc_box.set_disc_number(disc_nr)
-        disc_box.props.show_durations = False
-        disc_box.props.show_favorites = False
+        disc_box.props.show_durations = True
+        disc_box.props.show_favorites = True
         disc_box.props.show_song_numbers = True
         disc_box.connect('song-activated', self._song_activated)
 
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index 1df609f9..1ae1411c 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -105,6 +105,18 @@ class DiscBox(Gtk.Box):
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
 
+        self.bind_property(
+            "show-durations", song_widget, "show-duration",
+            GObject.BindingFlags.SYNC_CREATE)
+
+        self.bind_property(
+            "show-favorites", song_widget, "show-favorite",
+            GObject.BindingFlags.SYNC_CREATE)
+
+        self.bind_property(
+            "show-song-numbers", song_widget, "show-song-number",
+            GObject.BindingFlags.SYNC_CREATE)
+
         song_widget.connect('button-release-event', self._song_activated)
 
         return song_widget


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