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
This commit is contained in:
parent
ec2bb039ae
commit
b52e74b615
@ -438,7 +438,6 @@ const Keyboard = new Lang.Class({
|
|||||||
_createSource: function () {
|
_createSource: function () {
|
||||||
if (this._source == null) {
|
if (this._source == null) {
|
||||||
this._source = new KeyboardSource(this);
|
this._source = new KeyboardSource(this);
|
||||||
this._source.setTransient(true);
|
|
||||||
Main.messageTray.add(this._source);
|
Main.messageTray.add(this._source);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1263,7 +1263,6 @@ const Source = new Lang.Class({
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
this.iconName = iconName;
|
this.iconName = iconName;
|
||||||
|
|
||||||
this.isTransient = false;
|
|
||||||
this.isChat = false;
|
this.isChat = false;
|
||||||
this.isMuted = false;
|
this.isMuted = false;
|
||||||
this.keepTrayOnSummaryClick = false;
|
this.keepTrayOnSummaryClick = false;
|
||||||
@ -1323,10 +1322,6 @@ const Source = new Lang.Class({
|
|||||||
return rightClickMenu;
|
return rightClickMenu;
|
||||||
},
|
},
|
||||||
|
|
||||||
setTransient: function(isTransient) {
|
|
||||||
this.isTransient = isTransient;
|
|
||||||
},
|
|
||||||
|
|
||||||
setTitle: function(newTitle) {
|
setTitle: function(newTitle) {
|
||||||
this.title = newTitle;
|
this.title = newTitle;
|
||||||
this.emit('title-changed');
|
this.emit('title-changed');
|
||||||
@ -2914,8 +2909,6 @@ const MessageTray = new Lang.Class({
|
|||||||
this._summaryBoxPointerItem.doneShowingNotificationStack();
|
this._summaryBoxPointerItem.doneShowingNotificationStack();
|
||||||
this._summaryBoxPointerItem = null;
|
this._summaryBoxPointerItem = null;
|
||||||
|
|
||||||
if (source.isTransient && !this._reNotifyAfterHideNotification)
|
|
||||||
source.destroy(NotificationDestroyedReason.EXPIRED);
|
|
||||||
if (this._reNotifyAfterHideNotification) {
|
if (this._reNotifyAfterHideNotification) {
|
||||||
this._onNotify(this._reNotifyAfterHideNotification.source, this._reNotifyAfterHideNotification);
|
this._onNotify(this._reNotifyAfterHideNotification.source, this._reNotifyAfterHideNotification);
|
||||||
this._reNotifyAfterHideNotification = null;
|
this._reNotifyAfterHideNotification = null;
|
||||||
@ -2934,7 +2927,6 @@ const SystemNotificationSource = new Lang.Class({
|
|||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.parent(_("System Information"), 'dialog-information-symbolic');
|
this.parent(_("System Information"), 'dialog-information-symbolic');
|
||||||
this.setTransient(true);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open: function() {
|
||||||
|
@ -181,12 +181,10 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Returns the source associated with ndata.notification if it is set.
|
// Returns the source associated with ndata.notification if it is set.
|
||||||
// Otherwise, returns the source associated with the title and pid if
|
// If the existing or requested source is associated with a tray icon
|
||||||
// such source is stored in this._sources and the notification is not
|
// and passed in pid matches a pid of an existing source, the title
|
||||||
// transient. If the existing or requested source is associated with
|
// match is ignored to enable representing a tray icon and notifications
|
||||||
// a tray icon and passed in pid matches a pid of an existing source,
|
// from the same application with a single 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
|
// If no existing source is found, a new source is created as long as
|
||||||
// pid is provided.
|
// pid is provided.
|
||||||
@ -204,32 +202,20 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
if (ndata && ndata.notification)
|
if (ndata && ndata.notification)
|
||||||
return ndata.notification.source;
|
return ndata.notification.source;
|
||||||
|
|
||||||
let isForTransientNotification = (ndata && ndata.hints['transient'] == true);
|
let source = this._lookupSource(title, pid, trayIcon);
|
||||||
|
if (source) {
|
||||||
// We don't want to override a persistent notification
|
source.setTitle(title);
|
||||||
// with a transient one from the same sender, so we
|
return source;
|
||||||
// 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 = new FdoNotificationDaemonSource(title, pid, sender, trayIcon, ndata ? ndata.hints['desktop-entry'] : null);
|
let source = new FdoNotificationDaemonSource(title, pid, sender, trayIcon, ndata ? ndata.hints['desktop-entry'] : null);
|
||||||
source.setTransient(isForTransientNotification);
|
|
||||||
|
|
||||||
if (!isForTransientNotification) {
|
this._sources.push(source);
|
||||||
this._sources.push(source);
|
source.connect('destroy', Lang.bind(this, function() {
|
||||||
source.connect('destroy', Lang.bind(this,
|
let index = this._sources.indexOf(source);
|
||||||
function() {
|
if (index >= 0)
|
||||||
let index = this._sources.indexOf(source);
|
this._sources.splice(index, 1);
|
||||||
if (index >= 0)
|
}));
|
||||||
this._sources.splice(index, 1);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
Main.messageTray.add(source);
|
Main.messageTray.add(source);
|
||||||
return source;
|
return source;
|
||||||
@ -336,20 +322,10 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
let [pid] = result;
|
let [pid] = result;
|
||||||
source = this._getSource(appName, pid, ndata, sender, null);
|
source = this._getSource(appName, pid, ndata, sender, null);
|
||||||
|
|
||||||
// We only store sender-pid entries for persistent sources.
|
this._senderToPid[sender] = pid;
|
||||||
// Removing the entries once the source is destroyed
|
source.connect('destroy', Lang.bind(this, function() {
|
||||||
// would result in the entries associated with transient
|
delete this._senderToPid[sender];
|
||||||
// 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._notifyForSource(source, ndata);
|
this._notifyForSource(source, ndata);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -460,9 +460,6 @@ const MessagesIndicator = new Lang.Class({
|
|||||||
if (source.trayIcon)
|
if (source.trayIcon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (source.isTransient)
|
|
||||||
return;
|
|
||||||
|
|
||||||
source.connect('count-updated', Lang.bind(this, this._updateCount));
|
source.connect('count-updated', Lang.bind(this, this._updateCount));
|
||||||
this._sources.push(source);
|
this._sources.push(source);
|
||||||
this._updateCount();
|
this._updateCount();
|
||||||
|
@ -240,10 +240,6 @@ const NotificationsBox = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_sourceAdded: function(tray, source, initial) {
|
_sourceAdded: function(tray, source, initial) {
|
||||||
// Ignore transient sources
|
|
||||||
if (source.isTransient)
|
|
||||||
return;
|
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
visible: source.policy.showInLockScreen,
|
visible: source.policy.showInLockScreen,
|
||||||
detailed: source.policy.detailsInLockScreen,
|
detailed: source.policy.detailsInLockScreen,
|
||||||
|
Loading…
Reference in New Issue
Block a user