[gnome-music/wip/mschraal/tageditor: 11/16] songsview: Add renderer for title and artist
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/tageditor: 11/16] songsview: Add renderer for title and artist
- Date: Fri, 22 Nov 2019 15:36:15 +0000 (UTC)
commit d709f241dc4f2880cd6dc272030260832977833d
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 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index c56c4dc2..7ffda3b4 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -33,6 +33,8 @@ from gnomemusic.utils import SongStateIcon
from gnomemusic.views.baseview import BaseView
from gnomemusic.widgets.starhandlerwidget import StarHandlerWidget
+import gnomemusic.utils as utils
+
logger = logging.getLogger(__name__)
@@ -114,6 +116,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(
@@ -126,6 +130,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)
duration_renderer = Gtk.CellRendererText(xalign=1.0)
@@ -138,6 +144,22 @@ 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):
+ 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]