From 65a5baa902469f38dbd63b0432aaab32d560f670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 19 Feb 2015 00:00:25 +0100 Subject: [PATCH] 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. https://bugzilla.gnome.org/show_bug.cgi?id=744817 --- 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 66a00db3d..59f5a048d 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 f6df90578..7758ee2f6 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 ffc79a220..4fe17f5dc 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 edd32c831..3731a17f3 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 3fcaff682..d5e23d2f2 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);