[gnome-shell] Port message tray sources and notifications to class framework



commit b356aa8e3b547aece23ab23aa110bd46aab76321
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Nov 20 16:12:02 2011 +0100

    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

 js/ui/autorunManager.js         |   56 +++++--------
 js/ui/keyboard.js               |   15 ++--
 js/ui/messageTray.js            |   29 +++----
 js/ui/notificationDaemon.js     |   15 ++--
 js/ui/shellMountOperation.js    |   29 ++----
 js/ui/status/bluetooth.js       |   73 +++++++----------
 js/ui/status/network.js         |   13 +--
 js/ui/telepathyClient.js        |  173 ++++++++++++++++-----------------------
 js/ui/windowAttentionHandler.js |   13 +--
 9 files changed, 162 insertions(+), 254 deletions(-)
---
diff --git a/js/ui/autorunManager.js b/js/ui/autorunManager.js
index 2cc13c5..c415894 100644
--- a/js/ui/autorunManager.js
+++ b/js/ui/autorunManager.js
@@ -261,15 +261,12 @@ AutorunManager.prototype = {
     },
 }
 
-function AutorunResidentSource() {
-    this._init();
-}
-
-AutorunResidentSource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const AutorunResidentSource = new Lang.Class({
+    Name: 'AutorunResidentSource',
+    Extends: MessageTray.Source,
 
     _init: function() {
-        MessageTray.Source.prototype._init.call(this, _("Removable Devices"));
+        this.parent(_("Removable Devices"));
 
         this._mounts = [];
 
@@ -324,19 +321,14 @@ AutorunResidentSource.prototype = {
                               icon_type: St.IconType.FULLCOLOR,
                               icon_size: this.ICON_SIZE });
     }
-}
+});
 
-function AutorunResidentNotification(source) {
-    this._init(source);
-}
-
-AutorunResidentNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const AutorunResidentNotification = new Lang.Class({
+    Name: 'AutorunResidentNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source) {
-        MessageTray.Notification.prototype._init.call(this, source,
-                                                      source.title, null,
-                                                      { customContent: true });
+        this.parent(source, source.title, null, { customContent: true });
 
         // set the notification as resident
         this.setResident(true);
@@ -410,7 +402,7 @@ AutorunResidentNotification.prototype = {
 
         return item;
     },
-}
+});
 
 function AutorunTransientDispatcher() {
     this._init();
@@ -509,15 +501,12 @@ AutorunTransientDispatcher.prototype = {
     }
 }
 
-function AutorunTransientSource(mount, apps) {
-    this._init(mount, apps);
-}
-
-AutorunTransientSource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const AutorunTransientSource = new Lang.Class({
+    Name: 'AutorunTransientSource',
+    Extends: MessageTray.Source,
 
     _init: function(mount, apps) {
-        MessageTray.Source.prototype._init.call(this, mount.get_name());
+        this.parent(mount.get_name());
 
         this.mount = mount;
         this.apps = apps;
@@ -534,19 +523,14 @@ AutorunTransientSource.prototype = {
         return new St.Icon({ gicon: this.mount.get_icon(),
                              icon_size: this.ICON_SIZE });
     }
-}
+});
 
-function AutorunTransientNotification(source) {
-    this._init(source);
-}
-
-AutorunTransientNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const AutorunTransientNotification = new Lang.Class({
+    Name: 'AutorunTransientNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source) {
-        MessageTray.Notification.prototype._init.call(this, source,
-                                                      source.title, null,
-                                                      { customContent: true });
+        this.parent(source, source.title, null, { customContent: true });
 
         this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box',
                                        vertical: true });
@@ -621,5 +605,5 @@ AutorunTransientNotification.prototype = {
 
         return button;
     }
-}
+});
 
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index a270c4b..2bf7868 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -535,16 +535,13 @@ Keyboard.prototype = {
 };
 DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface);
 
-function KeyboardSource() {
-    this._init.apply(this, arguments);
-}
-
-KeyboardSource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const KeyboardSource = new Lang.Class({
+    Name: 'KeyboardSource',
+    Extends: MessageTray.Source,
 
     _init: function(keyboard) {
+        this.parent(_("Keyboard"));
         this._keyboard = keyboard;
-        MessageTray.Source.prototype._init.call(this, _("Keyboard"));
 
         this._setSummaryIcon(this.createNotificationIcon());
     },
@@ -555,7 +552,7 @@ KeyboardSource.prototype = {
                              icon_size: this.ICON_SIZE });
     },
 
-     handleSummaryClick: function() {
+    handleSummaryClick: function() {
         let event = Clutter.get_current_event();
         if (event.type() != Clutter.EventType.BUTTON_RELEASE)
             return false;
@@ -567,4 +564,4 @@ KeyboardSource.prototype = {
     open: function() {
         this._keyboard.show();
     }
-};
+});
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index ef5c19b..e995fc5 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -408,11 +408,9 @@ Signals.addSignalMethods(FocusGrabber.prototype);
 // the content and the action area of the notification will be cleared.
 // 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.
-function Notification(source, title, banner, params) {
-    this._init(source, title, banner, params);
-}
+const Notification = new Lang.Class({
+    Name: 'Notification',
 
-Notification.prototype = {
     IMAGE_SIZE: 125,
 
     _init: function(source, title, banner, params) {
@@ -953,14 +951,12 @@ Notification.prototype = {
         this.actor.destroy();
         this.actor._delegate = null;
     }
-};
+});
 Signals.addSignalMethods(Notification.prototype);
 
-function Source(title) {
-    this._init(title);
-}
+const Source = new Lang.Class({
+    Name: 'MessageTraySource',
 
-Source.prototype = {
     ICON_SIZE: 24,
 
     _init: function(title) {
@@ -1142,7 +1138,7 @@ Source.prototype = {
     _lastNotificationRemoved: function() {
         this.destroy();
     }
-};
+});
 Signals.addSignalMethods(Source.prototype);
 
 function SummaryItem(source) {
@@ -2428,15 +2424,12 @@ MessageTray.prototype = {
     }
 };
 
-function SystemNotificationSource() {
-    this._init();
-}
-
-SystemNotificationSource.prototype = {
-    __proto__:  Source.prototype,
+const SystemNotificationSource = new Lang.Class({
+    Name: 'SystemNotificationSource',
+    Extends: Source,
 
     _init: function() {
-        Source.prototype._init.call(this, _("System Information"));
+        this.parent(_("System Information"));
 
         this._setSummaryIcon(this.createNotificationIcon());
     },
@@ -2450,4 +2443,4 @@ SystemNotificationSource.prototype = {
     open: function() {
         this.destroy();
     }
-};
+});
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 98b8875..6a8ee4a 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -476,15 +476,12 @@ NotificationDaemon.prototype = {
     }
 };
 
-function Source(title, pid, sender) {
-    this._init(title, pid, sender);
-}
-
-Source.prototype = {
-    __proto__:  MessageTray.Source.prototype,
+const Source = new Lang.Class({
+    Name: 'NotificationDaemonSource',
+    Extends: MessageTray.Source,
 
     _init: function(title, pid, sender) {
-        MessageTray.Source.prototype._init.call(this, title);
+        this.parent(title);
 
         this._pid = pid;
         if (sender)
@@ -606,6 +603,6 @@ Source.prototype = {
             this._nameWatcherId = 0;
         }
 
-        MessageTray.Source.prototype.destroy.call(this);
+        this.parent();
     }
-};
+});
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index b6281f3..439be58 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -239,16 +239,13 @@ ShellMountQuestionDialog.prototype = {
 }
 Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
 
-function ShellMountPasswordSource(message, icon, reaskPassword) {
-    this._init(message, icon, reaskPassword);
-}
-
-ShellMountPasswordSource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const ShellMountPasswordSource = new Lang.Class({
+    Name: 'ShellMountPasswordSource',
+    Extends: MessageTray.Source,
 
     _init: function(message, icon, reaskPassword) {
         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);
 
@@ -256,21 +253,15 @@ ShellMountPasswordSource.prototype = {
         Main.messageTray.add(this);
         this.notify(this._notification);
     },
-}
+});
 Signals.addSignalMethods(ShellMountPasswordSource.prototype);
 
-function ShellMountPasswordNotification(source, strings, icon, reaskPassword) {
-    this._init(source, strings, icon, reaskPassword);
-}
-
-ShellMountPasswordNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const ShellMountPasswordNotification = new Lang.Class({
+    Name: 'ShellMountPasswordNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, strings, icon, reaskPassword) {
-        MessageTray.Notification.prototype._init.call(this, source,
-                                                      strings[0], null,
-                                                      { customContent: true,
-                                                        icon: icon });
+        this.parent(source, strings[0], null, { customContent: true, icon: icon });
 
         // set the notification to transient and urgent, so that it
         // expands out
@@ -305,7 +296,7 @@ ShellMountPasswordNotification.prototype = {
 
         this.source.emit('password-ready', text);
     }
-}
+});
 
 function ShellProcessesDialog(icon) {
     this._init(icon);
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 13d1b4a..7efa2e2 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -334,15 +334,12 @@ const Indicator = new Lang.Class({
     }
 });
 
-function Source() {
-    this._init.apply(this, arguments);
-}
-
-Source.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const Source = new Lang.Class({
+    Name: 'BluetoothSource',
+    Extends: MessageTray.Source,
 
     _init: function() {
-        MessageTray.Source.prototype._init.call(this, _("Bluetooth"));
+        this.parent(_("Bluetooth"));
 
         this._setSummaryIcon(this.createNotificationIcon());
     },
@@ -364,21 +361,17 @@ Source.prototype = {
                              icon_type: St.IconType.SYMBOLIC,
                              icon_size: this.ICON_SIZE });
     }
-}
-
-function AuthNotification() {
-    this._init.apply(this, arguments);
-}
+});
 
-AuthNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const AuthNotification = new Lang.Class({
+    Name: 'AuthNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, applet, device_path, name, long_name, uuid) {
-        MessageTray.Notification.prototype._init.call(this,
-                                                      source,
-                                                      _("Bluetooth"),
-                                                      _("Authorization request from %s").format(name),
-                                                      { customContent: true });
+        this.parent(source,
+                    _("Bluetooth"),
+                    _("Authorization request from %s").format(name),
+                    { customContent: true });
         this.setResident(true);
 
         this._applet = applet;
@@ -404,21 +397,17 @@ AuthNotification.prototype = {
             this.destroy();
         }));
     }
-}
-
-function ConfirmNotification() {
-    this._init.apply(this, arguments);
-}
+});
 
-ConfirmNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const ConfirmNotification = new Lang.Class({
+    Name: 'ConfirmNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, applet, device_path, name, long_name, pin) {
-        MessageTray.Notification.prototype._init.call(this,
-                                                      source,
-                                                      _("Bluetooth"),
-                                                      _("Pairing confirmation for %s").format(name),
-                                                      { customContent: true });
+        this.parent(source,
+                    _("Bluetooth"),
+                    _("Pairing confirmation for %s").format(name),
+                    { customContent: true });
         this.setResident(true);
 
         this._applet = applet;
@@ -437,21 +426,17 @@ ConfirmNotification.prototype = {
             this.destroy();
         }));
     }
-}
-
-function PinNotification() {
-    this._init.apply(this, arguments);
-}
+});
 
-PinNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const PinNotification = new Lang.Class({
+    Name: 'PinNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, applet, device_path, name, long_name, numeric) {
-        MessageTray.Notification.prototype._init.call(this,
-                                                      source,
-                                                      _("Bluetooth"),
-                                                      _("Pairing request for %s").format(name),
-                                                      { customContent: true });
+        this.parent(source,
+                    _("Bluetooth"),
+                    _("Pairing request for %s").format(name),
+                    { customContent: true });
         this.setResident(true);
 
         this._applet = applet;
@@ -503,4 +488,4 @@ PinNotification.prototype = {
         MessageTray.Notification.prototype.grabFocus.call(this, lockTray);
         global.stage.set_key_focus(this._entry);
     }
-}
+});
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 9fd157d..382fa0e 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -2121,15 +2121,12 @@ const NMApplet = new Lang.Class({
     }
 });
 
-function NMMessageTraySource() {
-    this._init();
-}
-
-NMMessageTraySource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const NMMessageTraySource = new Lang.Class({
+    Name: 'NMMessageTraySource',
+    Extends: MessageTray.Source,
 
     _init: function() {
-        MessageTray.Source.prototype._init.call(this, _("Network Manager"));
+        this.parent(_("Network Manager"));
 
         let icon = new St.Icon({ icon_name: 'network-transmit-receive',
                                  icon_type: St.IconType.SYMBOLIC,
@@ -2137,4 +2134,4 @@ NMMessageTraySource.prototype = {
                                });
         this._setSummaryIcon(icon);
     }
-};
+});
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 8bc51d1..6d717fc 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -481,15 +481,12 @@ Client.prototype = {
     }
 };
 
