Show feedback notifications when the user is busy
Notifications that are created in response to direct user actions like "is ready" or "'foo' has been removed from favorites" should always be displayed even though the user has marked him/herself busy. https://bugzilla.gnome.org/show_bug.cgi?id=662900
This commit is contained in:
parent
1397c7c624
commit
39d9838cc1
@ -84,9 +84,12 @@ const AppFavorites = new Lang.Class({
|
|||||||
|
|
||||||
let app = Shell.AppSystem.get_default().lookup_app(appId);
|
let app = Shell.AppSystem.get_default().lookup_app(appId);
|
||||||
|
|
||||||
Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()), Lang.bind(this, function () {
|
Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()),
|
||||||
this._removeFavorite(appId);
|
{ forFeedback: true,
|
||||||
}));
|
undoCallback: Lang.bind(this, function () {
|
||||||
|
this._removeFavorite(appId);
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addFavorite: function(appId) {
|
addFavorite: function(appId) {
|
||||||
@ -116,9 +119,11 @@ const AppFavorites = new Lang.Class({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
|
Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
|
||||||
Lang.bind(this, function () {
|
{ forFeedback: true,
|
||||||
this._addFavorite(appId, pos);
|
undoCallback: Lang.bind(this, function () {
|
||||||
}));
|
this._addFavorite(appId, pos);
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Signals.addSignalMethods(AppFavorites.prototype);
|
Signals.addSignalMethods(AppFavorites.prototype);
|
||||||
|
@ -314,6 +314,7 @@ const Notification = new Lang.Class({
|
|||||||
this.resident = false;
|
this.resident = false;
|
||||||
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
||||||
this.isTransient = false;
|
this.isTransient = false;
|
||||||
|
this.forFeedback = false;
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
this.focused = false;
|
this.focused = false;
|
||||||
this.acknowledged = false;
|
this.acknowledged = false;
|
||||||
@ -713,6 +714,10 @@ const Notification = new Lang.Class({
|
|||||||
this.isTransient = isTransient;
|
this.isTransient = isTransient;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setForFeedback: function(forFeedback) {
|
||||||
|
this.forFeedback = forFeedback;
|
||||||
|
},
|
||||||
|
|
||||||
setUseActionIcons: function(useIcons) {
|
setUseActionIcons: function(useIcons) {
|
||||||
this._useActionIcons = useIcons;
|
this._useActionIcons = useIcons;
|
||||||
},
|
},
|
||||||
@ -1949,8 +1954,9 @@ const MessageTray = new Lang.Class({
|
|||||||
// Notifications
|
// Notifications
|
||||||
let notificationQueue = this._notificationQueue;
|
let notificationQueue = this._notificationQueue;
|
||||||
let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL;
|
let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL;
|
||||||
|
let notificationForFeedback = notificationQueue.length > 0 && notificationQueue[0].forFeedback;
|
||||||
let notificationsLimited = this._busy || this._inFullscreen;
|
let notificationsLimited = this._busy || this._inFullscreen;
|
||||||
let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent) && Main.sessionMode.hasNotifications;
|
let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent || notificationForFeedback) && Main.sessionMode.hasNotifications;
|
||||||
let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
|
let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
|
||||||
let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
|
let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
|
||||||
let notificationExpanded = this._notification && this._notification.expanded;
|
let notificationExpanded = this._notification && this._notification.expanded;
|
||||||
|
@ -57,7 +57,14 @@ const ShellInfo = new Lang.Class({
|
|||||||
this._source.destroy();
|
this._source.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
setMessage: function(text, undoCallback, undoLabel) {
|
setMessage: function(text, options) {
|
||||||
|
options = Params.parse(options, { undoCallback: null,
|
||||||
|
forFeedback: false
|
||||||
|
});
|
||||||
|
|
||||||
|
let undoCallback = options.undoCallback;
|
||||||
|
let forFeedback = options.forFeedback;
|
||||||
|
|
||||||
if (this._source == null) {
|
if (this._source == null) {
|
||||||
this._source = new MessageTray.SystemNotificationSource();
|
this._source = new MessageTray.SystemNotificationSource();
|
||||||
this._source.connect('destroy', Lang.bind(this,
|
this._source.connect('destroy', Lang.bind(this,
|
||||||
@ -71,6 +78,7 @@ const ShellInfo = new Lang.Class({
|
|||||||
if (this._source.notifications.length == 0) {
|
if (this._source.notifications.length == 0) {
|
||||||
notification = new MessageTray.Notification(this._source, text, null);
|
notification = new MessageTray.Notification(this._source, text, null);
|
||||||
notification.setTransient(true);
|
notification.setTransient(true);
|
||||||
|
notification.setForFeedback(forFeedback);
|
||||||
} else {
|
} else {
|
||||||
notification = this._source.notifications[0];
|
notification = this._source.notifications[0];
|
||||||
notification.update(text, null, { clear: true });
|
notification.update(text, null, { clear: true });
|
||||||
@ -78,10 +86,8 @@ const ShellInfo = new Lang.Class({
|
|||||||
|
|
||||||
this._undoCallback = undoCallback;
|
this._undoCallback = undoCallback;
|
||||||
if (undoCallback) {
|
if (undoCallback) {
|
||||||
notification.addButton('system-undo',
|
notification.addButton('system-undo', _("Undo"));
|
||||||
undoLabel ? undoLabel : _("Undo"));
|
notification.connect('action-invoked', Lang.bind(this, this._onUndoClicked));
|
||||||
notification.connect('action-invoked',
|
|
||||||
Lang.bind(this, this._onUndoClicked));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._source.notify(notification);
|
this._source.notify(notification);
|
||||||
@ -233,11 +239,16 @@ const Overview = new Lang.Class({
|
|||||||
this._viewSelector.removeSearchProvider(provider);
|
this._viewSelector.removeSearchProvider(provider);
|
||||||
},
|
},
|
||||||
|
|
||||||
setMessage: function(text, undoCallback, undoLabel) {
|
//
|
||||||
|
// options:
|
||||||
|
// - undoCallback (function): the callback to be called if undo support is needed
|
||||||
|
// - forFeedback (boolean): whether the message is for direct feedback of a user action
|
||||||
|
//
|
||||||
|
setMessage: function(text, options) {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._shellInfo.setMessage(text, undoCallback, undoLabel);
|
this._shellInfo.setMessage(text, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin: function() {
|
||||||
|
@ -39,6 +39,8 @@ const WindowAttentionHandler = new Lang.Class({
|
|||||||
let [title, banner] = this._getTitleAndBanner(app, window);
|
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||||
|
|
||||||
let notification = new MessageTray.Notification(source, title, banner);
|
let notification = new MessageTray.Notification(source, title, banner);
|
||||||
|
notification.setForFeedback(true);
|
||||||
|
|
||||||
source.notify(notification);
|
source.notify(notification);
|
||||||
|
|
||||||
source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {
|
source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user