[gnome-shell] Port everything to class framework
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Port everything to class framework
- Date: Thu, 24 Nov 2011 08:51:36 +0000 (UTC)
commit 17c46c24523d2a21a43a29e1c3bc1deada08ef60
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Nov 20 18:56:27 2011 +0100
Port everything to class framework
The last patch in the sequence. Every place that was previously
setting prototype has been ported to Lang.Class, to make code more
concise and allow for better toString().
https://bugzilla.gnome.org/show_bug.cgi?id=664436
js/gdm/loginDialog.js | 42 +++++-------------
js/misc/docInfo.js | 16 +++----
js/misc/history.js | 8 +--
js/misc/modemManager.js | 16 +++----
js/ui/altTab.js | 16 +++----
js/ui/appDisplay.js | 32 +++++---------
js/ui/appFavorites.js | 8 +--
js/ui/automountManager.js | 8 +--
js/ui/autorunManager.js | 24 ++++-------
js/ui/boxpointer.js | 8 +--
js/ui/calendar.js | 43 +++++++------------
js/ui/contactDisplay.js | 8 +--
js/ui/ctrlAltTab.js | 16 +++----
js/ui/dash.js | 8 +--
js/ui/dnd.js | 8 +--
js/ui/endSessionDialog.js | 8 +--
js/ui/iconGrid.js | 8 +--
js/ui/keyboard.js | 17 +++----
js/ui/layout.js | 24 ++++-------
js/ui/lightbox.js | 8 +--
js/ui/lookingGlass.js | 80 +++++++++++++----------------------
js/ui/magnifier.js | 24 ++++-------
js/ui/magnifierDBus.js | 17 +++----
js/ui/messageTray.js | 32 +++++---------
js/ui/networkAgent.js | 8 +--
js/ui/notificationDaemon.js | 8 +--
js/ui/overview.js | 16 +++----
js/ui/panel.js | 35 ++++++----------
js/ui/placeDisplay.js | 8 +--
js/ui/polkitAuthenticationAgent.js | 8 +--
js/ui/popupMenu.js | 2 +-
js/ui/runDialog.js | 8 +--
js/ui/search.js | 16 +++----
js/ui/searchDisplay.js | 16 +++----
js/ui/shellDBus.js | 8 +--
js/ui/shellMountOperation.js | 16 +++----
js/ui/status/bluetooth.js | 4 +-
js/ui/statusIconDispatcher.js | 8 +--
js/ui/telepathyClient.js | 12 ++---
js/ui/tweener.js | 8 +--
js/ui/viewSelector.js | 8 +--
js/ui/windowAttentionHandler.js | 8 +--
js/ui/windowManager.js | 16 +++----
js/ui/workspace.js | 36 +++++++---------
js/ui/workspaceSwitcherPopup.js | 8 +--
js/ui/workspaceThumbnail.js | 24 ++++-------
js/ui/workspacesView.js | 16 +++----
js/ui/xdndHandler.js | 8 +--
48 files changed, 295 insertions(+), 489 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 0113dc8..3700f0c 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -140,11 +140,9 @@ function _smoothlyResizeActor(actor, width, height) {
return hold;
}
-function UserListItem(user, reason) {
- this._init(user, reason);
-}
+const UserListItem = new Lang.Class({
+ Name: 'UserListItem',
-UserListItem.prototype = {
_init: function(user) {
this.user = user;
this._userChangedId = this.user.connect('changed',
@@ -273,15 +271,12 @@ UserListItem.prototype = {
});
return hold;
}
-
-};
+});
Signals.addSignalMethods(UserListItem.prototype);
-function UserList() {
- this._init.apply(this, arguments);
-}
+const UserList = new Lang.Class({
+ Name: 'UserList',
-UserList.prototype = {
_init: function() {
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
this.actor.set_policy(Gtk.PolicyType.NEVER,
@@ -537,14 +532,12 @@ UserList.prototype = {
item.actor.destroy();
delete this._items[userName];
}
-};
+});
Signals.addSignalMethods(UserList.prototype);
-function SessionListItem(id, name) {
- this._init(id, name);
-}
+const SessionListItem = new Lang.Class({
+ Name: 'SessionListItem',
-SessionListItem.prototype = {
_init: function(id, name) {
this.id = id;
@@ -599,14 +592,12 @@ SessionListItem.prototype = {
_onClicked: function() {
this.emit('activate');
}
-};
+});
Signals.addSignalMethods(SessionListItem.prototype);
-function SessionList() {
- this._init();
-}
+const SessionList = new Lang.Class({
+ Name: 'SessionList',
-SessionList.prototype = {
_init: function() {
this.actor = new St.Bin();
@@ -737,18 +728,9 @@ SessionList.prototype = {
}));
}
}
-};
+});
Signals.addSignalMethods(SessionList.prototype);
-function LoginDialog() {
- if (_loginDialog == null) {
- this._init();
- _loginDialog = this;
- }
-
- return _loginDialog;
-}
-
const LoginDialog = new Lang.Class({
Name: 'LoginDialog',
Extends: ModalDialog.ModalDialog,
diff --git a/js/misc/docInfo.js b/js/misc/docInfo.js
index d4499a0..1c7db19 100644
--- a/js/misc/docInfo.js
+++ b/js/misc/docInfo.js
@@ -8,11 +8,9 @@ const Search = imports.ui.search;
const THUMBNAIL_ICON_MARGIN = 2;
-function DocInfo(recentInfo) {
- this._init(recentInfo);
-}
+const DocInfo = new Lang.Class({
+ Name: 'DocInfo',
-DocInfo.prototype = {
_init : function(recentInfo) {
this.recentInfo = recentInfo;
// We actually used get_modified() instead of get_visited()
@@ -49,7 +47,7 @@ DocInfo.prototype = {
}
return mtype;
}
-};
+});
var docManagerInstance = null;
@@ -62,11 +60,9 @@ function getDocManager() {
/**
* DocManager wraps the DocSystem, primarily to expose DocInfo objects.
*/
-function DocManager() {
- this._init();
-}
+const DocManager = new Lang.Class({
+ Name: 'DocManager',
-DocManager.prototype = {
_init: function() {
this._docSystem = Shell.DocSystem.get_default();
this._infosByTimestamp = [];
@@ -135,6 +131,6 @@ DocManager.prototype = {
return this._infosByUri[url];
})), terms);
}
-};
+});
Signals.addSignalMethods(DocManager.prototype);
diff --git a/js/misc/history.js b/js/misc/history.js
index 2c127c3..5cb8282 100644
--- a/js/misc/history.js
+++ b/js/misc/history.js
@@ -7,11 +7,9 @@ const Params = imports.misc.params;
const DEFAULT_LIMIT = 512;
-function HistoryManager(params) {
- this._init(params);
-}
+const HistoryManager = new Lang.Class({
+ Name: 'HistoryManager',
-HistoryManager.prototype = {
_init: function(params) {
params = Params.parse(params, { gsettingsKey: null,
limit: DEFAULT_LIMIT,
@@ -111,5 +109,5 @@ HistoryManager.prototype = {
if (this._key)
global.settings.set_strv(this._key, this._history);
}
-};
+});
Signals.addSignalMethods(HistoryManager.prototype);
diff --git a/js/misc/modemManager.js b/js/misc/modemManager.js
index d04a3ab..e5f07c7 100644
--- a/js/misc/modemManager.js
+++ b/js/misc/modemManager.js
@@ -54,11 +54,9 @@ function _getProvidersTable() {
return _providersTable = providers;
}
-function ModemGsm() {
- this._init.apply(this, arguments);
-}
+const ModemGsm = new Lang.Class({
+ Name: 'ModemGsm',
-ModemGsm.prototype = {
_init: function(path) {
this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
@@ -156,14 +154,12 @@ ModemGsm.prototype = {
return name3 || name2 || null;
}
-}
+});
Signals.addSignalMethods(ModemGsm.prototype);
-function ModemCdma() {
- this._init.apply(this, arguments);
-}
+const ModemCdma = new Lang.Class({
+ Name: 'ModemCdma',
-ModemCdma.prototype = {
_init: function(path) {
this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
@@ -231,5 +227,5 @@ ModemCdma.prototype = {
return null;
}
-};
+});
Signals.addSignalMethods(ModemCdma.prototype);
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 166ca36..85d4792 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -43,11 +43,9 @@ function primaryModifier(mask) {
return primary;
}
-function AltTabPopup() {
- this._init();
-}
+const AltTabPopup = new Lang.Class({
+ Name: 'AltTabPopup',
-AltTabPopup.prototype = {
_init : function() {
this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
reactive: true,
@@ -540,7 +538,7 @@ AltTabPopup.prototype = {
onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
});
}
-};
+});
const SwitcherList = new Lang.Class({
Name: 'SwitcherList',
@@ -853,11 +851,9 @@ const SwitcherList = new Lang.Class({
Signals.addSignalMethods(SwitcherList.prototype);
-function AppIcon(app) {
- this._init(app);
-}
+const AppIcon = new Lang.Class({
+ Name: 'AppIcon',
-AppIcon.prototype = {
_init: function(app) {
this.app = app;
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
@@ -875,7 +871,7 @@ AppIcon.prototype = {
this._iconBin.set_size(size, size);
this._iconBin.child = this.icon;
}
-};
+});
const AppSwitcher = new Lang.Class({
Name: 'AppSwitcher',
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 4db20c4..6931780 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -26,11 +26,9 @@ const MAX_APPLICATION_WORK_MILLIS = 75;
const MENU_POPUP_TIMEOUT = 600;
const SCROLL_TIME = 0.1;
-function AlphabeticalView() {
- this._init();
-}
+const AlphabeticalView = new Lang.Class({
+ Name: 'AlphabeticalView',
-AlphabeticalView.prototype = {
_init: function() {
this._grid = new IconGrid.IconGrid({ xAlign: St.Align.START });
this._appSystem = Shell.AppSystem.get_default();
@@ -130,13 +128,11 @@ AlphabeticalView.prototype = {
this._addApp(app);
}
}
-};
+});
-function ViewByCategories() {
- this._init();
-}
+const ViewByCategories = new Lang.Class({
+ Name: 'ViewByCategories',
-ViewByCategories.prototype = {
_init: function() {
this._appSystem = Shell.AppSystem.get_default();
this.actor = new St.BoxLayout({ style_class: 'all-app' });
@@ -281,16 +277,14 @@ ViewByCategories.prototype = {
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
}
}
-};
+});
/* This class represents a display containing a collection of application items.
* The applications are sorted based on their name.
*/
-function AllAppDisplay() {
- this._init();
-}
+const AllAppDisplay = new Lang.Class({
+ Name: 'AllAppDisplay',
-AllAppDisplay.prototype = {
_init: function() {
this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
@@ -306,7 +300,7 @@ AllAppDisplay.prototype = {
_redisplay: function() {
this._appView.refresh();
}
-};
+});
const AppSearchProvider = new Lang.Class({
Name: 'AppSearchProvider',
@@ -427,11 +421,9 @@ const AppIcon = new Lang.Class({
}
});
-function AppWellIcon(app, iconParams, onActivateOverride) {
- this._init(app, iconParams, onActivateOverride);
-}
+const AppWellIcon = new Lang.Class({
+ Name: 'AppWellIcon',
-AppWellIcon.prototype = {
_init : function(app, iconParams, onActivateOverride) {
this.app = app;
this.actor = new St.Button({ style_class: 'app-well-app',
@@ -611,7 +603,7 @@ AppWellIcon.prototype = {
getDragActorSource: function() {
return this.icon.icon;
}
-};
+});
Signals.addSignalMethods(AppWellIcon.prototype);
const AppIconMenu = new Lang.Class({
diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js
index 5faca55..21257bc 100644
--- a/js/ui/appFavorites.js
+++ b/js/ui/appFavorites.js
@@ -6,11 +6,9 @@ const Signals = imports.signals;
const Main = imports.ui.main;
-function AppFavorites() {
- this._init();
-}
+const AppFavorites = new Lang.Class({
+ Name: 'AppFavorites',
-AppFavorites.prototype = {
FAVORITE_APPS_KEY: 'favorite-apps',
_init: function() {
@@ -122,7 +120,7 @@ AppFavorites.prototype = {
this._addFavorite(appId, pos);
}));
}
-};
+});
Signals.addSignalMethods(AppFavorites.prototype);
var appFavoritesInstance = null;
diff --git a/js/ui/automountManager.js b/js/ui/automountManager.js
index 456e042..ee3e857 100644
--- a/js/ui/automountManager.js
+++ b/js/ui/automountManager.js
@@ -64,11 +64,9 @@ function ConsoleKitManager() {
return self;
}
-function AutomountManager() {
- this._init();
-}
+const AutomountManager = new Lang.Class({
+ Name: 'AutomountManager',
-AutomountManager.prototype = {
_init: function() {
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
this._volumeQueue = [];
@@ -268,4 +266,4 @@ AutomountManager.prototype = {
return false;
});
}
-}
+});
diff --git a/js/ui/autorunManager.js b/js/ui/autorunManager.js
index c415894..2649b53 100644
--- a/js/ui/autorunManager.js
+++ b/js/ui/autorunManager.js
@@ -75,11 +75,9 @@ function HotplugSniffer() {
'/org/gnome/Shell/HotplugSniffer');
}
-function ContentTypeDiscoverer(callback) {
- this._init(callback);
-}
+const ContentTypeDiscoverer = new Lang.Class({
+ Name: 'ContentTypeDiscoverer',
-ContentTypeDiscoverer.prototype = {
_init: function(callback) {
this._callback = callback;
},
@@ -136,13 +134,11 @@ ContentTypeDiscoverer.prototype = {
this._callback(mount, apps, contentTypes);
}
-}
+});
-function AutorunManager() {
- this._init();
-}
+const AutorunManager = new Lang.Class({
+ Name: 'AutorunManager',
-AutorunManager.prototype = {
_init: function() {
this._volumeMonitor = Gio.VolumeMonitor.get();
@@ -259,7 +255,7 @@ AutorunManager.prototype = {
+ ': ' + e.toString());
}
},
-}
+});
const AutorunResidentSource = new Lang.Class({
Name: 'AutorunResidentSource',
@@ -404,11 +400,9 @@ const AutorunResidentNotification = new Lang.Class({
},
});
-function AutorunTransientDispatcher() {
- this._init();
-}
+const AutorunTransientDispatcher = new Lang.Class({
+ Name: 'AutorunTransientDispatcher',
-AutorunTransientDispatcher.prototype = {
_init: function() {
this._sources = [];
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
@@ -499,7 +493,7 @@ AutorunTransientDispatcher.prototype = {
// destroy the notification source
source.destroy();
}
-}
+});
const AutorunTransientSource = new Lang.Class({
Name: 'AutorunTransientSource',
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 00da8a2..8f93b0d 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -21,11 +21,9 @@ const POPUP_ANIMATION_TIME = 0.15;
* placed. The arrow position may be controlled via setArrowOrigin().
*
*/
-function BoxPointer(side, binProperties) {
- this._init(side, binProperties);
-}
+const BoxPointer = new Lang.Class({
+ Name: 'BoxPointer',
-BoxPointer.prototype = {
_init: function(arrowSide, binProperties) {
this._arrowSide = arrowSide;
this._arrowOrigin = 0;
@@ -452,4 +450,4 @@ BoxPointer.prototype = {
get opacity() {
return this.actor.opacity;
}
-};
+});
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 98ae634..0c33ed0 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -155,28 +155,24 @@ function _getEventDayAbbreviation(dayNumber) {
// Abstraction for an appointment/event in a calendar
-function CalendarEvent(date, end, summary, allDay) {
- this._init(date, end, summary, allDay);
-}
+const CalendarEvent = new Lang.Class({
+ Name: 'CalendarEvent',
-CalendarEvent.prototype = {
_init: function(date, end, summary, allDay) {
this.date = date;
this.end = end;
this.summary = summary;
this.allDay = allDay;
}
-};
+});
// Interface for appointments/events - e.g. the contents of a calendar
//
// First, an implementation with no events
-function EmptyEventSource() {
- this._init();
-}
+const EmptyEventSource = new Lang.Class({
+ Name: 'EmptyEventSource',
-EmptyEventSource.prototype = {
_init: function() {
},
@@ -191,7 +187,7 @@ EmptyEventSource.prototype = {
hasEvents: function(day) {
return false;
}
-};
+});
Signals.addSignalMethods(EmptyEventSource.prototype);
const CalendarServerIface = <interface name="org.gnome.Shell.CalendarServer">
@@ -219,11 +215,6 @@ function CalendarServer() {
return self;
}
-// an implementation that reads data from a session bus service
-function DBusEventSource() {
- this._init();
-}
-
function _datesEqual(a, b) {
if (a < b)
return false;
@@ -242,8 +233,10 @@ function _dateIntervalsOverlap(a0, a1, b0, b1)
return true;
}
+// an implementation that reads data from a session bus service
+const DBusEventSource = new Lang.Class({
+ Name: 'DBusEventSource',
-DBusEventSource.prototype = {
_init: function() {
this._resetCache();
@@ -344,17 +337,15 @@ DBusEventSource.prototype = {
return true;
}
-};
+});
Signals.addSignalMethods(DBusEventSource.prototype);
// Calendar:
// @eventSource: is an object implementing the EventSource API, e.g. the
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
-function Calendar(eventSource) {
- this._init(eventSource);
-}
+const Calendar = new Lang.Class({
+ Name: 'Calendar',
-Calendar.prototype = {
_init: function(eventSource) {
if (eventSource) {
this._eventSource = eventSource;
@@ -620,15 +611,13 @@ Calendar.prototype = {
if (this._eventSource)
this._eventSource.requestRange(beginDate, iter, forceReload);
}
-};
+});
Signals.addSignalMethods(Calendar.prototype);
-function EventsList(eventSource) {
- this._init(eventSource);
-}
+const EventsList = new Lang.Class({
+ Name: 'EventsList',
-EventsList.prototype = {
_init: function(eventSource) {
this.actor = new St.BoxLayout({ vertical: true, style_class: 'events-header-vbox'});
this._date = new Date();
@@ -759,4 +748,4 @@ EventsList.prototype = {
this._showOtherDay(this._date);
}
}
-};
+});
diff --git a/js/ui/contactDisplay.js b/js/ui/contactDisplay.js
index fe34a54..dae9002 100644
--- a/js/ui/contactDisplay.js
+++ b/js/ui/contactDisplay.js
@@ -20,11 +20,9 @@ function launchContact(id) {
/* This class represents a shown contact search result in the overview */
-function Contact(id) {
- this._init(id);
-}
+const Contact = new Lang.Class({
+ Name: 'Contact',
-Contact.prototype = {
_init: function(id) {
this._contactSys = Shell.ContactSystem.get_default();
this.individual = this._contactSys.get_individual(id);
@@ -131,7 +129,7 @@ Contact.prototype = {
return tc.load_icon_name(null, 'avatar-default', St.IconType.FULLCOLOR, size);
}
},
-};
+});
/* Searches for and returns contacts */
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index 9340846..67d0881 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -22,11 +22,9 @@ const SortGroup = {
BOTTOM: 2
};
-function CtrlAltTabManager() {
- this._init();
-}
+const CtrlAltTabManager = new Lang.Class({
+ Name: 'CtrlAltTabManager',
-CtrlAltTabManager.prototype = {
_init: function() {
this._items = [];
this._focusManager = St.FocusManager.get_for_stage(global.stage);
@@ -134,17 +132,15 @@ CtrlAltTabManager.prototype = {
}));
}
}
-};
+});
function mod(a, b) {
return (a + b) % b;
}
-function CtrlAltTabPopup() {
- this._init();
-}
+const CtrlAltTabPopup = new Lang.Class({
+ Name: 'CtrlAltTabPopup',
-CtrlAltTabPopup.prototype = {
_init : function() {
this.actor = new Shell.GenericContainer({ name: 'ctrlAltTabPopup',
reactive: true });
@@ -303,7 +299,7 @@ CtrlAltTabPopup.prototype = {
this._selection = num;
this._switcher.highlight(num);
}
-};
+});
const CtrlAltTabSwitcher = new Lang.Class({
Name: 'CtrlAltTabSwitcher',
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 0ddec79..97fa33a 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -226,11 +226,9 @@ const DragPlaceholderItem = new Lang.Class({
}
});
-function Dash() {
- this._init();
-}
+const Dash = new Lang.Class({
+ Name: 'Dash',
-Dash.prototype = {
_init : function() {
this._maxHeight = -1;
this.iconSize = 64;
@@ -752,6 +750,6 @@ Dash.prototype = {
return true;
}
-};
+});
Signals.addSignalMethods(Dash.prototype);
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 3c762f2..cb8b913 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -69,11 +69,9 @@ function removeDragMonitor(monitor) {
}
}
-function _Draggable(actor, params) {
- this._init(actor, params);
-}
+const _Draggable = new Lang.Class({
+ Name: 'Draggable',
-_Draggable.prototype = {
_init : function(actor, params) {
params = Params.parse(params, { manualMode: false,
restoreOnSuccess: false,
@@ -596,7 +594,7 @@ _Draggable.prototype = {
this._dragActor = undefined;
currentDraggable = null;
}
-};
+});
Signals.addSignalMethods(_Draggable.prototype);
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 947524a..d21d155 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -142,11 +142,9 @@ function findAppFromInhibitor(inhibitor) {
return app;
}
-function ListItem(app, reason) {
- this._init(app, reason);
-}
+const ListItem = new Lang.Class({
+ Name: 'ListItem',
-ListItem.prototype = {
_init: function(app, reason) {
this._app = app;
this._reason = reason;
@@ -192,7 +190,7 @@ ListItem.prototype = {
this.emit('activate');
this._app.activate();
}
-};
+});
Signals.addSignalMethods(ListItem.prototype);
// The logout timer only shows updates every 10 seconds
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index f266577..1b9c905 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -149,11 +149,9 @@ const BaseIcon = new Lang.Class({
}
});
-function IconGrid(params) {
- this._init(params);
-}
+const IconGrid = new Lang.Class({
+ Name: 'IconGrid',
-IconGrid.prototype = {
_init: function(params) {
params = Params.parse(params, { rowLimit: null,
columnLimit: null,
@@ -322,4 +320,4 @@ IconGrid.prototype = {
visibleItemsCount: function() {
return this._grid.get_children().length - this._grid.get_n_skip_paint();
}
-};
+});
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index a427f17..c7f2b0e 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -61,11 +61,9 @@ const CaribouKeyboardIface = <interface name='org.gnome.Caribou.Keyboard'>
<property name='Name' access='read' type='s' />
</interface>;
-function Key() {
- this._init.apply(this, arguments);
-}
+const Key = new Lang.Class({
+ Name: 'Key',
-Key.prototype = {
_init : function(key) {
this._key = key;
@@ -191,13 +189,12 @@ Key.prototype = {
this._boxPointer.hide(true);
}
}
-};
+});
-function Keyboard() {
- this._init.apply(this, arguments);
-}
+const Keyboard = new Lang.Class({
+ // HACK: we can't set Name, because it collides with Name dbus property
+ // Name: 'Keyboard',
-Keyboard.prototype = {
_init: function () {
this._impl = Gio.DBusExportedObject.wrapJSObject(CaribouKeyboardIface, this);
this._impl.export(Gio.DBus.session, '/org/gnome/Caribou/Keyboard');
@@ -532,7 +529,7 @@ Keyboard.prototype = {
get Name() {
return 'gnome-shell';
}
-};
+});
const KeyboardSource = new Lang.Class({
Name: 'KeyboardSource',
diff --git a/js/ui/layout.js b/js/ui/layout.js
index e4fcb62..c99c941 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -17,11 +17,9 @@ const HOT_CORNER_ACTIVATION_TIMEOUT = 0.5;
const STARTUP_ANIMATION_TIME = 0.2;
const KEYBOARD_ANIMATION_TIME = 0.5;
-function LayoutManager() {
- this._init.apply(this, arguments);
-}
+const LayoutManager = new Lang.Class({
+ Name: 'LayoutManager',
-LayoutManager.prototype = {
_init: function () {
this._rtl = (St.Widget.get_default_direction() == St.TextDirection.RTL);
this.monitors = [];
@@ -374,7 +372,7 @@ LayoutManager.prototype = {
findMonitorForActor: function(actor) {
return this._chrome.findMonitorForActor(actor);
}
-};
+});
Signals.addSignalMethods(LayoutManager.prototype);
@@ -382,11 +380,9 @@ Signals.addSignalMethods(LayoutManager.prototype);
//
// This class manages a "hot corner" that can toggle switching to
// overview.
-function HotCorner() {
- this._init();
-}
+const HotCorner = new Lang.Class({
+ Name: 'HotCorner',
-HotCorner.prototype = {
_init : function() {
// We use this flag to mark the case where the user has entered the
// hot corner and has not left both the hot corner and a surrounding
@@ -548,7 +544,7 @@ HotCorner.prototype = {
return true;
return false;
}
-};
+});
// This manages the shell "chrome"; the UI that's visible in the
@@ -561,11 +557,9 @@ const defaultParams = {
affectsInputRegion: true
};
-function Chrome() {
- this._init.apply(this, arguments);
-}
+const Chrome = new Lang.Class({
+ Name: 'Chrome',
-Chrome.prototype = {
_init: function(layoutManager) {
this._layoutManager = layoutManager;
@@ -981,4 +975,4 @@ Chrome.prototype = {
return false;
}
-};
+});
diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js
index 58bce89..f8c8462 100644
--- a/js/ui/lightbox.js
+++ b/js/ui/lightbox.js
@@ -30,11 +30,9 @@ const Tweener = imports.ui.tweener;
* @container and will track any changes in its size. You can override
* this by passing an explicit width and height in @params.
*/
-function Lightbox(container, params) {
- this._init(container, params);
-}
+const Lightbox = new Lang.Class({
+ Name: 'Lightbox',
-Lightbox.prototype = {
_init : function(container, params) {
params = Params.parse(params, { inhibitEvents: false,
width: null,
@@ -196,4 +194,4 @@ Lightbox.prototype = {
this.highlight(null);
}
-};
+});
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 109174d..c7fb4c3 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -55,11 +55,9 @@ function _getAutoCompleteGlobalKeywords() {
return keywords.concat(windowProperties).concat(headerProperties);
}
-function AutoComplete(entry) {
- this._init(entry);
-}
+const AutoComplete = new Lang.Class({
+ Name: 'AutoComplete',
-AutoComplete.prototype = {
_init: function(entry) {
this._entry = entry;
this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent));
@@ -118,15 +116,13 @@ AutoComplete.prototype = {
this._entry.clutter_text.insert_text(additionalCompletionText, cursorPos);
}
-};
+});
Signals.addSignalMethods(AutoComplete.prototype);
-function Notebook() {
- this._init();
-}
+const Notebook = new Lang.Class({
+ Name: 'Notebook',
-Notebook.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ vertical: true });
@@ -250,7 +246,7 @@ Notebook.prototype = {
this.selectIndex(prevIndex);
}
-};
+});
Signals.addSignalMethods(Notebook.prototype);
function objectToString(o) {
@@ -285,11 +281,9 @@ const ObjLink = new Lang.Class({
}
});
-function Result(command, o, index) {
- this._init(command, o, index);
-}
+const Result = new Lang.Class({
+ Name: 'Result',
-Result.prototype = {
_init : function(command, o, index) {
this.index = index;
this.o = o;
@@ -311,13 +305,11 @@ Result.prototype = {
padBin.add_actor(line);
this.actor.add(padBin);
}
-};
+});
-function WindowList() {
- this._init();
-}
+const WindowList = new Lang.Class({
+ Name: 'WindowList',
-WindowList.prototype = {
_init : function () {
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
let tracker = Shell.WindowTracker.get_default();
@@ -358,14 +350,12 @@ WindowList.prototype = {
}
}
}
-};
+});
Signals.addSignalMethods(WindowList.prototype);
-function ObjInspector() {
- this._init();
-}
+const ObjInspector = new Lang.Class({
+ Name: 'ObjInspector',
-ObjInspector.prototype = {
_init : function () {
this._obj = null;
this._previousObj = null;
@@ -465,7 +455,7 @@ ObjInspector.prototype = {
_onBack: function() {
this.selectObject(this._previousObj, true);
}
-};
+});
function addBorderPaintHook(actor) {
let signalId = actor.connect_after('paint',
@@ -491,11 +481,9 @@ function addBorderPaintHook(actor) {
return signalId;
}
-function Inspector() {
- this._init();
-}
+const Inspector = new Lang.Class({
+ Name: 'Inspector',
-Inspector.prototype = {
_init: function() {
let container = new Shell.GenericContainer({ width: 0,
height: 0 });
@@ -634,15 +622,13 @@ Inspector.prototype = {
this._borderPaintId = addBorderPaintHook(this._target);
}
}
-};
+});
Signals.addSignalMethods(Inspector.prototype);
-function ErrorLog() {
- this._init();
-}
+const ErrorLog = new Lang.Class({
+ Name: 'ErrorLog',
-ErrorLog.prototype = {
_init: function() {
this.actor = new St.BoxLayout();
this.text = new St.Label();
@@ -677,13 +663,11 @@ ErrorLog.prototype = {
}
this.text.text = text;
}
-};
+});
-function Memory() {
- this._init();
-}
+const Memory = new Lang.Class({
+ Name: 'Memory',
-Memory.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ vertical: true });
this._glibc_uordblks = new St.Label();
@@ -728,13 +712,11 @@ Memory.prototype = {
this._gjs_closure.text = 'gjs_closure: ' + memInfo.gjs_closure;
this._last_gc_seconds_ago.text = 'last_gc_seconds_ago: ' + memInfo.last_gc_seconds_ago;
}
-};
+});
-function Extensions() {
- this._init();
-}
+const Extensions = new Lang.Class({
+ Name: 'Extensions',
-Extensions.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ vertical: true,
name: 'lookingGlassExtensions' });
@@ -864,13 +846,11 @@ Extensions.prototype = {
return box;
}
-};
+});
-function LookingGlass() {
- this._init();
-}
+const LookingGlass = new Lang.Class({
+ Name: 'LookingGlass',
-LookingGlass.prototype = {
_init : function() {
this._borderPaintTarget = null;
this._borderPaintId = 0;
@@ -1227,5 +1207,5 @@ LookingGlass.prototype = {
})
});
}
-};
+});
Signals.addSignalMethods(LookingGlass.prototype);
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index c42c146..daa02a7 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -36,11 +36,9 @@ const CROSS_HAIRS_CLIP_KEY = 'cross-hairs-clip';
let magDBusService = null;
-function Magnifier() {
- this._init();
-}
+const Magnifier = new Lang.Class({
+ Name: 'Magnifier',
-Magnifier.prototype = {
_init: function() {
// Magnifier is a manager of ZoomRegions.
this._zoomRegions = [];
@@ -543,14 +541,12 @@ Magnifier.prototype = {
);
}
}
-};
+});
Signals.addSignalMethods(Magnifier.prototype);
-function ZoomRegion(magnifier, mouseSourceActor) {
- this._init(magnifier, mouseSourceActor);
-}
+const ZoomRegion = new Lang.Class({
+ Name: 'ZoomRegion',
-ZoomRegion.prototype = {
_init: function(magnifier, mouseSourceActor) {
this._magnifier = magnifier;
@@ -1150,13 +1146,11 @@ ZoomRegion.prototype = {
yMagMouse - groupHeight / 2);
}
}
-};
+});
-function Crosshairs() {
- this._init();
-}
+const Crosshairs = new Lang.Class({
+ Name: 'Crosshairs',
-Crosshairs.prototype = {
_init: function() {
// Set the group containing the crosshairs to three times the desktop
@@ -1412,4 +1406,4 @@ Crosshairs.prototype = {
this._vertTopHair.set_position((groupWidth - thickness) / 2, top);
this._vertBottomHair.set_position((groupWidth - thickness) / 2, bottom);
}
-};
+});
diff --git a/js/ui/magnifierDBus.js b/js/ui/magnifierDBus.js
index 0fdf04b..8204e72 100644
--- a/js/ui/magnifierDBus.js
+++ b/js/ui/magnifierDBus.js
@@ -1,6 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
+const Lang = imports.lang;
const Main = imports.ui.main;
const MAG_SERVICE_NAME = 'org.gnome.Magnifier';
@@ -95,11 +96,9 @@ const ZoomRegionIface = <interface name={ZOOM_SERVICE_NAME}>
// '/org/gnome/Magnifier/ZoomRegion/zoomer1', etc.
let _zoomRegionInstanceCount = 0;
-function ShellMagnifier() {
- this._init();
-}
+const ShellMagnifier = new Lang.Class({
+ Name: 'ShellMagnifier',
-ShellMagnifier.prototype = {
_init: function() {
this._zoomers = {};
@@ -325,7 +324,7 @@ ShellMagnifier.prototype = {
// Drop the leading '#'.
return parseInt(colorString.slice(1), 16);
}
-};
+});
/**
* ShellMagnifierZoomRegion:
@@ -333,11 +332,9 @@ ShellMagnifier.prototype = {
* @zoomerObjectPath: String that is the path to a DBus ZoomRegion.
* @zoomRegion: The actual zoom region associated with the object path.
*/
-function ShellMagnifierZoomRegion(zoomerObjectPath, zoomRegion) {
- this._init(zoomerObjectPath, zoomRegion);
-}
+const ShellMagnifierZoomRegion = new Lang.Class({
+ Name: 'ShellMagnifierZoomRegion',
-ShellMagnifierZoomRegion.prototype = {
_init: function(zoomerObjectPath, zoomRegion) {
this._zoomRegion = zoomRegion;
@@ -422,4 +419,4 @@ ShellMagnifierZoomRegion.prototype = {
destroy: function() {
this._dbusImpl.unexport();
}
-};
+});
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index e995fc5..79dbe3d 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -83,11 +83,9 @@ function _fixMarkup(text, allowMarkup) {
return GLib.markup_escape_text(text, -1);
}
-function URLHighlighter(text, lineWrap, allowMarkup) {
- this._init(text, lineWrap, allowMarkup);
-}
+const URLHighlighter = new Lang.Class({
+ Name: 'URLHighlighter',
-URLHighlighter.prototype = {
_init: function(text, lineWrap, allowMarkup) {
if (!text)
text = '';
@@ -211,13 +209,11 @@ URLHighlighter.prototype = {
}
return -1;
}
-};
+});
-function FocusGrabber() {
- this._init();
-}
+const FocusGrabber = new Lang.Class({
+ Name: 'FocusGrabber',
-FocusGrabber.prototype = {
_init: function() {
this.actor = null;
@@ -351,7 +347,7 @@ FocusGrabber.prototype = {
this._togglingFocusGrabMode = false;
}
}
-}
+});
Signals.addSignalMethods(FocusGrabber.prototype);
// Notification:
@@ -1141,11 +1137,9 @@ const Source = new Lang.Class({
});
Signals.addSignalMethods(Source.prototype);
-function SummaryItem(source) {
- this._init(source);
-}
+const SummaryItem = new Lang.Class({
+ Name: 'SummaryItem',
-SummaryItem.prototype = {
_init: function(source) {
this.source = source;
this.source.connect('notification-added', Lang.bind(this, this._notificationAddedToSource));
@@ -1336,14 +1330,12 @@ SummaryItem.prototype = {
if (this.notificationStack.get_children().length > 0)
this.notificationStack.get_children()[0]._delegate.setIconVisible(true);
}
-};
+});
Signals.addSignalMethods(SummaryItem.prototype);
-function MessageTray() {
- this._init();
-}
+const MessageTray = new Lang.Class({
+ Name: 'MessageTray',
-MessageTray.prototype = {
_init: function() {
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
this._onStatusChanged(proxy.status);
@@ -2422,7 +2414,7 @@ MessageTray.prototype = {
if (this._clickedSummaryItem)
this._updateState();
}
-};
+});
const SystemNotificationSource = new Lang.Class({
Name: 'SystemNotificationSource',
diff --git a/js/ui/networkAgent.js b/js/ui/networkAgent.js
index 276f140..48337dd 100644
--- a/js/ui/networkAgent.js
+++ b/js/ui/networkAgent.js
@@ -357,11 +357,9 @@ const NetworkSecretDialog = new Lang.Class({
}
});
-function NetworkAgent() {
- this._init.apply(this, arguments);
-}
+const NetworkAgent = new Lang.Class({
+ Name: 'NetworkAgent',
-NetworkAgent.prototype = {
_init: function() {
this._native = new Shell.NetworkAgent({ auto_register: true,
identifier: 'org.gnome.Shell.NetworkAgent' });
@@ -384,4 +382,4 @@ NetworkAgent.prototype = {
this._dialogs[requestId].close(global.get_current_time());
this._dialogs[requestId].destroy();
}
-};
+});
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 6a8ee4a..52169ce 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -87,11 +87,9 @@ const rewriteRules = {
]
};
-function NotificationDaemon() {
- this._init();
-}
+const NotificationDaemon = new Lang.Class({
+ Name: 'NotificationDaemon',
-NotificationDaemon.prototype = {
_init: function() {
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(NotificationDaemonIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
@@ -474,7 +472,7 @@ NotificationDaemon.prototype = {
if (source)
source.destroy();
}
-};
+});
const Source = new Lang.Class({
Name: 'NotificationDaemonSource',
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 567775c..1f66d75 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -46,11 +46,9 @@ const SwipeScrollResult = {
CLICK: 2
};
-function ShellInfo() {
- this._init();
-}
+const ShellInfo = new Lang.Class({
+ Name: 'ShellInfo',
-ShellInfo.prototype = {
_init: function() {
this._source = null;
this._undoCallback = null;
@@ -95,13 +93,11 @@ ShellInfo.prototype = {
this._source.notify(notification);
}
-};
+});
-function Overview() {
- this._init.apply(this, arguments);
-}
+const Overview = new Lang.Class({
+ Name: 'Overview',
-Overview.prototype = {
_init : function(params) {
params = Params.parse(params, { isDummy: false });
@@ -811,5 +807,5 @@ Overview.prototype = {
this._needsFakePointerEvent = false;
}
}
-};
+});
Signals.addSignalMethods(Overview.prototype);
diff --git a/js/ui/panel.js b/js/ui/panel.js
index db53776..a9344bc 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -98,11 +98,9 @@ function _unpremultiply(color) {
};
-function AnimatedIcon(name, size) {
- this._init(name, size);
-}
+const AnimatedIcon = new Lang.Class({
+ Name: 'AnimatedIcon',
-AnimatedIcon.prototype = {
_init: function(name, size) {
this.actor = new St.Bin({ visible: false });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
@@ -139,13 +137,11 @@ AnimatedIcon.prototype = {
if (this._timeoutId)
Mainloop.source_remove(this._timeoutId);
}
-};
+});
-function TextShadower() {
- this._init();
-}
+const TextShadower = new Lang.Class({
+ Name: 'TextShadower',
-TextShadower.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
@@ -225,7 +221,7 @@ TextShadower.prototype = {
child.allocate(childBox, flags);
}
}
-};
+});
/**
* AppMenuButton:
@@ -692,13 +688,11 @@ const ActivitiesButton = new Lang.Class({
Mainloop.source_remove(this._xdndTimeOut);
this._xdndTimeOut = 0;
}
-})
+});
-function PanelCorner(panel, side) {
- this._init(panel, side);
-}
+const PanelCorner = new Lang.Class({
+ Name: 'PanelCorner',
-PanelCorner.prototype = {
_init: function(box, side) {
this._side = side;
@@ -874,14 +868,12 @@ PanelCorner.prototype = {
this.actor.set_size(cornerRadius, innerBorderWidth + cornerRadius);
this.actor.set_anchor_point(0, innerBorderWidth);
}
-};
+});
-function Panel() {
- this._init();
-}
+const Panel = new Lang.Class({
+ Name: 'Panel',
-Panel.prototype = {
_init : function() {
this.actor = new Shell.GenericContainer({ name: 'panel',
reactive: true });
@@ -1108,5 +1100,4 @@ Panel.prototype = {
if (box && box._delegate instanceof PanelMenu.ButtonBox)
box.destroy();
},
-
-};
+});
diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js
index e8cec71..9241ebf 100644
--- a/js/ui/placeDisplay.js
+++ b/js/ui/placeDisplay.js
@@ -120,11 +120,9 @@ const PlaceDeviceInfo = new Lang.Class({
}
});
-function PlacesManager() {
- this._init();
-}
+const PlacesManager = new Lang.Class({
+ Name: 'PlacesManager',
-PlacesManager.prototype = {
_init: function() {
this._defaultPlaces = [];
this._mounts = [];
@@ -355,7 +353,7 @@ PlacesManager.prototype = {
_removeById: function(sourceArray, id) {
sourceArray.splice(this._lookupIndexById(sourceArray, id), 1);
}
-};
+});
Signals.addSignalMethods(PlacesManager.prototype);
const PlaceSearchProvider = new Lang.Class({
diff --git a/js/ui/polkitAuthenticationAgent.js b/js/ui/polkitAuthenticationAgent.js
index 7fe0310..ff2d35c 100644
--- a/js/ui/polkitAuthenticationAgent.js
+++ b/js/ui/polkitAuthenticationAgent.js
@@ -335,11 +335,9 @@ const AuthenticationDialog = new Lang.Class({
});
Signals.addSignalMethods(AuthenticationDialog.prototype);
-function AuthenticationAgent() {
- this._init();
-}
+const AuthenticationAgent = new Lang.Class({
+ Name: 'AuthenticationAgent',
-AuthenticationAgent.prototype = {
_init: function() {
this._native = new Shell.PolkitAuthenticationAgent();
this._native.connect('initiate', Lang.bind(this, this._onInitiate));
@@ -400,7 +398,7 @@ AuthenticationAgent.prototype = {
this._reallyCompleteRequest(wasDismissed);
}
}
-}
+});
function init() {
let agent = new AuthenticationAgent();
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index a8d3384..5652fc4 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -771,7 +771,7 @@ const PopupSwitchMenuItem = new Lang.Class({
this.toggle();
}
- PopupBaseMenuItem.prototype.activate.call(this, event);
+ this.parent(event);
},
toggle: function() {
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index eed4766..69a0c26 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -30,11 +30,9 @@ const EXEC_ARG_KEY = 'exec-arg';
const DIALOG_GROW_TIME = 0.1;
-function CommandCompleter() {
- this._init();
-}
+const CommandCompleter = new Lang.Class({
+ Name: 'CommandCompleter',
-CommandCompleter.prototype = {
_init : function() {
this._changedCount = 0;
this._paths = GLib.getenv('PATH').split(':');
@@ -162,7 +160,7 @@ CommandCompleter.prototype = {
return common.substr(text.length);
return common;
}
-};
+});
const RunDialog = new Lang.Class({
Name: 'RunDialog',
diff --git a/js/ui/search.js b/js/ui/search.js
index 12a12e5..52cd7a8 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -242,11 +242,9 @@ const SearchProvider = new Lang.Class({
});
Signals.addSignalMethods(SearchProvider.prototype);
-function OpenSearchSystem() {
- this._init();
-}
+const OpenSearchSystem = new Lang.Class({
+ Name: 'OpenSearchSystem',
-OpenSearchSystem.prototype = {
_init: function() {
this._providers = [];
global.settings.connect('changed::' + DISABLED_OPEN_SEARCH_PROVIDERS_KEY, Lang.bind(this, this._refresh));
@@ -334,14 +332,12 @@ OpenSearchSystem.prototype = {
}
}));
}
-}
+});
Signals.addSignalMethods(OpenSearchSystem.prototype);
-function SearchSystem() {
- this._init();
-}
+const SearchSystem = new Lang.Class({
+ Name: 'SearchSystem',
-SearchSystem.prototype = {
_init: function() {
this._providers = [];
this.reset();
@@ -429,5 +425,5 @@ SearchSystem.prototype = {
this._previousResults = results;
this.emit('search-completed', results);
},
-};
+});
Signals.addSignalMethods(SearchSystem.prototype);
diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js
index bd551e1..57478b7 100644
--- a/js/ui/searchDisplay.js
+++ b/js/ui/searchDisplay.js
@@ -15,11 +15,9 @@ const Search = imports.ui.search;
const MAX_SEARCH_RESULTS_ROWS = 1;
-function SearchResult(provider, metaInfo, terms) {
- this._init(provider, metaInfo, terms);
-}
+const SearchResult = new Lang.Class({
+ Name: 'SearchResult',
-SearchResult.prototype = {
_init: function(provider, metaInfo, terms) {
this.provider = provider;
this.metaInfo = metaInfo;
@@ -97,7 +95,7 @@ SearchResult.prototype = {
else
this.provider.activateResult(this.metaInfo.id, params);
}
-};
+});
const GridSearchResults = new Lang.Class({
@@ -179,11 +177,9 @@ const GridSearchResults = new Lang.Class({
}
});
-function SearchResults(searchSystem, openSearchSystem) {
- this._init(searchSystem, openSearchSystem);
-}
+const SearchResults = new Lang.Class({
+ Name: 'SearchResults',
-SearchResults.prototype = {
_init: function(searchSystem, openSearchSystem) {
this._searchSystem = searchSystem;
this._searchSystem.connect('search-updated', Lang.bind(this, this._updateCurrentResults));
@@ -483,4 +479,4 @@ SearchResults.prototype = {
resultDisplay.activateSelected();
Main.overview.hide();
}
-};
+});
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 6a0a827..9dd8bcc 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -66,11 +66,9 @@ const GnomeShellIface = <interface name="org.gnome.Shell">
</signal>
</interface>;
-function GnomeShell() {
- this._init();
-}
+const GnomeShell = new Lang.Class({
+ Name: 'GnomeShellDBus',
-GnomeShell.prototype = {
_init: function() {
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
@@ -230,4 +228,4 @@ GnomeShell.prototype = {
this._dbusImpl.emit_signal('ExtensionStatusChanged',
GLib.Variant.new('(sis)', [newState.uuid, newState.state, newState.error]));
}
-};
+});
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index ba5f45e..0fd149e 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -50,11 +50,9 @@ function _setLabelsForMessage(dialog, message) {
/* -------------------------------------------------------- */
-function ListItem(app) {
- this._init(app);
-}
+const ListItem = new Lang.Class({
+ Name: 'ListItem',
-ListItem.prototype = {
_init: function(app) {
this._app = app;
@@ -86,14 +84,12 @@ ListItem.prototype = {
this.emit('activate');
this._app.activate();
}
-};
+});
Signals.addSignalMethods(ListItem.prototype);
-function ShellMountOperation(source, params) {
- this._init(source, params);
-}
+const ShellMountOperation = new Lang.Class({
+ Name: 'ShellMountOperation',
-ShellMountOperation.prototype = {
_init: function(source, params) {
params = Params.parse(params, { reaskPassword: false });
@@ -190,7 +186,7 @@ ShellMountOperation.prototype = {
this._processesDialog.update(message, processes, choices);
},
-}
+});
const ShellMountQuestionDialog = new Lang.Class({
Name: 'ShellMountQuestionDialog',
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index 7efa2e2..b95c8e3 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -353,7 +353,7 @@ const Source = new Lang.Class({
}
}));
- MessageTray.Source.prototype.notify.call(this, notification);
+ this.parent(notification);
},
createNotificationIcon: function() {
@@ -485,7 +485,7 @@ const PinNotification = new Lang.Class({
},
grabFocus: function(lockTray) {
- MessageTray.Notification.prototype.grabFocus.call(this, lockTray);
+ this.parent(lockTray);
global.stage.set_key_focus(this._entry);
}
});
diff --git a/js/ui/statusIconDispatcher.js b/js/ui/statusIconDispatcher.js
index 33bd47b..d168d6d 100644
--- a/js/ui/statusIconDispatcher.js
+++ b/js/ui/statusIconDispatcher.js
@@ -23,11 +23,9 @@ const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
'ibus-ui-gtk': 'input-method'
};
-function StatusIconDispatcher() {
- this._init();
-}
+const StatusIconDispatcher = new Lang.Class({
+ Name: 'StatusIconDispatcher',
-StatusIconDispatcher.prototype = {
_init: function() {
this._traymanager = new Shell.TrayManager();
this._traymanager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
@@ -61,5 +59,5 @@ StatusIconDispatcher.prototype = {
else
this.emit('message-icon-removed', icon);
}
-};
+});
Signals.addSignalMethods(StatusIconDispatcher.prototype);
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 6d717fc..08d6c8c 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -72,11 +72,9 @@ function makeMessageFromTplEvent(event) {
};
}
-function Client() {
- this._init();
-};
+const Client = new Lang.Class({
+ Name: 'Client',
-Client.prototype = {
_init : function() {
// channel path -> ChatSource
this._chatSources = {};
@@ -479,7 +477,7 @@ Client.prototype = {
return this._accountSource;
}
-};
+});
const ChatSource = new Lang.Class({
Name: 'ChatSource',
@@ -694,7 +692,7 @@ const ChatSource = new Lang.Class({
},
notify: function() {
- MessageTray.Source.prototype.notify.call(this, this._notification);
+ this.parent(this._notification);
},
respond: function(text) {
@@ -1113,7 +1111,7 @@ const ApproverSource = new Lang.Class({
this._invalidId = 0;
}
- MessageTray.Source.prototype.destroy.call(this);
+ this.parent();
},
createNotificationIcon: function() {
diff --git a/js/ui/tweener.js b/js/ui/tweener.js
index d68d666..7d98a65 100644
--- a/js/ui/tweener.js
+++ b/js/ui/tweener.js
@@ -202,11 +202,9 @@ function registerSpecialPropertySplitter(name, splitFunction, parameters) {
// time updates; even better is to pay attention to the vertical
// vblank and sync to that when possible.)
//
-function ClutterFrameTicker() {
- this._init();
-}
+const ClutterFrameTicker = new Lang.Class({
+ Name: 'ClutterFrameTicker',
-ClutterFrameTicker.prototype = {
FRAME_RATE : 60,
_init : function() {
@@ -261,6 +259,6 @@ ClutterFrameTicker.prototype = {
this._startTime = -1;
global.end_work();
}
-};
+});
Signals.addSignalMethods(ClutterFrameTicker.prototype);
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index dd70ca3..f7bf491 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -301,11 +301,9 @@ const SearchTab = new Lang.Class({
});
-function ViewSelector() {
- this._init();
-}
+const ViewSelector = new Lang.Class({
+ Name: 'ViewSelector',
-ViewSelector.prototype = {
_init : function() {
this.actor = new St.BoxLayout({ name: 'viewSelector',
vertical: true });
@@ -565,5 +563,5 @@ ViewSelector.prototype = {
removeSearchProvider: function(provider) {
this._searchTab.removeSearchProvider(provider);
}
-};
+});
Signals.addSignalMethods(ViewSelector.prototype);
diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js
index af31bdd..3c946ad 100644
--- a/js/ui/windowAttentionHandler.js
+++ b/js/ui/windowAttentionHandler.js
@@ -6,11 +6,9 @@ const Shell = imports.gi.Shell;
const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
-function WindowAttentionHandler() {
- this._init();
-}
+const WindowAttentionHandler = new Lang.Class({
+ Name: 'WindowAttentionHandler',
-WindowAttentionHandler.prototype = {
_init : function() {
this._tracker = Shell.WindowTracker.get_default();
global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention));
@@ -43,7 +41,7 @@ WindowAttentionHandler.prototype = {
notification.update(title, banner);
})));
}
-};
+});
const Source = new Lang.Class({
Name: 'WindowAttentionSource',
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 4343a20..637d842 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -31,11 +31,9 @@ function getTopInvisibleBorder(metaWindow) {
return outerRect.y - inputRect.y;
}
-function WindowDimmer(actor) {
- this._init(actor);
-}
+const WindowDimmer = new Lang.Class({
+ Name: 'WindowDimmer',
-WindowDimmer.prototype = {
_init: function(actor) {
if (Clutter.feature_available(Clutter.FeatureFlags.SHADERS_GLSL)) {
this._effect = new Clutter.ShaderEffect({ shader_type: Clutter.ShaderType.FRAGMENT_SHADER });
@@ -75,7 +73,7 @@ WindowDimmer.prototype = {
},
_dimFraction: 0.0
-};
+});
function getWindowDimmer(actor) {
if (!actor._windowDimmer)
@@ -84,11 +82,9 @@ function getWindowDimmer(actor) {
return actor._windowDimmer;
}
-function WindowManager() {
- this._init();
-}
+const WindowManager = new Lang.Class({
+ Name: 'WindowManager',
-WindowManager.prototype = {
_init : function() {
this._shellwm = global.window_manager;
@@ -627,4 +623,4 @@ WindowManager.prototype = {
if (!Main.overview.visible)
this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.DOWN, indexToActivate);
}
-};
+});
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 97b0893..d7b61df 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -56,11 +56,13 @@ function _clamp(value, min, max) {
}
-function ScaledPoint(x, y, scaleX, scaleY) {
- [this.x, this.y, this.scaleX, this.scaleY] = arguments;
-}
+const ScaledPoint = new Lang.Class({
+ Name: 'ScaledPoint',
+
+ _init: function(x, y, scaleX, scaleY) {
+ [this.x, this.y, this.scaleX, this.scaleY] = arguments;
+ },
-ScaledPoint.prototype = {
getPosition : function() {
return [this.x, this.y];
},
@@ -86,14 +88,12 @@ ScaledPoint.prototype = {
return [_interpolate(this.scaleX, other.scaleX, step),
_interpolate(this.scaleY, other.scaleY, step)];
}
-};
+});
-function WindowClone(realWindow) {
- this._init(realWindow);
-}
+const WindowClone = new Lang.Class({
+ Name: 'WindowClone',
-WindowClone.prototype = {
_init : function(realWindow) {
this.realWindow = realWindow;
this.metaWindow = realWindow.meta_window;
@@ -418,7 +418,7 @@ WindowClone.prototype = {
this.emit('drag-end');
}
-};
+});
Signals.addSignalMethods(WindowClone.prototype);
@@ -427,11 +427,9 @@ Signals.addSignalMethods(WindowClone.prototype);
* @parentActor: The actor which will be the parent of all overlay items
* such as app icon and window caption
*/
-function WindowOverlay(windowClone, parentActor) {
- this._init(windowClone, parentActor);
-}
+const WindowOverlay = new Lang.Class({
+ Name: 'WindowOverlay',
-WindowOverlay.prototype = {
_init : function(windowClone, parentActor) {
let metaWindow = windowClone.metaWindow;
@@ -642,7 +640,7 @@ WindowOverlay.prototype = {
this._parentActor.queue_relayout();
}
-};
+});
Signals.addSignalMethods(WindowOverlay.prototype);
const WindowPositionFlags = {
@@ -653,11 +651,9 @@ const WindowPositionFlags = {
/**
* @metaWorkspace: a #Meta.Workspace, or null
*/
-function Workspace(metaWorkspace, monitorIndex) {
- this._init(metaWorkspace, monitorIndex);
-}
+const Workspace = new Lang.Class({
+ Name: 'Workspace',
-Workspace.prototype = {
_init : function(metaWorkspace, monitorIndex) {
// When dragging a window, we use this slot for reserve space.
this._reservedSlot = null;
@@ -1518,6 +1514,6 @@ Workspace.prototype = {
return false;
}
-};
+});
Signals.addSignalMethods(Workspace.prototype);
diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js
index a4883d4..58dd657 100644
--- a/js/ui/workspaceSwitcherPopup.js
+++ b/js/ui/workspaceSwitcherPopup.js
@@ -15,11 +15,9 @@ const DISPLAY_TIMEOUT = 600;
const UP = -1;
const DOWN = 1;
-function WorkspaceSwitcherPopup() {
- this._init();
-}
+const WorkspaceSwitcherPopup = new Lang.Class({
+ Name: 'WorkspaceSwitcherPopup',
-WorkspaceSwitcherPopup.prototype = {
_init : function() {
this.actor = new St.Group({ reactive: true,
x: 0,
@@ -158,4 +156,4 @@ WorkspaceSwitcherPopup.prototype = {
onCompleteScope: this
});
}
-};
+});
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 504d32b..3305990 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -25,11 +25,9 @@ const SLIDE_ANIMATION_TIME = 0.2;
// placeholder exactly.
const WORKSPACE_CUT_SIZE = 10;
-function WindowClone(realWindow) {
- this._init(realWindow);
-}
+const WindowClone = new Lang.Class({
+ Name: 'WindowClone',
-WindowClone.prototype = {
_init : function(realWindow) {
this.actor = new Clutter.Clone({ source: realWindow.get_texture(),
reactive: true });
@@ -126,7 +124,7 @@ WindowClone.prototype = {
this.emit('drag-end');
}
-};
+});
Signals.addSignalMethods(WindowClone.prototype);
@@ -144,11 +142,9 @@ const ThumbnailState = {
/**
* @metaWorkspace: a #Meta.Workspace
*/
-function WorkspaceThumbnail(metaWorkspace) {
- this._init(metaWorkspace);
-}
+const WorkspaceThumbnail = new Lang.Class({
+ Name: 'WorkspaceThumbnail',
-WorkspaceThumbnail.prototype = {
_init : function(metaWorkspace) {
this.metaWorkspace = metaWorkspace;
this.monitorIndex = Main.layoutManager.primaryIndex;
@@ -469,16 +465,14 @@ WorkspaceThumbnail.prototype = {
return false;
}
-};
+});
Signals.addSignalMethods(WorkspaceThumbnail.prototype);
-function ThumbnailsBox() {
- this._init();
-}
+const ThumbnailsBox = new Lang.Class({
+ Name: 'ThumbnailsBox',
-ThumbnailsBox.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer({ style_class: 'workspace-thumbnails',
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
@@ -1028,4 +1022,4 @@ ThumbnailsBox.prototype = {
onCompleteScope: this
});
}
-};
+});
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index d994885..fb45e21 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -23,11 +23,9 @@ const MAX_WORKSPACES = 16;
const CONTROLS_POP_IN_TIME = 0.1;
-function WorkspacesView(workspaces) {
- this._init(workspaces);
-}
+const WorkspacesView = new Lang.Class({
+ Name: 'WorkspacesView',
-WorkspacesView.prototype = {
_init: function(workspaces) {
this.actor = new St.Group({ style_class: 'workspaces-view' });
@@ -452,15 +450,13 @@ WorkspacesView.prototype = {
_getWorkspaceIndexToRemove: function() {
return global.screen.get_active_workspace_index();
}
-};
+});
Signals.addSignalMethods(WorkspacesView.prototype);
-function WorkspacesDisplay() {
- this._init();
-}
+const WorkspacesDisplay = new Lang.Class({
+ Name: 'WorkspacesDisplay',
-WorkspacesDisplay.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
@@ -852,5 +848,5 @@ WorkspacesDisplay.prototype = {
break;
}
}
-};
+});
Signals.addSignalMethods(WorkspacesDisplay.prototype);
diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js
index 08f0b47..26f5432 100644
--- a/js/ui/xdndHandler.js
+++ b/js/ui/xdndHandler.js
@@ -6,11 +6,9 @@ const Shell = imports.gi.Shell;
const Signals = imports.signals;
const DND = imports.ui.dnd;
-function XdndHandler() {
- this._init();
-}
+const XdndHandler = new Lang.Class({
+ Name: 'XdndHandler',
-XdndHandler.prototype = {
_init: function() {
// Used to display a clone of the cursor window when the
// window group is hidden (like it happens in the overview)
@@ -125,6 +123,6 @@ XdndHandler.prototype = {
pickedActor = pickedActor.get_parent();
}
}
-}
+});
Signals.addSignalMethods(XdndHandler.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]