-function ChatSource(account, conn, channel, contact, client) {
-    this._init(account, conn, channel, contact, client);
-}
-
-ChatSource.prototype = {
-    __proto__:  MessageTray.Source.prototype,
+const ChatSource = new Lang.Class({
+    Name: 'ChatSource',
+    Extends: MessageTray.Source,
 
     _init: function(account, conn, channel, contact, client) {
-        MessageTray.Source.prototype._init.call(this, contact.get_alias());
+        this.parent(contact.get_alias());
 
         this.isChat = true;
 
@@ -798,17 +795,14 @@ ChatSource.prototype = {
 
         this._shouldAck = false;
     }
-};
+});
 
-function ChatNotification(source) {
-    this._init(source);
-}
-
-ChatNotification.prototype = {
-    __proto__:  MessageTray.Notification.prototype,
+const ChatNotification = new Lang.Class({
+    Name: 'ChatNotification',
+    Extends: MessageTray.Notification,
 
     _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._responseEntry = new St.Entry({ style_class: 'chat-response',
@@ -1091,17 +1085,14 @@ ChatNotification.prototype = {
             this.source.setChatState(Tp.ChannelChatState.ACTIVE);
         }
     }
-};
-
-function ApproverSource(dispatchOp, text, gicon) {
-    this._init(dispatchOp, text, gicon);
-}
+});
 
-ApproverSource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const ApproverSource = new Lang.Class({
+    Name: 'ApproverSource',
+    Extends: MessageTray.Source,
 
     _init: function(dispatchOp, text, gicon) {
-        MessageTray.Source.prototype._init.call(this, text);
+        this.parent(text);
 
         this._gicon = gicon;
         this._setSummaryIcon(this.createNotificationIcon());
@@ -1130,23 +1121,19 @@ ApproverSource.prototype = {
                              icon_type: St.IconType.FULLCOLOR,
                              icon_size: this.ICON_SIZE });
     }
-}
-
-function RoomInviteNotification(source, dispatchOp, channel, inviter) {
-    this._init(source, dispatchOp, channel, inviter);
-}
+});
 
-RoomInviteNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const RoomInviteNotification = new Lang.Class({
+    Name: 'RoomInviteNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, dispatchOp, channel, inviter) {
-        MessageTray.Notification.prototype._init.call(this,
-                                                      source,
-                                                      /* translators: argument is a room name like
-                                                       * room jabber org for example. */
-                                                      _("Invitation to %s").format(channel.get_identifier()),
-                                                      null,
-                                                      { customContent: true });
+        this.parent(source,
+                    /* translators: argument is a room name like
+                     * room jabber org for example. */
+                    _("Invitation to %s").format(channel.get_identifier()),
+                    null,
+                    { customContent: true });
         this.setResident(true);
 
         /* translators: first argument is the name of a contact and the second
@@ -1173,15 +1160,12 @@ RoomInviteNotification.prototype = {
             this.destroy();
         }));
     }
-};
+});
 
 // Audio Video
-function AudioVideoNotification(source, dispatchOp, channel, contact, isVideo) {
-    this._init(source, dispatchOp, channel, contact, isVideo);
-}
-
-AudioVideoNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const AudioVideoNotification = new Lang.Class({
+    Name: 'AudioVideoNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, dispatchOp, channel, contact, isVideo) {
         let title = '';
@@ -1193,11 +1177,7 @@ AudioVideoNotification.prototype = {
              /* translators: argument is a contact name like Alice for example. */
             title = _("Call from %s").format(contact.get_alias());
 
-        MessageTray.Notification.prototype._init.call(this,
-                                                      source,
-                                                      title,
-                                                      null,
-                                                      { customContent: true });
+        this.parent(this, source, title, null, { customContent: true });
         this.setResident(true);
 
         this.addButton('reject', _("Reject"));
@@ -1220,28 +1200,25 @@ AudioVideoNotification.prototype = {
             this.destroy();
         }));
     }
-};
+});
 
 // File Transfer
-function FileTransferNotification(source, dispatchOp, channel, contact) {
-    this._init(source, dispatchOp, channel, contact);
-}
-
-FileTransferNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const FileTransferNotification = new Lang.Class({
+    Name: 'FileTransferNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, dispatchOp, channel, contact) {
-        MessageTray.Notification.prototype._init.call(this,
-                                                      source,
-                                                      /* To translators: The first parameter is
-                                                       * the contact's alias and the second one is the
-                                                       * file name. The string will be something
-                                                       * like: "Alice is sending you test.ogg"
-                                                       */
-                                                      _("%s is sending you %s").format(contact.get_alias(),
-                                                                                       channel.get_filename()),
-                                                      null,
-                                                      { customContent: true });
+        this.parent(this,
+                    source,
+                    /* To translators: The first parameter is
+                     * the contact's alias and the second one is the
+                     * file name. The string will be something
+                     * like: "Alice is sending you test.ogg"
+                     */
+                    _("%s is sending you %s").format(contact.get_alias(),
+                                                     channel.get_filename()),
+                    null,
+                    { customContent: true });
         this.setResident(true);
 
         this.addButton('decline', _("Decline"));
@@ -1263,18 +1240,15 @@ FileTransferNotification.prototype = {
             this.destroy();
         }));
     }
