[gnome-shell/wip/fmuellner/notification-redux+sass: 23/61] messageTray: Make Notification._onClicked handler public



commit f500b7460549eed27b085153d2b8953eae772f7e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 19 00:00:25 2015 +0100

    messageTray: Make Notification._onClicked handler public
    
    When we will start to show notifications in the date drop-down, we
    will not use the actual notification actor, but construct our own UI
    based on Calendar.Message. This is similar to what we already do in
    the lock screen, except that in this case clicking the notification
    should activate the default action.
    So rename the existing _onClicked() method to activate() to make it
    clear that such use is acceptable. While not strictly necessary, also
    rename the corresponding signal to match.

 js/ui/components/autorunManager.js  |    2 +-
 js/ui/components/telepathyClient.js |    2 +-
 js/ui/messageTray.js                |    8 ++++----
 js/ui/notificationDaemon.js         |    6 +++---
 js/ui/windowAttentionHandler.js     |    2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 66a00db..59f5a04 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -363,7 +363,7 @@ const AutorunNotification = new Lang.Class({
         return button;
     },
 
-    _onClicked: function() {
+    activate: function() {
         this.parent();
 
         let app = Gio.app_info_get_default_for_type('inode/directory', false);
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index b3ee48b..66a8735 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -451,7 +451,7 @@ const ChatSource = new Lang.Class({
         this._closedId = this._channel.connect('invalidated', Lang.bind(this, this._channelClosed));
 
         this._notification = new ChatNotification(this);
-        this._notification.connect('clicked', Lang.bind(this, this.open));
+        this._notification.connect('activated', Lang.bind(this, this.open));
         this._notification.setUrgency(MessageTray.Urgency.HIGH);
         this._notifyTimeoutId = 0;
 
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index ffc79a2..4fe17f5 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -513,7 +513,7 @@ const Notification = new Lang.Class({
         this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
         this.actor.add_style_class_name('notification-unexpanded');
         this.actor._delegate = this;
-        this.actor.connect('clicked', Lang.bind(this, this._onClicked));
+        this.actor.connect('clicked', Lang.bind(this, this.activate));
         this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
 
         this._table = new St.Table({ style_class: 'notification',
@@ -1077,8 +1077,8 @@ const Notification = new Lang.Class({
         this.actor.add_style_class_name('notification-unexpanded');
     },
 
-    _onClicked: function() {
-        this.emit('clicked');
+    activate: function() {
+        this.emit('activated');
         // We hide all types of notifications once the user clicks on them because the common
         // outcome of clicking should be the relevant window being brought forward and the user's
         // attention switching to the window.
@@ -2390,7 +2390,7 @@ const MessageTray = new Lang.Class({
                         this.add(source);
                         let notification = new Notification(source, ngettext("%d new message", "%d new 
messages", len).format(len));
                         notification.setTransient(true);
-                        notification.connect('clicked', Lang.bind(this, function() {
+                        notification.connect('activated', Lang.bind(this, function() {
                             this.openTray();
                         }));
                         source.notify(notification);
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index edd32c8..3731a17 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -374,11 +374,11 @@ const FdoNotificationDaemon = new Lang.Class({
         }
 
         if (hasDefaultAction) {
-            notification.connect('clicked', Lang.bind(this, function() {
+            notification.connect('activated', Lang.bind(this, function() {
                 this._emitActionInvoked(ndata.id, 'default');
             }));
         } else {
-            notification.connect('clicked', Lang.bind(this, function() {
+            notification.connect('activated', Lang.bind(this, function() {
                 source.open();
             }));
         }
@@ -648,7 +648,7 @@ const GtkNotificationDaemonNotification = new Lang.Class({
         this._activateAction(action.unpack(), actionTarget);
     },
 
-    _onClicked: function() {
+    activate: function() {
         this._activateAction(this._defaultAction, this._defaultActionTarget);
         this.parent();
     },
diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js
index 3fcaff6..d5e23d2 100644
--- a/js/ui/windowAttentionHandler.js
+++ b/js/ui/windowAttentionHandler.js
@@ -39,7 +39,7 @@ const WindowAttentionHandler = new Lang.Class({
         let [title, banner] = this._getTitleAndBanner(app, window);
 
         let notification = new MessageTray.Notification(source, title, banner);
-        notification.connect('clicked', function() {
+        notification.connect('activated', function() {
             source.open();
         });
         notification.setForFeedback(true);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]