notification-daemon: Add support for 'default' actions
The notification spec supports the concept of a 'default' action: "The default action (usually invoked my clicking the notification) should have a key named "default". The name can be anything, though implementations are free not to display it." Support this by invoking the 'default' action rather than a emitting the 'clicked' signal when clicking notifications which specifie a default action. Also don't add an action button for the default action. https://bugzilla.gnome.org/show_bug.cgi?id=655818
This commit is contained in:
parent
10a0f2b614
commit
ddd59f2e76
@ -331,9 +331,16 @@ NotificationDaemon.prototype = {
|
|||||||
|
|
||||||
if (actions.length) {
|
if (actions.length) {
|
||||||
notification.setUseActionIcons(hints['action-icons'] == true);
|
notification.setUseActionIcons(hints['action-icons'] == true);
|
||||||
for (let i = 0; i < actions.length - 1; i += 2)
|
for (let i = 0; i < actions.length - 1; i += 2) {
|
||||||
|
if (actions[i] == 'default')
|
||||||
|
notification.connect('clicked', Lang.bind(this,
|
||||||
|
function() {
|
||||||
|
this._emitActionInvoked(id, "default");
|
||||||
|
});
|
||||||
|
else
|
||||||
notification.addButton(actions[i], actions[i + 1]);
|
notification.addButton(actions[i], actions[i + 1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
switch (hints.urgency) {
|
switch (hints.urgency) {
|
||||||
case Urgency.LOW:
|
case Urgency.LOW:
|
||||||
notification.setUrgency(MessageTray.Urgency.LOW);
|
notification.setUrgency(MessageTray.Urgency.LOW);
|
||||||
|
Loading…
Reference in New Issue
Block a user