Port all classes with inheritance to class framework

All classes that have at least one other derived class (and thus
benefit from the framework) have been now ported. These includes
NMDevice, SearchProvider, AltTab.SwitcherList, and some other
stuff around.

https://bugzilla.gnome.org/show_bug.cgi?id=664436
This commit is contained in:
Giovanni Campagna 2011-11-20 17:07:14 +01:00
parent 987099ea55
commit d6b6f814d3
16 changed files with 177 additions and 292 deletions

View File

@ -21,11 +21,9 @@
const Lang = imports.lang;
const Signals = imports.signals;
function Task() {
this._init.apply(this, arguments);
}
const Task = new Lang.Class({
Name: 'Task',
Task.prototype = {
_init: function(scope, handler) {
if (scope)
this.scope = scope;
@ -41,22 +39,17 @@ Task.prototype = {
return null;
},
};
});
Signals.addSignalMethods(Task.prototype);
function Hold() {
this._init.apply(this, arguments);
}
Hold.prototype = {
__proto__: Task.prototype,
const Hold = new Lang.Class({
Name: 'Hold',
Extends: Task,
_init: function() {
Task.prototype._init.call(this,
this,
function () {
return this;
});
this.parent(this, function () {
return this;
});
this._acquisitions = 1;
},
@ -88,18 +81,15 @@ Hold.prototype = {
isAcquired: function() {
return this._acquisitions > 0;
}
}
});
Signals.addSignalMethods(Hold.prototype);
function Batch() {
this._init.apply(this, arguments);
}
Batch.prototype = {
__proto__: Task.prototype,
const Batch = new Lang.Class({
Name: 'Batch',
Extends: Task,
_init: function(scope, tasks) {
Task.prototype._init.call(this);
this.parent();
this.tasks = [];
@ -166,20 +156,12 @@ Batch.prototype = {
cancel: function() {
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
}
};
});
Signals.addSignalMethods(Batch.prototype);
function ConcurrentBatch() {
this._init.apply(this, arguments);
}
ConcurrentBatch.prototype = {
__proto__: Batch.prototype,
_init: function(scope, tasks) {
Batch.prototype._init.call(this, scope, tasks);
},
const ConcurrentBatch = new Lang.Class({
Name: 'ConcurrentBatch',
Extends: Batch,
process: function() {
let hold = this.runTask();
@ -193,19 +175,12 @@ ConcurrentBatch.prototype = {
// concurrently.
this.nextTask();
}
};
});
Signals.addSignalMethods(ConcurrentBatch.prototype);
function ConsecutiveBatch() {
this._init.apply(this, arguments);
}
ConsecutiveBatch.prototype = {
__proto__: Batch.prototype,
_init: function(scope, tasks) {
Batch.prototype._init.call(this, scope, tasks);
},
const ConsecutiveBatch = new Lang.Class({
Name: 'ConsecutiveBatch',
Extends: Batch,
process: function() {
let hold = this.runTask();
@ -224,5 +199,5 @@ ConsecutiveBatch.prototype = {
this.nextTask();
}
}
};
});
Signals.addSignalMethods(ConsecutiveBatch.prototype);

View File

@ -542,11 +542,9 @@ AltTabPopup.prototype = {
}
};
function SwitcherList(squareItems) {
this._init(squareItems);
}
const SwitcherList = new Lang.Class({
Name: 'SwitcherList',
SwitcherList.prototype = {
_init : function(squareItems) {
this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' });
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
@ -851,7 +849,7 @@ SwitcherList.prototype = {
// Clip the area for scrolling
this._clipBin.set_clip(0, -topPadding, (this.actor.allocation.x2 - this.actor.allocation.x1) - leftPadding - rightPadding, this.actor.height + bottomPadding);
}
};
});
Signals.addSignalMethods(SwitcherList.prototype);
@ -879,15 +877,12 @@ AppIcon.prototype = {
}
};
function AppSwitcher() {
this._init.apply(this, arguments);
}
AppSwitcher.prototype = {
__proto__ : SwitcherList.prototype,
const AppSwitcher = new Lang.Class({
Name: 'AppSwitcher',
Extends: SwitcherList,
_init : function(localApps, otherApps, altTabPopup) {
SwitcherList.prototype._init.call(this, true);
this.parent(true);
// Construct the AppIcons, add to the popup
let activeWorkspace = global.screen.get_active_workspace();
@ -966,7 +961,7 @@ AppSwitcher.prototype = {
_allocate: function (actor, box, flags) {
// Allocate the main list items
SwitcherList.prototype._allocate.call(this, actor, box, flags);
this.parent(actor, box, flags);
let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
let arrowWidth = arrowHeight * 2;
@ -1021,7 +1016,7 @@ AppSwitcher.prototype = {
this._arrows[this._curApp].remove_style_pseudo_class('highlighted');
}
SwitcherList.prototype.highlight.call(this, n, justOutline);
this.parent(n, justOutline);
this._curApp = n;
if (this._curApp != -1) {
@ -1045,17 +1040,14 @@ AppSwitcher.prototype = {
if (appIcon.cachedWindows.length == 1)
arrow.hide();
}
};
});
function ThumbnailList(windows) {
this._init(windows);
}
ThumbnailList.prototype = {
__proto__ : SwitcherList.prototype,
const ThumbnailList = new Lang.Class({
Name: 'ThumbnailList',
Extends: SwitcherList,
_init : function(windows) {
SwitcherList.prototype._init.call(this);
this.parent(false);
let activeWorkspace = global.screen.get_active_workspace();
@ -1133,7 +1125,7 @@ ThumbnailList.prototype = {
// Make sure we only do this once
this._thumbnailBins = new Array();
}
};
});
function _drawArrow(area, side) {
let themeNode = area.get_theme_node();

View File

@ -308,15 +308,13 @@ AllAppDisplay.prototype = {
}
};
function AppSearchProvider() {
this._init();
}
AppSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
const AppSearchProvider = new Lang.Class({
Name: 'AppSearchProvider',
Extends: Search.SearchProvider,
_init: function() {
Search.SearchProvider.prototype._init.call(this, _("APPLICATIONS"));
this.parent(_("APPLICATIONS"));
this._appSys = Shell.AppSystem.get_default();
},
@ -364,17 +362,15 @@ AppSearchProvider.prototype = {
let icon = new AppWellIcon(app);
return icon.actor;
}
};
});
function SettingsSearchProvider() {
this._init();
}
SettingsSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
const SettingsSearchProvider = new Lang.Class({
Name: 'SettingsSearchProvider',
Extends: Search.SearchProvider,
_init: function() {
Search.SearchProvider.prototype._init.call(this, _("SETTINGS"));
this.parent(_("SETTINGS"));
this._appSys = Shell.AppSystem.get_default();
this._gnomecc = this._appSys.lookup_app('gnome-control-center.desktop');
},
@ -412,29 +408,24 @@ SettingsSearchProvider.prototype = {
let icon = new AppWellIcon(app);
return icon.actor;
}
};
});
function AppIcon(app, params) {
this._init(app, params);
}
AppIcon.prototype = {
__proto__: IconGrid.BaseIcon.prototype,
const AppIcon = new Lang.Class({
Name: 'AppIcon',
Extends: IconGrid.BaseIcon,
_init : function(app, params) {
this.app = app;
let label = this.app.get_name();
IconGrid.BaseIcon.prototype._init.call(this,
label,
params);
this.parent(label, params);
},
createIcon: function(iconSize) {
return this.app.create_icon_texture(iconSize);
}
};
});
function AppWellIcon(app, iconParams, onActivateOverride) {
this._init(app, iconParams, onActivateOverride);

View File

@ -135,15 +135,12 @@ Contact.prototype = {
/* Searches for and returns contacts */
function ContactSearchProvider() {
this._init();
}
ContactSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
const ContactSearchProvider = new Lang.Class({
Name: 'ContactSearchProvider',
Extends: Search.SearchProvider,
_init: function() {
Search.SearchProvider.prototype._init.call(this, _("CONTACTS"));
this.parent(_("CONTACTS"));
this._contactSys = Shell.ContactSystem.get_default();
},
@ -182,4 +179,4 @@ ContactSearchProvider.prototype = {
activateResult: function(id, params) {
launchContact(id);
}
};
});

View File

@ -305,15 +305,12 @@ CtrlAltTabPopup.prototype = {
}
};
function CtrlAltTabSwitcher(items) {
this._init(items);
}
CtrlAltTabSwitcher.prototype = {
__proto__ : AltTab.SwitcherList.prototype,
const CtrlAltTabSwitcher = new Lang.Class({
Name: 'CtrlAltTabSwitcher',
Extends: AltTab.SwitcherList,
_init : function(items) {
AltTab.SwitcherList.prototype._init.call(this, true);
this.parent(true);
for (let i = 0; i < items.length; i++)
this._addIcon(items[i]);
@ -336,4 +333,4 @@ CtrlAltTabSwitcher.prototype = {
this.addItem(box, text);
}
};
});

View File

@ -19,11 +19,9 @@ const DASH_ANIMATION_TIME = 0.2;
// A container like StBin, but taking the child's scale into account
// when requesting a size
function DashItemContainer() {
this._init();
}
const DashItemContainer = new Lang.Class({
Name: 'DashItemContainer',
DashItemContainer.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer({ style_class: 'dash-item-container' });
this.actor.connect('get-preferred-width',
@ -157,17 +155,14 @@ DashItemContainer.prototype = {
get childOpacity() {
return this._childOpacity;
}
};
});
function RemoveFavoriteIcon() {
this._init();
}
RemoveFavoriteIcon.prototype = {
__proto__: DashItemContainer.prototype,
const RemoveFavoriteIcon = new Lang.Class({
Name: 'RemoveFavoriteIcon',
Extends: DashItemContainer,
_init: function() {
DashItemContainer.prototype._init.call(this);
this.parent();
this._iconBin = new St.Bin({ style_class: 'remove-favorite' });
this._iconActor = null;
@ -219,22 +214,17 @@ RemoveFavoriteIcon.prototype = {
return true;
}
};
});
function DragPlaceholderItem() {
this._init();
}
DragPlaceholderItem.prototype = {
__proto__: DashItemContainer.prototype,
const DragPlaceholderItem = new Lang.Class({
Name: 'DragPlaceholderItem',
Extends: DashItemContainer,
_init: function() {
DashItemContainer.prototype._init.call(this);
this.parent();
this.setChild(new St.Bin({ style_class: 'placeholder' }));
}
};
});
function Dash() {
this._init();

View File

@ -1,19 +1,16 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const DocInfo = imports.misc.docInfo;
const Lang = imports.lang;
const Params = imports.misc.params;
const Search = imports.ui.search;
function DocSearchProvider() {
this._init();
}
DocSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
const DocSearchProvider = new Lang.Class({
Name: 'DocSearchProvider',
Extends: Search.SearchProvider,
_init: function(name) {
Search.SearchProvider.prototype._init.call(this, _("RECENT ITEMS"));
this.parent(_("RECENT ITEMS"));
this._docManager = DocInfo.getDocManager();
},
@ -44,4 +41,4 @@ DocSearchProvider.prototype = {
getSubsearchResultSet: function(previousResults, terms) {
return this._docManager.subsearch(previousResults, terms);
}
};
});

View File

@ -10,11 +10,9 @@ const Params = imports.misc.params;
const ICON_SIZE = 48;
function BaseIcon(label, createIcon) {
this._init(label, createIcon);
}
const BaseIcon = new Lang.Class({
Name: 'BaseIcon',
BaseIcon.prototype = {
_init : function(label, params) {
params = Params.parse(params, { createIcon: null,
setSizeManually: false,
@ -149,7 +147,7 @@ BaseIcon.prototype = {
this._createIconTexture(size);
}
};
});
function IconGrid(params) {
this._init(params);

View File

@ -4,11 +4,9 @@ const Lang = imports.lang;
const Signals = imports.signals;
const St = imports.gi.St;
function Link(props) {
this._init(props);
}
const Link = new Lang.Class({
Name: 'Link',
Link.prototype = {
_init : function(props) {
let realProps = { reactive: true,
track_hover: true,
@ -19,6 +17,5 @@ Link.prototype = {
this.actor = new St.Button(realProps);
}
};
});
Signals.addSignalMethods(Link.prototype);

View File

@ -262,12 +262,9 @@ function objectToString(o) {
}
}
function ObjLink(o, title) {
this._init(o, title);
}
ObjLink.prototype = {
__proto__: Link.Link,
const ObjLink = new Lang.Class({
Name: 'ObjLink',
Extends: Link.Link,
_init: function(o, title) {
let text;
@ -277,7 +274,8 @@ ObjLink.prototype = {
text = objectToString(o);
text = GLib.markup_escape_text(text, -1);
this._obj = o;
Link.Link.prototype._init.call(this, { label: text });
this.parent({ label: text });
this.actor.get_child().single_line_mode = true;
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
},
@ -285,7 +283,7 @@ ObjLink.prototype = {
_onClicked: function (link) {
Main.lookingGlass.inspectObject(this._obj, this.actor);
}
};
});
function Result(command, o, index) {
this._init(command, o, index);

View File

@ -22,11 +22,9 @@ const Util = imports.misc.util;
* @iconFactory: A JavaScript callback which will create an icon texture given a size parameter
* @launch: A JavaScript callback to launch the entry
*/
function PlaceInfo(id, name, iconFactory, launch) {
this._init(id, name, iconFactory, launch);
}
const PlaceInfo = new Lang.Class({
Name: 'PlaceInfo',
PlaceInfo.prototype = {
_init: function(id, name, iconFactory, launch) {
this.id = id;
this.name = name;
@ -55,7 +53,7 @@ PlaceInfo.prototype = {
isRemovable: function() {
return false;
}
};
});
// Helper function to translate launch parameters into a GAppLaunchContext
function _makeLaunchContext(params)
@ -72,12 +70,9 @@ function _makeLaunchContext(params)
return launchContext;
}
function PlaceDeviceInfo(mount) {
this._init(mount);
}
PlaceDeviceInfo.prototype = {
__proto__: PlaceInfo.prototype,
const PlaceDeviceInfo = new Lang.Class({
Name: 'PlaceDeviceInfo',
Extends: PlaceInfo,
_init: function(mount) {
this._mount = mount;
@ -123,7 +118,7 @@ PlaceDeviceInfo.prototype = {
_("Retry"));
}
}
};
});
function PlacesManager() {
this._init();
@ -363,16 +358,12 @@ PlacesManager.prototype = {
};
Signals.addSignalMethods(PlacesManager.prototype);
function PlaceSearchProvider() {
this._init();
}
PlaceSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
const PlaceSearchProvider = new Lang.Class({
Name: 'PlaceSearchProvider',
Extends: Search.SearchProvider,
_init: function() {
Search.SearchProvider.prototype._init.call(this, _("PLACES & DEVICES"));
this.parent(_("PLACES & DEVICES"));
},
getResultMeta: function(resultId) {
@ -434,4 +425,4 @@ PlaceSearchProvider.prototype = {
let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); });
return this._searchPlaces(places, terms);
}
};
});

View File

@ -164,14 +164,12 @@ CommandCompleter.prototype = {
}
};
function RunDialog() {
this._init();
}
const RunDialog = new Lang.Class({
Name: 'RunDialog',
Extends: ModalDialog.ModalDialog,
RunDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init : function() {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'run-dialog' });
this.parent({ styleClass: 'run-dialog' });
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema: TERMINAL_SCHEMA });
@ -384,8 +382,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
if (this._lockdownSettings.get_boolean(DISABLE_COMMAND_LINE_KEY))
return;
ModalDialog.ModalDialog.prototype.open.call(this);
this.parent();
},
};
});
Signals.addSignalMethods(RunDialog.prototype);

View File

@ -23,11 +23,9 @@ const MatchType = {
MULTIPLE_PREFIX: 4
};
function SearchResultDisplay(provider) {
this._init(provider);
}
const SearchResultDisplay = new Lang.Class({
Name: 'SearchResultDisplay',
SearchResultDisplay.prototype = {
_init: function(provider) {
this.provider = provider;
this.actor = null;
@ -96,7 +94,7 @@ SearchResultDisplay.prototype = {
activateSelected: function() {
throw new Error('Not implemented');
}
};
});
/**
* SearchProvider:
@ -105,11 +103,9 @@ SearchResultDisplay.prototype = {
* to the search system, then call registerProvider()
* in SearchSystem with an instance.
*/
function SearchProvider(title) {
this._init(title);
}
const SearchProvider = new Lang.Class({
Name: 'SearchProvider',
SearchProvider.prototype = {
_init: function(title) {
this.title = title;
this.searchSystem = null;
@ -243,7 +239,7 @@ SearchProvider.prototype = {
activateResult: function(id) {
throw new Error('Not implemented');
}
};
});
Signals.addSignalMethods(SearchProvider.prototype);
function OpenSearchSystem() {

View File

@ -100,15 +100,13 @@ SearchResult.prototype = {
};
function GridSearchResults(provider, grid) {
this._init(provider, grid);
}
GridSearchResults.prototype = {
__proto__: Search.SearchResultDisplay.prototype,
const GridSearchResults = new Lang.Class({
Name: 'GridSearchResults',
Extends: Search.SearchResultDisplay,
_init: function(provider, grid) {
Search.SearchResultDisplay.prototype._init.call(this, provider);
this.parent(provider);
this._grid = grid || new IconGrid.IconGrid({ rowLimit: MAX_SEARCH_RESULTS_ROWS,
xAlign: St.Align.START });
this.actor = new St.Bin({ x_align: St.Align.START });
@ -179,8 +177,7 @@ GridSearchResults.prototype = {
let targetActor = this._grid.getItemAtIndex(this.selectionIndex);
targetActor._delegate.activate();
}
};
});
function SearchResults(searchSystem, openSearchSystem) {
this._init(searchSystem, openSearchSystem);

View File

@ -278,11 +278,10 @@ const NMWirelessSectionTitleMenuItem = new Lang.Class({
}
});
function NMDevice() {
throw new TypeError('Instantanting abstract class NMDevice');
}
const NMDevice = new Lang.Class({
Name: 'NMDevice',
Abstract: true,
NMDevice.prototype = {
_init: function(client, device, connections) {
this.device = device;
if (device) {
@ -664,26 +663,23 @@ NMDevice.prototype = {
return out;
}
};
});
Signals.addSignalMethods(NMDevice.prototype);
function NMDeviceWired() {
this._init.apply(this, arguments);
}
NMDeviceWired.prototype = {
__proto__: NMDevice.prototype,
const NMDeviceWired = new Lang.Class({
Name: 'NMDeviceWired',
Extends: NMDevice,
_init: function(client, device, connections) {
this._autoConnectionName = _("Auto Ethernet");
this.category = NMConnectionCategory.WIRED;
NMDevice.prototype._init.call(this, client, device, connections);
this.parent(client, device, connections);
},
_createSection: function() {
NMDevice.prototype._createSection.call(this);
this.parent();
// if we have only one connection (normal or automatic)
// we hide the connection list, and use the switch to control
@ -708,14 +704,11 @@ NMDeviceWired.prototype = {
}));
return connection;
}
};
});
function NMDeviceModem() {
this._init.apply(this, arguments);
}
NMDeviceModem.prototype = {
__proto__: NMDevice.prototype,
const NMDeviceModem = new Lang.Class({
Name: 'NMDeviceModem',
Extends: NMDevice,
_init: function(client, device, connections) {
let is_wwan = false;
@ -764,7 +757,7 @@ NMDeviceModem.prototype = {
}));
}
NMDevice.prototype._init.call(this, client, device, connections);
this.parent(client, device, connections);
},
setEnabled: function(enabled) {
@ -777,7 +770,7 @@ NMDeviceModem.prototype = {
this.statusItem.setStatus(this.getStatusLabel());
}
NMDevice.prototype.setEnabled.call(this, enabled);
this.parent(enabled);
},
get connected() {
@ -794,7 +787,7 @@ NMDeviceModem.prototype = {
this._signalQualityId = 0;
}
NMDevice.prototype.destroy.call(this);
this.parent();
},
_getSignalIcon: function() {
@ -815,13 +808,13 @@ NMDeviceModem.prototype = {
this.section.addMenuItem(this._operatorItem);
}
NMDevice.prototype._createSection.call(this);
this.parent();
},
_clearSection: function() {
this._operatorItem = null;
NMDevice.prototype._clearSection.call(this);
this.parent();
},
_createAutomaticConnection: function() {
@ -831,14 +824,11 @@ NMDeviceModem.prototype = {
'connect-3g', this.device.get_path()]);
return null;
}
};
});
function NMDeviceBluetooth() {
this._init.apply(this, arguments);
}
NMDeviceBluetooth.prototype = {
__proto__: NMDevice.prototype,
const NMDeviceBluetooth = new Lang.Class({
Name: 'NMDeviceBluetooth',
Extends: NMDevice,
_init: function(client, device, connections) {
this._autoConnectionName = this._makeConnectionName(device);
@ -846,7 +836,7 @@ NMDeviceBluetooth.prototype = {
this.category = NMConnectionCategory.WWAN;
NMDevice.prototype._init.call(this, client, device, connections);
this.parent(client, device, connections);
},
_createAutomaticConnection: function() {
@ -876,23 +866,20 @@ NMDeviceBluetooth.prototype = {
this._clearSection();
this._createSection();
}
};
});
// Not a real device, but I save a lot code this way
function NMDeviceVPN() {
this._init.apply(this, arguments);
}
NMDeviceVPN.prototype = {
__proto__: NMDevice.prototype,
const NMDeviceVPN = new Lang.Class({
Name: 'NMDeviceVPN',
Extends: NMDevice,
_init: function(client) {
// Disable autoconnections
this._autoConnectionName = null;
this.category = NMConnectionCategory.VPN;
NMDevice.prototype._init.call(this, client, null, [ ]);
this.parent(client, null, [ ]);
},
connectionValid: function(connection) {
@ -908,7 +895,7 @@ NMDeviceVPN.prototype = {
},
setActiveConnection: function(activeConnection) {
NMDevice.prototype.setActiveConnection.call(this, activeConnection);
this.parent(activeConnection);
this.emit('active-connection-changed');
},
@ -925,14 +912,11 @@ NMDeviceVPN.prototype = {
getStatusLabel: function() {
return null;
}
};
});
function NMDeviceWireless() {
this._init.apply(this, arguments);
}
NMDeviceWireless.prototype = {
__proto__: NMDevice.prototype,
const NMDeviceWireless = new Lang.Class({
Name: 'NMDeviceWireless',
Extends: NMDevice,
_init: function(client, device, connections) {
this.category = NMConnectionCategory.WIRELESS;
@ -1004,7 +988,7 @@ NMDeviceWireless.prototype = {
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
NMDevice.prototype._init.call(this, client, device, validConnections);
this.parent(client, device, validConnections);
},
destroy: function() {
@ -1024,7 +1008,7 @@ NMDeviceWireless.prototype = {
this._apRemovedId = 0;
}
NMDevice.prototype.destroy.call(this);
this.parent();
},
setEnabled: function(enabled) {
@ -1338,7 +1322,7 @@ NMDeviceWireless.prototype = {
},
_clearSection: function() {
NMDevice.prototype._clearSection.call(this);
this.parent();
for (let i = 0; i < this._networks.length; i++)
this._networks[i].item = null;
@ -1546,7 +1530,7 @@ NMDeviceWireless.prototype = {
this._createNetworkItem(apObj, j + activeOffset);
}
},
};
});
const NMApplet = new Lang.Class({
Name: 'NMApplet',

View File

@ -15,11 +15,9 @@ const SearchDisplay = imports.ui.searchDisplay;
const ShellEntry = imports.ui.shellEntry;
const Tweener = imports.ui.tweener;
function BaseTab(titleActor, pageActor, name, a11yIcon) {
this._init(titleActor, pageActor, name, a11yIcon);
}
const BaseTab = new Lang.Class({
Name: 'BaseTab',
BaseTab.prototype = {
_init: function(titleActor, pageActor, name, a11yIcon) {
this.title = titleActor;
this.page = new St.Bin({ child: pageActor,
@ -75,16 +73,13 @@ BaseTab.prototype = {
_activate: function() {
this.emit('activated');
}
};
});
Signals.addSignalMethods(BaseTab.prototype);
function ViewTab(id, label, pageActor, a11yIcon) {
this._init(id, label, pageActor, a11yIcon);
}
ViewTab.prototype = {
__proto__: BaseTab.prototype,
const ViewTab = new Lang.Class({
Name: 'ViewTab',
Extends: BaseTab,
_init: function(id, label, pageActor, a11yIcon) {
this.id = id;
@ -93,17 +88,14 @@ ViewTab.prototype = {
style_class: 'view-tab-title' });
titleActor.connect('clicked', Lang.bind(this, this._activate));
BaseTab.prototype._init.call(this, titleActor, pageActor, label, a11yIcon);
this.parent(titleActor, pageActor, label, a11yIcon);
}
};
});
function SearchTab() {
this._init();
}
SearchTab.prototype = {
__proto__: BaseTab.prototype,
const SearchTab = new Lang.Class({
Name: 'SearchTab',
Extends: BaseTab,
_init: function() {
this.active = false;
@ -136,11 +128,7 @@ SearchTab.prototype = {
this._iconClickedId = 0;
this._searchResults = new SearchDisplay.SearchResults(this._searchSystem, this._openSearchSystem);
BaseTab.prototype._init.call(this,
this._entry,
this._searchResults.actor,
_("Search"),
'edit-find');
this.parent(this._entry, this._searchResults.actor, _("Search"), 'edit-find');
this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
this._text.connect('key-press-event', Lang.bind(this, function (o, e) {
@ -166,7 +154,7 @@ SearchTab.prototype = {
},
hide: function() {
BaseTab.prototype.hide.call(this);
this.parent();
// Leave the entry focused when it doesn't have any text;
// when replacing a selected search term, Clutter emits
@ -310,7 +298,7 @@ SearchTab.prototype = {
return false;
}
};
});
function ViewSelector() {