Commit f138d5cc authored by Marinus Schraal's avatar Marinus Schraal

Remove unneeded checks for icon lookup callback value

AlbumArtCache's lookup() guarantees a returned surface, so no need to
check if it is there. Also sneak in an artsize mistake fix.
parent 05404a1e
......@@ -110,8 +110,8 @@ class Player(GObject.GObject):
self._lastState = Gst.State.PAUSED
scale = parent_window.get_scale_factor()
self.cache = AlbumArtCache(scale)
self._no_artwork_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.music,
self._loading_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.loading,
ArtSize.xsmall)
self._missingPluginMessages = []
......@@ -607,7 +607,7 @@ class Player(GObject.GObject):
except:
self._currentAlbum = album
self.coverImg.set_from_surface(self._no_artwork_icon_surface)
self.coverImg.set_from_surface(self._loading_icon_surface)
self.cache.lookup(media, ArtSize.xsmall, self._on_cache_lookup, None)
self._currentTitle = utils.get_media_title(media)
......@@ -661,9 +661,8 @@ class Player(GObject.GObject):
return False
@log
def _on_cache_lookup(self, pixbuf, data=None):
if pixbuf is not None:
self.coverImg.set_from_surface(pixbuf)
def _on_cache_lookup(self, surface, data=None):
self.coverImg.set_from_surface(surface)
self.emit('thumbnail-updated')
@log
......
......@@ -61,10 +61,7 @@ class AlbumWidget(Gtk.EventBox):
self._cache = AlbumArtCache(scale)
self._loading_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.loading,
ArtSize.small)
self._no_artwork_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.music,
ArtSize.small)
ArtSize.large)
self._player = player
self._iter_to_clean = None
......@@ -316,8 +313,6 @@ class AlbumWidget(Gtk.EventBox):
:param path: The filesystem location the pixbuf
:param data: User data
"""
if not surface:
surface = self._no_artwork_icon_surface
self._ui.get_object('cover').set_from_surface(surface)
@log
......
......@@ -64,13 +64,9 @@ class ArtistAlbumWidget(Gtk.Box):
scale = self.get_scale_factor()
self._cache = AlbumArtCache(scale)
self._loading_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.loading,
ArtSize.large)
self._no_artwork_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.music,
ArtSize.large)
self.player = player
self.album = album
......@@ -156,8 +152,6 @@ class ArtistAlbumWidget(Gtk.Box):
@log
def _get_album_cover(self, surface, data=None):
if not surface:
surface = self._no_artwork_icon_surface
self.cover.set_from_surface(surface)
@log
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment