Port message tray sources and notifications to class framework

Third step in the class framework port, now it's the turn of
MessageTray.Source and MessageTray.Notification, as well as
the various implementations around the shell.

https://bugzilla.gnome.org/show_bug.cgi?id=664436
This commit is contained in:
Giovanni Campagna 2011-11-20 16:12:02 +01:00
parent 566bdb50c2
commit b356aa8e3b
9 changed files with 162 additions and 254 deletions

View File

@ -261,15 +261,12 @@ AutorunManager.prototype = {
}, },
} }
function AutorunResidentSource() { const AutorunResidentSource = new Lang.Class({
this._init(); Name: 'AutorunResidentSource',
} Extends: MessageTray.Source,
AutorunResidentSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function() { _init: function() {
MessageTray.Source.prototype._init.call(this, _("Removable Devices")); this.parent(_("Removable Devices"));
this._mounts = []; this._mounts = [];
@ -324,19 +321,14 @@ AutorunResidentSource.prototype = {
icon_type: St.IconType.FULLCOLOR, icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE }); icon_size: this.ICON_SIZE });
} }
} });
function AutorunResidentNotification(source) { const AutorunResidentNotification = new Lang.Class({
this._init(source); Name: 'AutorunResidentNotification',
} Extends: MessageTray.Notification,
AutorunResidentNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source) { _init: function(source) {
MessageTray.Notification.prototype._init.call(this, source, this.parent(source, source.title, null, { customContent: true });
source.title, null,
{ customContent: true });
// set the notification as resident // set the notification as resident
this.setResident(true); this.setResident(true);
@ -410,7 +402,7 @@ AutorunResidentNotification.prototype = {
return item; return item;
}, },
} });
function AutorunTransientDispatcher() { function AutorunTransientDispatcher() {
this._init(); this._init();
@ -509,15 +501,12 @@ AutorunTransientDispatcher.prototype = {
} }
} }
function AutorunTransientSource(mount, apps) { const AutorunTransientSource = new Lang.Class({
this._init(mount, apps); Name: 'AutorunTransientSource',
} Extends: MessageTray.Source,
AutorunTransientSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(mount, apps) { _init: function(mount, apps) {
MessageTray.Source.prototype._init.call(this, mount.get_name()); this.parent(mount.get_name());
this.mount = mount; this.mount = mount;
this.apps = apps; this.apps = apps;
@ -534,19 +523,14 @@ AutorunTransientSource.prototype = {
return new St.Icon({ gicon: this.mount.get_icon(), return new St.Icon({ gicon: this.mount.get_icon(),
icon_size: this.ICON_SIZE }); icon_size: this.ICON_SIZE });
} }
} });
function AutorunTransientNotification(source) { const AutorunTransientNotification = new Lang.Class({
this._init(source); Name: 'AutorunTransientNotification',
} Extends: MessageTray.Notification,
AutorunTransientNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source) { _init: function(source) {
MessageTray.Notification.prototype._init.call(this, source, this.parent(source, source.title, null, { customContent: true });
source.title, null,
{ customContent: true });
this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box', this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box',
vertical: true }); vertical: true });
@ -621,5 +605,5 @@ AutorunTransientNotification.prototype = {
return button; return button;
} }
} });

View File

@ -535,16 +535,13 @@ Keyboard.prototype = {
}; };
DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface); DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface);
function KeyboardSource() { const KeyboardSource = new Lang.Class({
this._init.apply(this, arguments); Name: 'KeyboardSource',
} Extends: MessageTray.Source,
KeyboardSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(keyboard) { _init: function(keyboard) {
this.parent(_("Keyboard"));
this._keyboard = keyboard; this._keyboard = keyboard;
MessageTray.Source.prototype._init.call(this, _("Keyboard"));
this._setSummaryIcon(this.createNotificationIcon()); this._setSummaryIcon(this.createNotificationIcon());
}, },
@ -555,7 +552,7 @@ KeyboardSource.prototype = {
icon_size: this.ICON_SIZE }); icon_size: this.ICON_SIZE });
}, },
handleSummaryClick: function() { handleSummaryClick: function() {
let event = Clutter.get_current_event(); let event = Clutter.get_current_event();
if (event.type() != Clutter.EventType.BUTTON_RELEASE) if (event.type() != Clutter.EventType.BUTTON_RELEASE)
return false; return false;
@ -567,4 +564,4 @@ KeyboardSource.prototype = {
open: function() { open: function() {
this._keyboard.show(); this._keyboard.show();
} }
}; });

View File

@ -408,11 +408,9 @@ Signals.addSignalMethods(FocusGrabber.prototype);
// the content and the action area of the notification will be cleared. // the content and the action area of the notification will be cleared.
// The content area is also always cleared if 'customContent' is false // The content area is also always cleared if 'customContent' is false
// because it might contain the @banner that didn't fit in the banner mode. // because it might contain the @banner that didn't fit in the banner mode.
function Notification(source, title, banner, params) { const Notification = new Lang.Class({
this._init(source, title, banner, params); Name: 'Notification',
}
Notification.prototype = {
IMAGE_SIZE: 125, IMAGE_SIZE: 125,
_init: function(source, title, banner, params) { _init: function(source, title, banner, params) {
@ -953,14 +951,12 @@ Notification.prototype = {
this.actor.destroy(); this.actor.destroy();
this.actor._delegate = null; this.actor._delegate = null;
} }
}; });
Signals.addSignalMethods(Notification.prototype); Signals.addSignalMethods(Notification.prototype);
function Source(title) { const Source = new Lang.Class({
this._init(title); Name: 'MessageTraySource',
}
Source.prototype = {
ICON_SIZE: 24, ICON_SIZE: 24,
_init: function(title) { _init: function(title) {
@ -1142,7 +1138,7 @@ Source.prototype = {
_lastNotificationRemoved: function() { _lastNotificationRemoved: function() {
this.destroy(); this.destroy();
} }
}; });
Signals.addSignalMethods(Source.prototype); Signals.addSignalMethods(Source.prototype);
function SummaryItem(source) { function SummaryItem(source) {
@ -2428,15 +2424,12 @@ MessageTray.prototype = {
} }
}; };
function SystemNotificationSource() { const SystemNotificationSource = new Lang.Class({
this._init(); Name: 'SystemNotificationSource',
} Extends: Source,
SystemNotificationSource.prototype = {
__proto__: Source.prototype,
_init: function() { _init: function() {
Source.prototype._init.call(this, _("System Information")); this.parent(_("System Information"));
this._setSummaryIcon(this.createNotificationIcon()); this._setSummaryIcon(this.createNotificationIcon());
}, },
@ -2450,4 +2443,4 @@ SystemNotificationSource.prototype = {
open: function() { open: function() {
this.destroy(); this.destroy();
} }
}; });

View File

@ -476,15 +476,12 @@ NotificationDaemon.prototype = {
} }
}; };
function Source(title, pid, sender) { const Source = new Lang.Class({
this._init(title, pid, sender); Name: 'NotificationDaemonSource',
} Extends: MessageTray.Source,
Source.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(title, pid, sender) { _init: function(title, pid, sender) {
MessageTray.Source.prototype._init.call(this, title); this.parent(title);
this._pid = pid; this._pid = pid;
if (sender) if (sender)
@ -606,6 +603,6 @@ Source.prototype = {
this._nameWatcherId = 0; this._nameWatcherId = 0;
} }
MessageTray.Source.prototype.destroy.call(this); this.parent();
} }
}; });

View File

@ -239,16 +239,13 @@ ShellMountQuestionDialog.prototype = {
} }
Signals.addSignalMethods(ShellMountQuestionDialog.prototype); Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
function ShellMountPasswordSource(message, icon, reaskPassword) { const ShellMountPasswordSource = new Lang.Class({
this._init(message, icon, reaskPassword); Name: 'ShellMountPasswordSource',
} Extends: MessageTray.Source,
ShellMountPasswordSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(message, icon, reaskPassword) { _init: function(message, icon, reaskPassword) {
let strings = message.split('\n'); let strings = message.split('\n');
MessageTray.Source.prototype._init.call(this, strings[0]); this.parent(strings[0]);
this._notification = new ShellMountPasswordNotification(this, strings, icon, reaskPassword); this._notification = new ShellMountPasswordNotification(this, strings, icon, reaskPassword);
@ -256,21 +253,15 @@ ShellMountPasswordSource.prototype = {
Main.messageTray.add(this); Main.messageTray.add(this);
this.notify(this._notification); this.notify(this._notification);
}, },
} });
Signals.addSignalMethods(ShellMountPasswordSource.prototype); Signals.addSignalMethods(ShellMountPasswordSource.prototype);
function ShellMountPasswordNotification(source, strings, icon, reaskPassword) { const ShellMountPasswordNotification = new Lang.Class({
this._init(source, strings, icon, reaskPassword); Name: 'ShellMountPasswordNotification',
} Extends: MessageTray.Notification,
ShellMountPasswordNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, strings, icon, reaskPassword) { _init: function(source, strings, icon, reaskPassword) {
MessageTray.Notification.prototype._init.call(this, source, this.parent(source, strings[0], null, { customContent: true, icon: icon });
strings[0], null,
{ customContent: true,
icon: icon });
// set the notification to transient and urgent, so that it // set the notification to transient and urgent, so that it
// expands out // expands out
@ -305,7 +296,7 @@ ShellMountPasswordNotification.prototype = {
this.source.emit('password-ready', text); this.source.emit('password-ready', text);
} }
} });
function ShellProcessesDialog(icon) { function ShellProcessesDialog(icon) {
this._init(icon); this._init(icon);

View File

@ -334,15 +334,12 @@ const Indicator = new Lang.Class({
} }
}); });
function Source() { const Source = new Lang.Class({
this._init.apply(this, arguments); Name: 'BluetoothSource',
} Extends: MessageTray.Source,
Source.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function() { _init: function() {
MessageTray.Source.prototype._init.call(this, _("Bluetooth")); this.parent(_("Bluetooth"));
this._setSummaryIcon(this.createNotificationIcon()); this._setSummaryIcon(this.createNotificationIcon());
}, },
@ -364,21 +361,17 @@ Source.prototype = {
icon_type: St.IconType.SYMBOLIC, icon_type: St.IconType.SYMBOLIC,
icon_size: this.ICON_SIZE }); icon_size: this.ICON_SIZE });
} }
} });
function AuthNotification() { const AuthNotification = new Lang.Class({
this._init.apply(this, arguments); Name: 'AuthNotification',
} Extends: MessageTray.Notification,
AuthNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, applet, device_path, name, long_name, uuid) { _init: function(source, applet, device_path, name, long_name, uuid) {
MessageTray.Notification.prototype._init.call(this, this.parent(source,
source, _("Bluetooth"),
_("Bluetooth"), _("Authorization request from %s").format(name),
_("Authorization request from %s").format(name), { customContent: true });
{ customContent: true });
this.setResident(true); this.setResident(true);
this._applet = applet; this._applet = applet;
@ -404,21 +397,17 @@ AuthNotification.prototype = {
this.destroy(); this.destroy();
})); }));
} }
} });
function ConfirmNotification() { const ConfirmNotification = new Lang.Class({
this._init.apply(this, arguments); Name: 'ConfirmNotification',
} Extends: MessageTray.Notification,
ConfirmNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, applet, device_path, name, long_name, pin) { _init: function(source, applet, device_path, name, long_name, pin) {
MessageTray.Notification.prototype._init.call(this, this.parent(source,
source, _("Bluetooth"),
_("Bluetooth"), _("Pairing confirmation for %s").format(name),
_("Pairing confirmation for %s").format(name), { customContent: true });
{ customContent: true });
this.setResident(true); this.setResident(true);
this._applet = applet; this._applet = applet;
@ -437,21 +426,17 @@ ConfirmNotification.prototype = {
this.destroy(); this.destroy();
})); }));
} }
} });
function PinNotification() { const PinNotification = new Lang.Class({
this._init.apply(this, arguments); Name: 'PinNotification',
} Extends: MessageTray.Notification,
PinNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, applet, device_path, name, long_name, numeric) { _init: function(source, applet, device_path, name, long_name, numeric) {
MessageTray.Notification.prototype._init.call(this, this.parent(source,
source, _("Bluetooth"),
_("Bluetooth"), _("Pairing request for %s").format(name),
_("Pairing request for %s").format(name), { customContent: true });
{ customContent: true });
this.setResident(true); this.setResident(true);
this._applet = applet; this._applet = applet;
@ -503,4 +488,4 @@ PinNotification.prototype = {
MessageTray.Notification.prototype.grabFocus.call(this, lockTray); MessageTray.Notification.prototype.grabFocus.call(this, lockTray);
global.stage.set_key_focus(this._entry); global.stage.set_key_focus(this._entry);
} }
} });

