[gnome-shell] placeDisplay: Create our own PlacesManager
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] placeDisplay: Create our own PlacesManager
- Date: Mon, 7 May 2012 19:05:50 +0000 (UTC)
commit f2d883dab242ee0d4a4651b94e0261aebdde64a2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed May 2 15:40:31 2012 -0400
placeDisplay: Create our own PlacesManager
Since we don't have a section showing off the available places somewhere,
we don't need a global PlacesManager.
https://bugzilla.gnome.org/show_bug.cgi?id=675328
js/ui/main.js | 2 --
js/ui/placeDisplay.js | 19 +++++++++++--------
2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 25ad8d8..f179594 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -46,7 +46,6 @@ let automountManager = null;
let autorunManager = null;
let panel = null;
let hotCorners = [];
-let placesManager = null;
let overview = null;
let runDialog = null;
let lookingGlass = null;
@@ -80,7 +79,6 @@ function _createUserSession() {
// not loading any events until the user presses the clock
global.launch_calendar_server();
- placesManager = new PlaceDisplay.PlacesManager();
telepathyClient = new TelepathyClient.Client();
automountManager = new AutomountManager.AutomountManager();
autorunManager = new AutorunManager.AutorunManager();
diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js
index c3117df..ac8e4db 100644
--- a/js/ui/placeDisplay.js
+++ b/js/ui/placeDisplay.js
@@ -365,12 +365,13 @@ const PlaceSearchProvider = new Lang.Class({
_init: function() {
this.parent(_("PLACES & DEVICES"));
+ this.placesManager = new PlacesManager();
},
getResultMetas: function(resultIds) {
let metas = [];
for (let i = 0; i < resultIds.length; i++) {
- let placeInfo = Main.placesManager.lookupPlaceById(resultIds[i]);
+ let placeInfo = this.placesManager.lookupPlaceById(resultIds[i]);
if (!placeInfo)
metas.push(null);
else
@@ -385,13 +386,13 @@ const PlaceSearchProvider = new Lang.Class({
},
activateResult: function(id, params) {
- let placeInfo = Main.placesManager.lookupPlaceById(id);
+ let placeInfo = this.placesManager.lookupPlaceById(id);
placeInfo.launch(params);
},
_compareResultMeta: function (idA, idB) {
- let infoA = Main.placesManager.lookupPlaceById(idA);
- let infoB = Main.placesManager.lookupPlaceById(idB);
+ let infoA = this.placesManager.lookupPlaceById(idA);
+ let infoB = this.placesManager.lookupPlaceById(idB);
return infoA.name.localeCompare(infoB.name);
},
@@ -409,19 +410,21 @@ const PlaceSearchProvider = new Lang.Class({
else if (mtype == Search.MatchType.SUBSTRING)
substringResults.push(place.id);
}
- prefixResults.sort(this._compareResultMeta);
- substringResults.sort(this._compareResultMeta);
+ prefixResults.sort(Lang.bind(this, this._compareResultMeta));
+ substringResults.sort(Lang.bind(this, this._compareResultMeta));
return prefixResults.concat(substringResults);
},
getInitialResultSet: function(terms) {
- let places = Main.placesManager.getAllPlaces();
+ let places = this.placesManager.getAllPlaces();
return this._searchPlaces(places, terms);
},
getSubsearchResultSet: function(previousResults, terms) {
- let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); });
+ let places = previousResults.map(Lang.bind(this, function(id) {
+ return this.placesManager.lookupPlaceById(id);
+ }));
return this._searchPlaces(places, terms);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]