[gnome-music] Remove unneeded checks for icon lookup callback value
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Remove unneeded checks for icon lookup callback value
- Date: Tue, 11 Oct 2016 11:37:13 +0000 (UTC)
commit f138d5ccf8b12d6643be18946a2f77bcac21863b
Author: Marinus Schraal <mschraal src gnome org>
Date: Tue Oct 11 13:21:53 2016 +0200
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.
gnomemusic/player.py | 11 +++++------
gnomemusic/widgets/albumwidget.py | 7 +------
gnomemusic/widgets/artistalbumwidget.py | 6 ------
3 files changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index c22c2ee..18a3946 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -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
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 603254a..ab08d24 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -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
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index 41016fa..066ea73 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]