View File

@ -2121,15 +2121,12 @@ const NMApplet = new Lang.Class({
} }
}); });
function NMMessageTraySource() { const NMMessageTraySource = new Lang.Class({
this._init(); Name: 'NMMessageTraySource',
} Extends: MessageTray.Source,
NMMessageTraySource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function() { _init: function() {
MessageTray.Source.prototype._init.call(this, _("Network Manager")); this.parent(_("Network Manager"));
let icon = new St.Icon({ icon_name: 'network-transmit-receive', let icon = new St.Icon({ icon_name: 'network-transmit-receive',
icon_type: St.IconType.SYMBOLIC, icon_type: St.IconType.SYMBOLIC,
@ -2137,4 +2134,4 @@ NMMessageTraySource.prototype = {
}); });
this._setSummaryIcon(icon); this._setSummaryIcon(icon);
} }
}; });

View File

@ -481,15 +481,12 @@ Client.prototype = {
} }
}; };
function ChatSource(account, conn, channel, contact, client) { const ChatSource = new Lang.Class({
this._init(account, conn, channel, contact, client); Name: 'ChatSource',
} Extends: MessageTray.Source,
ChatSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(account, conn, channel, contact, client) { _init: function(account, conn, channel, contact, client) {
MessageTray.Source.prototype._init.call(this, contact.get_alias()); this.parent(contact.get_alias());
this.isChat = true; this.isChat = true;
@ -798,17 +795,14 @@ ChatSource.prototype = {
this._shouldAck = false; this._shouldAck = false;
} }
}; });
function ChatNotification(source) { const ChatNotification = new Lang.Class({
this._init(source); Name: 'ChatNotification',
} Extends: MessageTray.Notification,
ChatNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source) { _init: function(source) {
MessageTray.Notification.prototype._init.call(this, source, source.title, null, { customContent: true }); this.parent(source, source.title, null, { customContent: true });
this.setResident(true); this.setResident(true);
this._responseEntry = new St.Entry({ style_class: 'chat-response', this._responseEntry = new St.Entry({ style_class: 'chat-response',
@ -1091,17 +1085,14 @@ ChatNotification.prototype = {
this.source.setChatState(Tp.ChannelChatState.ACTIVE); this.source.setChatState(Tp.ChannelChatState.ACTIVE);
} }
} }
}; });
function ApproverSource(dispatchOp, text, gicon) { const ApproverSource = new Lang.Class({
this._init(dispatchOp, text, gicon); Name: 'ApproverSource',
} Extends: MessageTray.Source,
ApproverSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(dispatchOp, text, gicon) { _init: function(dispatchOp, text, gicon) {
MessageTray.Source.prototype._init.call(this, text); this.parent(text);
this._gicon = gicon; this._gicon = gicon;
this._setSummaryIcon(this.createNotificationIcon()); this._setSummaryIcon(this.createNotificationIcon());
@ -1130,23 +1121,19 @@ ApproverSource.prototype = {
icon_type: St.IconType.FULLCOLOR, icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE }); icon_size: this.ICON_SIZE });
} }
} });
function RoomInviteNotification(source, dispatchOp, channel, inviter) { const RoomInviteNotification = new Lang.Class({
this._init(source, dispatchOp, channel, inviter); Name: 'RoomInviteNotification',
} Extends: MessageTray.Notification,
RoomInviteNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, dispatchOp, channel, inviter) { _init: function(source, dispatchOp, channel, inviter) {
MessageTray.Notification.prototype._init.call(this, this.parent(source,
source, /* translators: argument is a room name like
/* translators: argument is a room name like * room@jabber.org for example. */
* room@jabber.org for example. */ _("Invitation to %s").format(channel.get_identifier()),
_("Invitation to %s").format(channel.get_identifier()), null,
null, { customContent: true });
{ customContent: true });
this.setResident(true); this.setResident(true);
/* translators: first argument is the name of a contact and the second /* translators: first argument is the name of a contact and the second
@ -1173,15 +1160,12 @@ RoomInviteNotification.prototype = {
this.destroy(); this.destroy();
})); }));
} }
}; });
// Audio Video // Audio Video
function AudioVideoNotification(source, dispatchOp, channel, contact, isVideo) { const AudioVideoNotification = new Lang.Class({
this._init(source, dispatchOp, channel, contact, isVideo); Name: 'AudioVideoNotification',
} Extends: MessageTray.Notification,
AudioVideoNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, dispatchOp, channel, contact, isVideo) { _init: function(source, dispatchOp, channel, contact, isVideo) {
let title = ''; let title = '';
@ -1193,11 +1177,7 @@ AudioVideoNotification.prototype = {
/* translators: argument is a contact name like Alice for example. */ /* translators: argument is a contact name like Alice for example. */
title = _("Call from %s").format(contact.get_alias()); title = _("Call from %s").format(contact.get_alias());
MessageTray.Notification.prototype._init.call(this, this.parent(this, source, title, null, { customContent: true });
source,
title,
null,
{ customContent: true });
this.setResident(true); this.setResident(true);
this.addButton('reject', _("Reject")); this.addButton('reject', _("Reject"));
@ -1220,28 +1200,25 @@ AudioVideoNotification.prototype = {
this.destroy(); this.destroy();
})); }));
} }
}; });
// File Transfer // File Transfer
function FileTransferNotification(source, dispatchOp, channel, contact) { const FileTransferNotification = new Lang.Class({
this._init(source, dispatchOp, channel, contact); Name: 'FileTransferNotification',
} Extends: MessageTray.Notification,
FileTransferNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, dispatchOp, channel, contact) { _init: function(source, dispatchOp, channel, contact) {
MessageTray.Notification.prototype._init.call(this, this.parent(this,
source, source,
/* To translators: The first parameter is /* To translators: The first parameter is
* the contact's alias and the second one is the * the contact's alias and the second one is the
* file name. The string will be something * file name. The string will be something
* like: "Alice is sending you test.ogg" * like: "Alice is sending you test.ogg"
*/ */
_("%s is sending you %s").format(contact.get_alias(), _("%s is sending you %s").format(contact.get_alias(),
channel.get_filename()), channel.get_filename()),
null, null,
{ customContent: true }); { customContent: true });
this.setResident(true); this.setResident(true);
this.addButton('decline', _("Decline")); this.addButton('decline', _("Decline"));
@ -1263,18 +1240,15 @@ FileTransferNotification.prototype = {
this.destroy(); this.destroy();
})); }));
} }
}; });
// A notification source that can embed multiple notifications // A notification source that can embed multiple notifications
function MultiNotificationSource(title, icon) { const MultiNotificationSource = new Lang.Class({
this._init(title, icon); Name: 'MultiNotificationSource',
} Extends: MessageTray.Source,
MultiNotificationSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(title, icon) { _init: function(title, icon) {
MessageTray.Source.prototype._init.call(this, title); this.parent(title);
this._icon = icon; this._icon = icon;
this._setSummaryIcon(this.createNotificationIcon()); this._setSummaryIcon(this.createNotificationIcon());
@ -1282,7 +1256,7 @@ MultiNotificationSource.prototype = {
}, },
notify: function(notification) { notify: function(notification) {
MessageTray.Source.prototype.notify.call(this, notification); this.parent(notification);
this._nbNotifications += 1; this._nbNotifications += 1;
@ -1300,21 +1274,18 @@ MultiNotificationSource.prototype = {
icon_type: St.IconType.FULLCOLOR, icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE }); icon_size: this.ICON_SIZE });
} }
}; });
// Subscription request // Subscription request
function SubscriptionRequestNotification(source, contact) { const SubscriptionRequestNotification = new Lang.Class({
this._init(source, contact); Name: 'SubscriptionRequestNotification',
} Extends: MessageTray.Notification,
SubscriptionRequestNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, contact) { _init: function(source, contact) {
MessageTray.Notification.prototype._init.call(this, source, this.parent(this, source,
/* To translators: The parameter is the contact's alias */ /* To translators: The parameter is the contact's alias */
_("%s would like permission to see when you are online").format(contact.get_alias()), _("%s would like permission to see when you are online").format(contact.get_alias()),
null, { customContent: true }); null, { customContent: true });
this._contact = contact; this._contact = contact;
this._connection = contact.get_connection(); this._connection = contact.get_connection();
@ -1388,7 +1359,7 @@ SubscriptionRequestNotification.prototype = {
this._invalidatedId = 0; this._invalidatedId = 0;
} }
MessageTray.Notification.prototype.destroy.call(this); this.parent();
}, },
_subscriptionStatesChangedCb: function(contact, subscribe, publish, msg) { _subscriptionStatesChangedCb: function(contact, subscribe, publish, msg) {
@ -1397,12 +1368,7 @@ SubscriptionRequestNotification.prototype = {
if (publish != Tp.SubscriptionState.ASK) if (publish != Tp.SubscriptionState.ASK)
this.destroy(); this.destroy();
} }
}; });
function AccountNotification(source, account, connectionError) {
this._init(source, account, connectionError);
}
// Messages from empathy/libempathy/empathy-utils.c // Messages from empathy/libempathy/empathy-utils.c
// create_errors_to_message_hash() // create_errors_to_message_hash()
@ -1457,15 +1423,16 @@ _connectionErrorMessages[Tp.error_get_dbus_name(Tp.Error.CERT_INSECURE)]
_connectionErrorMessages[Tp.error_get_dbus_name(Tp.Error.CERT_LIMIT_EXCEEDED)] _connectionErrorMessages[Tp.error_get_dbus_name(Tp.Error.CERT_LIMIT_EXCEEDED)]
= _("The length of the server certificate, or the depth of the server certificate chain, exceed the limits imposed by the cryptography library"); = _("The length of the server certificate, or the depth of the server certificate chain, exceed the limits imposed by the cryptography library");
AccountNotification.prototype = { const AccountNotification = new Lang.Class({
__proto__: MessageTray.Notification.prototype, Name: 'AccountNotification',
Extends: MessageTray.Notification,
_init: function(source, account, connectionError) { _init: function(source, account, connectionError) {
MessageTray.Notification.prototype._init.call(this, source, this.parent(source,
/* translators: argument is the account name, like /* translators: argument is the account name, like
* name@jabber.org for example. */ * name@jabber.org for example. */
_("Connection to %s failed").format(account.get_display_name()), _("Connection to %s failed").format(account.get_display_name()),
null, { customContent: true }); null, { customContent: true });
this._label = new St.Label(); this._label = new St.Label();
this.addActor(this._label); this.addActor(this._label);
@ -1541,6 +1508,6 @@ AccountNotification.prototype = {
this._connectionStatusId = 0; this._connectionStatusId = 0;
} }
MessageTray.Notification.prototype.destroy.call(this); this.parent();
} }
}; });

View File

@ -45,15 +45,12 @@ WindowAttentionHandler.prototype = {
} }
}; };
function Source(app, window) { const Source = new Lang.Class({
this._init(app, window); Name: 'WindowAttentionSource',
} Extends: MessageTray.Source,
Source.prototype = {
__proto__ : MessageTray.Source.prototype,
_init: function(app, window) { _init: function(app, window) {
MessageTray.Source.prototype._init.call(this, app.get_name()); this.parent(app.get_name());
this._window = window; this._window = window;
this._app = app; this._app = app;
this._setSummaryIcon(this.createNotificationIcon()); this._setSummaryIcon(this.createNotificationIcon());
@ -81,4 +78,4 @@ Source.prototype = {
Main.activateWindow(this._window); Main.activateWindow(this._window);
this.destroy(); this.destroy();
} }
}; });