From ddd59f2e766c511dba6bf8c9e0628fd771187b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 2 Aug 2011 15:42:45 +0200 Subject: [PATCH] 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 --- js/ui/notificationDaemon.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index d6053e2c6..8401c9e9a 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -331,8 +331,15 @@ NotificationDaemon.prototype = { if (actions.length) { notification.setUseActionIcons(hints['action-icons'] == true); - for (let i = 0; i < actions.length - 1; i += 2) - notification.addButton(actions[i], actions[i + 1]); + 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]); + } } switch (hints.urgency) { case Urgency.LOW: