[gnome-music/wip/jfelder/3.34-playlist-deletion: 1/2] notificationspopup: Fix visibility condition
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/3.34-playlist-deletion: 1/2] notificationspopup: Fix visibility condition
- Date: Tue, 7 Jan 2020 11:22:38 +0000 (UTC)
commit 311f49d174d146c7003f83957d2aa491e8c62503
Author: Jean Felder <jfelder src gnome org>
Date: Tue Jan 7 02:13:00 2020 +0100
notificationspopup: Fix visibility condition
The restoration of the loading notifications after the core rewrite
introduced a new use case for NotificationsPopup. When a user deletes
a playlist, two notifications can be triggered: a loading notification
(if the next playlist has not been loaded yet) and a playlist
notification.
The current invisible condition does not handle that case. Thus, the
NotificationsPopup becomes invisible. Indeed, the
`len(self._grid.get_children()) <= 2` condition is not sufficient.
With this change, 2 conditions need to be fulfilled to hide the
NotificationsPopup:
- there is no loading notification (counter is zero)
- the playlists notification are over (the main grid has only one
child or the main grid has two children and a playlist notification
needs to be removed).
(cherry picked from commit a9171e951f256862e8160f4cf739ff86fdb39c5a)
gnomemusic/widgets/notificationspopup.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/widgets/notificationspopup.py b/gnomemusic/widgets/notificationspopup.py
index b9befcdd..dccfdf3a 100644
--- a/gnomemusic/widgets/notificationspopup.py
+++ b/gnomemusic/widgets/notificationspopup.py
@@ -81,8 +81,11 @@ class NotificationsPopup(Gtk.Revealer):
Popup is displayed if a loading is active or if a playlist
deletion is in progress.
"""
- invisible = ((self._loading_notification._counter == 0)
- and (len(self._grid.get_children()) <= 2))
+ loading_finished = self._loading_notification._counter == 0
+ no_other_notif = (len(self._grid.get_children()) == 1
+ or (len(self._grid.get_children()) == 2
+ and notification != self._loading_notification))
+ invisible = loading_finished and no_other_notif
if not invisible:
if remove:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]