[polari/gnome-3-26] appNotification: Fix account removal on quit
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/gnome-3-26] appNotification: Fix account removal on quit
- Date: Mon, 30 Oct 2017 19:04:06 +0000 (UTC)
commit 43e5fb4d6219a3bf29ea4059ad124853ac57c7f1
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Oct 28 22:18:37 2017 +0200
appNotification: Fix account removal on quit
Application::prepare-shutdown is emitted when the window is destroyed,
after all its children has been destroyed as well - any signal connected
to an AppNotification has been disconnected by then, so even if we called
close as intended it wouldn't have any effect. So to get the intended
behavior, run close() when the notification is destroyed without being
closed before.
src/appNotifications.js | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 1193ba7..c1e44c7 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -1,4 +1,3 @@
-const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Pango = imports.gi.Pango;
const Tp = imports.gi.TelepathyGLib;
@@ -79,25 +78,20 @@ var UndoNotification = new Lang.Class({
this.parent(label);
this._undo = false;
+ this._closed = false;
- this.connect('destroy', Lang.bind(this, this._onDestroy));
+ this.connect('destroy', () => { this.close(); });
this.addButton(_("Undo"), () => { this._undo = true; });
-
- this._app = Gio.Application.get_default();
- this._shutdownId = this._app.connect('prepare-shutdown',
- Lang.bind(this, this.close));
},
close: function() {
+ if (this._closed)
+ return;
+
+ this._closed = true;
this.emit(this._undo ? 'undo' : 'closed');
this.parent();
- },
-
- _onDestroy: function() {
- if (this._shutdownId)
- this._app.disconnect(this._shutdownId);
- this._shutdownId = 0;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]