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
This commit is contained in:
Florian Müllner 2015-02-19 00:00:25 +01:00
parent e404369c0f
commit 65a5baa902
5 changed files with 10 additions and 10 deletions

View File

@ -363,7 +363,7 @@ const AutorunNotification = new Lang.Class({
return button; return button;
}, },
_onClicked: function() { activate: function() {
this.parent(); this.parent();
let app = Gio.app_info_get_default_for_type('inode/directory', false); let app = Gio.app_info_get_default_for_type('inode/directory', false);

View File

@ -451,7 +451,7 @@ const ChatSource = new Lang.Class({
this._closedId = this._channel.connect('invalidated', Lang.bind(this, this._channelClosed)); this._closedId = this._channel.connect('invalidated', Lang.bind(this, this._channelClosed));
this._notification = new ChatNotification(this); 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._notification.setUrgency(MessageTray.Urgency.HIGH);
this._notifyTimeoutId = 0; this._notifyTimeoutId = 0;

View File

@ -513,7 +513,7 @@ const Notification = new Lang.Class({
this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION }); this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
this.actor.add_style_class_name('notification-unexpanded'); this.actor.add_style_class_name('notification-unexpanded');
this.actor._delegate = this; 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.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._table = new St.Table({ style_class: 'notification', 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'); this.actor.add_style_class_name('notification-unexpanded');
}, },
_onClicked: function() { activate: function() {
this.emit('clicked'); this.emit('activated');
// We hide all types of notifications once the user clicks on them because the common // 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 // outcome of clicking should be the relevant window being brought forward and the user's
// attention switching to the window. // attention switching to the window.
@ -2390,7 +2390,7 @@ const MessageTray = new Lang.Class({
this.add(source); this.add(source);
let notification = new Notification(source, ngettext("%d new message", "%d new messages", len).format(len)); let notification = new Notification(source, ngettext("%d new message", "%d new messages", len).format(len));
notification.setTransient(true); notification.setTransient(true);
notification.connect('clicked', Lang.bind(this, function() { notification.connect('activated', Lang.bind(this, function() {
this.openTray(); this.openTray();
})); }));
source.notify(notification); source.notify(notification);

View File

@ -374,11 +374,11 @@ const FdoNotificationDaemon = new Lang.Class({
} }
if (hasDefaultAction) { if (hasDefaultAction) {
notification.connect('clicked', Lang.bind(this, function() { notification.connect('activated', Lang.bind(this, function() {
this._emitActionInvoked(ndata.id, 'default'); this._emitActionInvoked(ndata.id, 'default');
})); }));
} else { } else {
notification.connect('clicked', Lang.bind(this, function() { notification.connect('activated', Lang.bind(this, function() {
source.open(); source.open();
})); }));
} }
@ -648,7 +648,7 @@ const GtkNotificationDaemonNotification = new Lang.Class({
this._activateAction(action.unpack(), actionTarget); this._activateAction(action.unpack(), actionTarget);
}, },
_onClicked: function() { activate: function() {
this._activateAction(this._defaultAction, this._defaultActionTarget); this._activateAction(this._defaultAction, this._defaultActionTarget);
this.parent(); this.parent();
}, },

View File

@ -39,7 +39,7 @@ const WindowAttentionHandler = new Lang.Class({
let [title, banner] = this._getTitleAndBanner(app, window); let [title, banner] = this._getTitleAndBanner(app, window);
let notification = new MessageTray.Notification(source, title, banner); let notification = new MessageTray.Notification(source, title, banner);
notification.connect('clicked', function() { notification.connect('activated', function() {
source.open(); source.open();
}); });
notification.setForFeedback(true); notification.setForFeedback(true);