[gnome-music/wip/mschraal/core: 186/190] Fixes for core on top of new playlists.



commit dfc8621e4dc441fc2539a66a9ef674e29af1c912
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Jul 4 17:32:33 2019 +0200

    Fixes for core on top of new playlists.

 gnomemusic/widgets/sidebarrow.py        |  9 +++++----
 gnomemusic/widgets/starhandlerwidget.py | 11 +++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/widgets/sidebarrow.py b/gnomemusic/widgets/sidebarrow.py
index 09c3020f..06342df8 100644
--- a/gnomemusic/widgets/sidebarrow.py
+++ b/gnomemusic/widgets/sidebarrow.py
@@ -50,7 +50,7 @@ class SidebarRow(Gtk.ListBoxRow):
         return '<SidebarRow>'
 
     @log
-    def __init__(self, coreartist):
+    def __init__(self, coreartist=None):
         super().__init__()
 
         self.props.coreartist = coreartist
@@ -58,9 +58,10 @@ class SidebarRow(Gtk.ListBoxRow):
         self.bind_property(
             'selected', self._check, 'active',
             GObject.BindingFlags.BIDIRECTIONAL)
-        self.bind_property(
-            "selected", coreartist, "selected",
-            GObject.BindingFlags.BIDIRECTIONAL)
+        if coreartist:
+            self.bind_property(
+                "selected", coreartist, "selected",
+                GObject.BindingFlags.BIDIRECTIONAL)
         self.bind_property('selection-mode', self._revealer, 'reveal-child')
         self.bind_property('text', self._label, 'label')
         self.bind_property('text', self._label, 'tooltip-text')
diff --git a/gnomemusic/widgets/starhandlerwidget.py b/gnomemusic/widgets/starhandlerwidget.py
index fa9e01ad..134171ad 100644
--- a/gnomemusic/widgets/starhandlerwidget.py
+++ b/gnomemusic/widgets/starhandlerwidget.py
@@ -22,7 +22,7 @@
 # code, but you are not obligated to do so.  If you do not wish to do so,
 # delete this exception statement from your version.
 
-from gi.repository import GObject, Gtk
+from gi.repository import GObject, Grl, Gtk
 
 from gnomemusic import log
 from gnomemusic.playlists import Playlists
@@ -151,9 +151,12 @@ class StarHandlerWidget(object):
         new_value = not model[_iter][self._star_index]
         model[_iter][self._star_index] = new_value
         coresong = model[_iter][5]
-        coresong.props.favorite = new_value
-        favorite_playlist = playlists.get_smart_playlist("Favorites")
-        playlists.update_smart_playlist(favorite_playlist)
+        # FIXME: Playlists pass a Grl.Media. Not supported at the
+        # moment. Port to core first.
+        if coresong.__gtype__.name != Grl.Media.new().__gtype__.name:
+            coresong.props.favorite = new_value
+            favorite_playlist = playlists.get_smart_playlist("Favorites")
+            playlists.update_smart_playlist(favorite_playlist)
 
         # Use this flag to ignore the upcoming _on_item_activated call
         self.star_renderer_click = True


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