[gnome-music] notificationspopup : Add a close button
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] notificationspopup : Add a close button
- Date: Mon, 30 Mar 2020 14:26:45 +0000 (UTC)
commit 8980060c208c25549fa089d4ccb9402ccc2bb01e
Author: Chinmay Gurjar <chnmgurjar gmail com>
Date: Mon Mar 30 16:10:59 2020 +0200
notificationspopup : Add a close button
Add a close button to the Notifications popup to close it before the
default time.
Closes: #259
gnomemusic/widgets/notificationspopup.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/gnomemusic/widgets/notificationspopup.py b/gnomemusic/widgets/notificationspopup.py
index 25025149..83544e59 100644
--- a/gnomemusic/widgets/notificationspopup.py
+++ b/gnomemusic/widgets/notificationspopup.py
@@ -217,9 +217,15 @@ class PlaylistNotification(Gtk.Grid):
label=message, halign=Gtk.Align.START, hexpand=True)
self.add(self._label)
+ close_button = Gtk.Button.new_from_icon_name(
+ "window-close-symbolic", Gtk.IconSize.BUTTON)
+ close_button.connect("clicked", self._close_notification)
+ close_button.props.relief = Gtk.ReliefStyle.NONE
+
undo_button = Gtk.Button.new_with_mnemonic(_("_Undo"))
undo_button.connect("clicked", self._undo_deletion)
self.add(undo_button)
+ self.add(close_button)
self.show_all()
if self.type_ == PlaylistNotification.Type.PLAYLIST:
@@ -254,6 +260,13 @@ class PlaylistNotification(Gtk.Grid):
self._playlist.undo_pending_song_deletion(
self._coresong, self._position)
+ def _close_notification(self, widget_):
+ if self._timeout_id > 0:
+ GLib.source_remove(self._timeout_id)
+ self._timeout_id = 0
+
+ self._finish_deletion()
+
def _finish_deletion(self):
self._notifications_popup.remove_notification(self)
if self.type_ == PlaylistNotification.Type.PLAYLIST:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]