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



commit 5a3a999459b52c72eb7b5a2af4b3f3ea90ad524a
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 e3ce8778..a9f5baf5 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -104,6 +104,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(
@@ -116,6 +118,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()
@@ -130,6 +134,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]