[gnome-music/wip/carlosg/tracker3: 42/68] songsview: Add renderer for title, album and artist



commit 865293f6394377f84237702e204578d2369c8e03
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Sun Aug 4 23:27:18 2019 +0530

    songsview: Add renderer for title, album and artist
    
    Add renderers for title album and artist so that even if
    those tags are modified in the tag editor they will updated in
    songsview.
    
    https://gitlab.gnome.org/GNOME/gnome-music/issues/293

 gnomemusic/views/songsview.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index 267e39cb..845a0795 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -30,6 +30,8 @@ from gnomemusic.player import PlayerPlaylist
 from gnomemusic.utils import SongStateIcon
 from gnomemusic.widgets.starhandlerwidget import StarHandlerWidget
 
+import gnomemusic.utils as utils
+
 
 @Gtk.Template(resource_path="/org/gnome/Music/ui/SongsView.ui")
 class SongsView(Gtk.ScrolledWindow):
@@ -90,6 +92,30 @@ class SongsView(Gtk.ScrolledWindow):
         attrs.insert(Pango.AttrFontFeatures.new("tnum=1"))
         self._duration_renderer.props.attributes = attrs
 
+    def _on_list_widget_album_render(self, coll, cell, model, itr, data):
+        if not model.iter_is_valid(itr):
+            return
+
+        item = model[itr][7]
+        if item:
+            cell.props.text = utils.get_album_title(item.props.media)
+
+    def _on_list_widget_artist_render(self, coll, cell, model, itr, data):
+        if not model.iter_is_valid(itr):
+            return
+
+        item = model[itr][7]
+        if item:
+            cell.props.text = utils.get_artist_name(item.props.media)
+
+    def _on_list_widget_title_render(self, coll, cell, model, itr, data):
+        if not model.iter_is_valid(itr):
+            return
+
+        item = model[itr][7]
+        if item:
+            cell.props.text = utils.get_media_title(item.props.media)
+
     def _on_list_widget_icon_render(self, col, cell, model, itr, data):
         current_song = self._player.props.current_song
         if current_song is None:


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