simplified AlbumIconView.add_row()

This commit is contained in:
Martin Wagner 2020-07-04 12:48:35 +02:00
parent ab8430facc
commit 1eaa071e5a

View File

@ -1326,8 +1326,7 @@ class AlbumIconView(Gtk.IconView):
self.store.set_sort_column_id(1, Gtk.SortType.ASCENDING) self.store.set_sort_column_id(1, Gtk.SortType.ASCENDING)
return False return False
def add_row(self, row, cover, size): def add_row(self, row):
row[0]=cover.get_pixbuf(size)
self.store.append(row) self.store.append(row)
return False return False
@ -1371,7 +1370,7 @@ class AlbumIconView(Gtk.IconView):
size=self.settings.get_int("album-cover") size=self.settings.get_int("album-cover")
for i, album in enumerate(albums): for i, album in enumerate(albums):
if not self.stop_flag: if not self.stop_flag:
cover=Cover(lib_path=music_lib, song_file=album["songs"][0]["file"]) cover=Cover(lib_path=music_lib, song_file=album["songs"][0]["file"]).get_pixbuf(size)
# tooltip # tooltip
length_human_readable=ClientHelper.calc_display_length(album["songs"]) length_human_readable=ClientHelper.calc_display_length(album["songs"])
try: try:
@ -1388,7 +1387,7 @@ class AlbumIconView(Gtk.IconView):
display_label_artist=display_label+"\n"+album["artist"] display_label_artist=display_label+"\n"+album["artist"]
display_label=display_label.replace("&", "&") display_label=display_label.replace("&", "&")
display_label_artist=display_label_artist.replace("&", "&") display_label_artist=display_label_artist.replace("&", "&")
GLib.idle_add(self.add_row, [None, display_label, display_label_artist, tooltip, album["album"], album["year"], album["artist"]], cover, size) GLib.idle_add(self.add_row, [cover, display_label, display_label_artist, tooltip, album["album"], album["year"], album["artist"]])
if i%16 == 0: if i%16 == 0:
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration_do(True) Gtk.main_iteration_do(True)