-};
+});
 
 // A notification source that can embed multiple notifications
-function MultiNotificationSource(title, icon) {
-    this._init(title, icon);
-}
-
-MultiNotificationSource.prototype = {
-    __proto__: MessageTray.Source.prototype,
+const MultiNotificationSource = new Lang.Class({
+    Name: 'MultiNotificationSource',
+    Extends: MessageTray.Source,
 
     _init: function(title, icon) {
-        MessageTray.Source.prototype._init.call(this, title);
+        this.parent(title);
 
         this._icon = icon;
         this._setSummaryIcon(this.createNotificationIcon());
@@ -1282,7 +1256,7 @@ MultiNotificationSource.prototype = {
     },
 
     notify: function(notification) {
-        MessageTray.Source.prototype.notify.call(this, notification);
+        this.parent(notification);
 
         this._nbNotifications += 1;
 
@@ -1300,21 +1274,18 @@ MultiNotificationSource.prototype = {
                              icon_type: St.IconType.FULLCOLOR,
                              icon_size: this.ICON_SIZE });
     }
-};
+});
 
 // Subscription request
-function SubscriptionRequestNotification(source, contact) {
-    this._init(source, contact);
-}
-
-SubscriptionRequestNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const SubscriptionRequestNotification = new Lang.Class({
+    Name: 'SubscriptionRequestNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, contact) {
-        MessageTray.Notification.prototype._init.call(this, source,
-            /* To translators: The parameter is the contact's alias */
-            _("%s would like permission to see when you are online").format(contact.get_alias()),
-            null, { customContent: true });
+        this.parent(this, source,
+                    /* To translators: The parameter is the contact's alias */
+                    _("%s would like permission to see when you are online").format(contact.get_alias()),
+                    null, { customContent: true });
 
         this._contact = contact;
         this._connection = contact.get_connection();
@@ -1388,7 +1359,7 @@ SubscriptionRequestNotification.prototype = {
             this._invalidatedId = 0;
         }
 
-        MessageTray.Notification.prototype.destroy.call(this);
+        this.parent();
     },
 
     _subscriptionStatesChangedCb: function(contact, subscribe, publish, msg) {
@@ -1397,12 +1368,7 @@ SubscriptionRequestNotification.prototype = {
         if (publish != Tp.SubscriptionState.ASK)
             this.destroy();
     }
-};
-
-
-function AccountNotification(source, account, connectionError) {
-    this._init(source, account, connectionError);
-}
+});
 
 // Messages from empathy/libempathy/empathy-utils.c
 // 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)]
   = _("The length of the server certificate, or the depth of the server certificate chain, exceed the limits imposed by the cryptography library");
 
-AccountNotification.prototype = {
-    __proto__: MessageTray.Notification.prototype,
+const AccountNotification = new Lang.Class({
+    Name: 'AccountNotification',
+    Extends: MessageTray.Notification,
 
     _init: function(source, account, connectionError) {
-        MessageTray.Notification.prototype._init.call(this, source,
-            /* translators: argument is the account name, like
-             * name jabber org for example. */
-            _("Connection to %s failed").format(account.get_display_name()),
-            null, { customContent: true });
+        this.parent(source,
+                    /* translators: argument is the account name, like
+                     * name jabber org for example. */
+                    _("Connection to %s failed").format(account.get_display_name()),
+                    null, { customContent: true });
 
         this._label = new St.Label();
         this.addActor(this._label);
@@ -1541,6 +1508,6 @@ AccountNotification.prototype = {
             this._connectionStatusId = 0;
         }
 
-        MessageTray.Notification.prototype.destroy.call(this);
+        this.parent();
     }
-};
+});
diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js
index b8dd2e3..af31bdd 100644
--- a/js/ui/windowAttentionHandler.js
+++ b/js/ui/windowAttentionHandler.js
@@ -45,15 +45,12 @@ WindowAttentionHandler.prototype = {
     }
 };
 
-function Source(app, window) {
-    this._init(app, window);
-}
-
-Source.prototype = {
-    __proto__ : MessageTray.Source.prototype,
+const Source = new Lang.Class({
+    Name: 'WindowAttentionSource',
+    Extends: MessageTray.Source,
 
     _init: function(app, window) {
-        MessageTray.Source.prototype._init.call(this, app.get_name());
+        this.parent(app.get_name());
         this._window = window;
         this._app = app;
         this._setSummaryIcon(this.createNotificationIcon());
@@ -81,4 +78,4 @@ Source.prototype = {
         Main.activateWindow(this._window);
         this.destroy();
     }
-};
+});



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