[gnome-shell] notification-daemon: Add support for 'default' actions
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] notification-daemon: Add support for 'default' actions
- Date: Wed, 3 Aug 2011 18:08:06 +0000 (UTC)
commit ddd59f2e766c511dba6bf8c9e0628fd771187b4e
Author: Florian MÃllner <fmuellner gnome org>
Date: Tue Aug 2 15:42:45 2011 +0200
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 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index d6053e2..8401c9e 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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]