[gnome-shell/wip/gtk-notification: 38/40] messageTray: Remove transient sources
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/gtk-notification: 38/40] messageTray: Remove transient sources
- Date: Mon, 21 Oct 2013 17:18:18 +0000 (UTC)
commit 48b0c4b703f52a7f6b040b28dc99b64a515a61eb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Oct 11 13:13:36 2013 -0400
messageTray: Remove transient sources
As far as I can tell, the only behavior change of a transient source
is that they auto-destroy after viewing their summary box pointer.
Since all transient sources are only associated with transient
notifications, it seems that we can never get to their summary box
pointer in the first place! Remove support for this.
https://bugzilla.gnome.org/show_bug.cgi?id=710115
js/ui/keyboard.js | 1 -
js/ui/messageTray.js | 8 -----
js/ui/notificationDaemon.js | 62 +++++++++++++-----------------------------
js/ui/overviewControls.js | 3 --
js/ui/screenShield.js | 4 ---
5 files changed, 19 insertions(+), 59 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 3201249..87b2642 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -436,7 +436,6 @@ const Keyboard = new Lang.Class({
_createSource: function () {
if (this._source == null) {
this._source = new KeyboardSource(this);
- this._source.setTransient(true);
Main.messageTray.add(this._source);
}
},
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 75c3027..b255a17 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1267,7 +1267,6 @@ const Source = new Lang.Class({
this.title = title;
this.iconName = iconName;
- this.isTransient = false;
this.isChat = false;
this.isMuted = false;
this.keepTrayOnSummaryClick = false;
@@ -1327,10 +1326,6 @@ const Source = new Lang.Class({
return rightClickMenu;
},
- setTransient: function(isTransient) {
- this.isTransient = isTransient;
- },
-
setTitle: function(newTitle) {
this.title = newTitle;
this.emit('title-changed');
@@ -2911,8 +2906,6 @@ const MessageTray = new Lang.Class({
this._summaryBoxPointerItem.doneShowingNotificationStack();
this._summaryBoxPointerItem = null;
- if (source.isTransient && !this._reNotifyAfterHideNotification)
- source.destroy(NotificationDestroyedReason.EXPIRED);
if (this._reNotifyAfterHideNotification) {
this._onNotify(this._reNotifyAfterHideNotification.source,
this._reNotifyAfterHideNotification);
this._reNotifyAfterHideNotification = null;
@@ -2931,7 +2924,6 @@ const SystemNotificationSource = new Lang.Class({
_init: function() {
this.parent(_("System Information"), 'dialog-information-symbolic');
- this.setTransient(true);
},
open: function() {
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 2e9e45c..7027900 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -176,12 +176,10 @@ const FdoNotificationDaemon = new Lang.Class({
},
// Returns the source associated with ndata.notification if it is set.
- // Otherwise, returns the source associated with the title and pid if
- // such source is stored in this._sources and the notification is not
- // transient. If the existing or requested source is associated with
- // a tray icon and passed in pid matches a pid of an existing source,
- // the title match is ignored to enable representing a tray icon and
- // notifications from the same application with a single source.
+ // If the existing or requested source is associated with a tray icon
+ // and passed in pid matches a pid of an existing source, the title
+ // match is ignored to enable representing a tray icon and notifications
+ // from the same application with a single source.
//
// If no existing source is found, a new source is created as long as
// pid is provided.
@@ -199,32 +197,20 @@ const FdoNotificationDaemon = new Lang.Class({
if (ndata && ndata.notification)
return ndata.notification.source;
- let isForTransientNotification = (ndata && ndata.hints['transient'] == true);
-
- // We don't want to override a persistent notification
- // with a transient one from the same sender, so we
- // always create a new source object for new transient notifications
- // and never add it to this._sources .
- if (!isForTransientNotification) {
- let source = this._lookupSource(title, pid, trayIcon);
- if (source) {
- source.setTitle(title);
- return source;
- }
+ let source = this._lookupSource(title, pid, trayIcon);
+ if (source) {
+ source.setTitle(title);
+ return source;
}
let source = new FdoNotificationDaemonSource(title, pid, sender, trayIcon, ndata ?
ndata.hints['desktop-entry'] : null);
- source.setTransient(isForTransientNotification);
-
- if (!isForTransientNotification) {
- this._sources.push(source);
- source.connect('destroy', Lang.bind(this,
- function() {
- let index = this._sources.indexOf(source);
- if (index >= 0)
- this._sources.splice(index, 1);
- }));
- }
+
+ this._sources.push(source);
+ source.connect('destroy', Lang.bind(this, function() {
+ let index = this._sources.indexOf(source);
+ if (index >= 0)
+ this._sources.splice(index, 1);
+ }));
Main.messageTray.add(source);
return source;
@@ -331,20 +317,10 @@ const FdoNotificationDaemon = new Lang.Class({
let [pid] = result;
source = this._getSource(appName, pid, ndata, sender, null);
- // We only store sender-pid entries for persistent sources.
- // Removing the entries once the source is destroyed
- // would result in the entries associated with transient
- // sources removed once the notification is shown anyway.
- // However, keeping these pairs would mean that we would
- // possibly remove an entry associated with a persistent
- // source when a transient source for the same sender is
- // distroyed.
- if (!source.isTransient) {
- this._senderToPid[sender] = pid;
- source.connect('destroy', Lang.bind(this, function() {
- delete this._senderToPid[sender];
- }));
- }
+ this._senderToPid[sender] = pid;
+ source.connect('destroy', Lang.bind(this, function() {
+ delete this._senderToPid[sender];
+ }));
this._notifyForSource(source, ndata);
}));
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 8d18997..8d22206 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -462,9 +462,6 @@ const MessagesIndicator = new Lang.Class({
if (source.trayIcon)
return;
- if (source.isTransient)
- return;
-
source.connect('count-updated', Lang.bind(this, this._updateCount));
this._sources.push(source);
this._updateCount();
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 731122a..1ff334c 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -240,10 +240,6 @@ const NotificationsBox = new Lang.Class({
},
_sourceAdded: function(tray, source, initial) {
- // Ignore transient sources
- if (source.isTransient)
- return;
-
let obj = {
visible: source.policy.showInLockScreen,
detailed: source.policy.detailsInLockScreen,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]