[gnome-music] notifications: remove notification on track change
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] notifications: remove notification on track change
- Date: Mon, 29 Feb 2016 11:37:44 +0000 (UTC)
commit f272ae44eed4edfc6719efefcb016504058b768c
Author: Gaurav Narula <gnarula94 gmail com>
Date: Sun Feb 28 01:51:47 2016 +0530
notifications: remove notification on track change
Media Controls in shell make the notifications by gnome-music redundant.
This patch removes the listeners on track change and the handlers for the same.
https://bugzilla.gnome.org/show_bug.cgi?id=762265
gnomemusic/notification.py | 66 --------------------------------------------
1 files changed, 0 insertions(+), 66 deletions(-)
---
diff --git a/gnomemusic/notification.py b/gnomemusic/notification.py
index 81f2ed3..e205b81 100644
--- a/gnomemusic/notification.py
+++ b/gnomemusic/notification.py
@@ -57,72 +57,6 @@ class NotificationManager:
self._noArtworkIcon = self._albumArtCache.get_default_icon(IMAGE_SIZE, IMAGE_SIZE)
self._noArtworkIconSerialized = None
- self._player.connect('playing-changed', self._on_playing_changed)
- self._player.connect('current-changed', self._update_track)
- self._player.connect('thumbnail-updated', self._on_thumbnail_updated)
-
- @log
- def _on_playing_changed(self, player):
- # this function might be called from one of the action handlers
- # from libnotify, and we can't call _set_actions() from there
- # (we would free the closure we're currently in and corrupt
- # the stack)
- GLib.idle_add(self._update_playing)
-
- @log
- def _update_playing(self):
- isPlaying = self._player.playing
-
- if self._isPlaying != isPlaying:
- self._isPlaying = isPlaying
- self._set_actions(isPlaying)
- self._update_track(self._player)
-
- @log
- def _update_track(self, player):
- if not self._player.currentTrack:
- self._notification.update(_("Not playing"), None, 'gnome-music')
- self._notification.set_hint('image-data', None)
- self._notification.show()
- else:
- item = self._player.get_current_media()
- if not item:
- return
- artist = item.get_string(Grl.METADATA_KEY_ARTIST)\
- or item.get_author()\
- or _("Unknown Artist")
- album = item.get_string(Grl.METADATA_KEY_ALBUM)\
- or _("Unknown Album")
-
- self._notification.update(AlbumArtCache.get_media_title(item),
- # TRANSLATORS: by refers to the artist, from to the album
- _("by %s, from %s") % ('<b>' + artist + '</b>',
- '<i>' + album + '</i>'),
- 'gnome-music')
-
- self._notification.show()
-
- @log
- def _on_thumbnail_updated(self, player, path, data=None):
- if path:
- self._notification.set_hint('image-path', GLib.Variant('s', path))
- self._notification.set_hint('image-data', None)
- else:
- if not self._noArtworkIconSerialized:
- rowStride = self._noArtworkIcon.get_rowstride()
- hasAlpha = self._noArtworkIcon.get_has_alpha()
- bitsPerSample = self._noArtworkIcon.get_bits_per_sample()
- nChannels = self._noArtworkIcon.get_n_channels()
- data = self._noArtworkIcon.get_pixels()
-
- self._noArtworkIconSerialized = GLib.Variant(
- '(iiibiiay)',
- (IMAGE_SIZE, IMAGE_SIZE, rowStride, hasAlpha, bitsPerSample, nChannels, data))
-
- self._notification.set_hint('image-path', None)
- self._notification.set_hint('image-data', self._noArtworkIconSerialized)
- self._notification.show()
-
@log
def _set_actions(self, playing):
self._notification.clear_actions()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]