[gnome-music/wip/mschraal/tageditor-13feb2020: 41/41] songsview: Add renderer for title and artist



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

    songsview: Add renderer for title and artist
    
    Add renderers for title and artist so that even if
    title or title 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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index d76cd0e1..31d7f4dc 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -103,6 +103,8 @@ class SongsView(BaseView):
             ellipsize=Pango.EllipsizeMode.END)
         column_title = Gtk.TreeViewColumn("Title", title_renderer, text=2)
         column_title.props.expand = True
+        column_title.set_cell_data_func(
+            title_renderer, self._on_list_widget_title_render, None)
         self._view.append_column(column_title)
 
         artist_renderer = Gtk.CellRendererText(
@@ -115,6 +117,8 @@ class SongsView(BaseView):
             xpad=32, ellipsize=Pango.EllipsizeMode.END)
         column_album = Gtk.TreeViewColumn("Album", album_renderer, text=4)
         column_album.props.expand = True
+        column_artist.set_cell_data_func(
+            artist_renderer, self._on_list_widget_artist_render, None)
         self._view.append_column(column_album)
 
         attrs = Pango.AttrList()
@@ -129,6 +133,14 @@ class SongsView(BaseView):
         self._view.append_column(column_star)
         self._star_handler.add_star_renderers(column_star)
 
+    def _on_list_widget_artist_render(self, coll, cell, model, itr, data):
+        coresong = model[itr][7]
+        cell.props.text = coresong.props.artist
+
+    def _on_list_widget_title_render(self, coll, cell, model, itr, data):
+        coresong = model[itr][7]
+        cell.props.text = coresong.props.title
+
     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]