[gnome-shell] overview: Add API to remove search providers
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] overview: Add API to remove search providers
- Date: Sun, 4 Sep 2011 11:29:04 +0000 (UTC)
commit 595be5083c2b87e38434dbcd11222f4dd4ae231c
Author: Philippe Normand <philn igalia com>
Date: Sun Aug 28 13:20:37 2011 +0200
overview: Add API to remove search providers
As extensions are now expected to provide a "disable" function,
they need to remove search providers they added. Implement the
removal functionality and add a public removeSearchProvider()
method.
https://bugzilla.gnome.org/show_bug.cgi?id=657548
js/ui/overview.js | 4 ++++
js/ui/search.js | 8 ++++++++
js/ui/searchDisplay.js | 14 +++++++++++++-
js/ui/viewSelector.js | 9 +++++++++
4 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 6b36771..1f6d366 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -237,6 +237,10 @@ Overview.prototype = {
this._viewSelector.addSearchProvider(provider);
},
+ removeSearchProvider: function(provider) {
+ this._viewSelector.removeSearchProvider(provider);
+ },
+
setMessage: function(text, undoCallback, undoLabel) {
if (this.isDummy)
return;
diff --git a/js/ui/search.js b/js/ui/search.js
index 5b6a2c2..055bf0f 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -356,6 +356,14 @@ SearchSystem.prototype = {
this._providers.push(provider);
},
+ unregisterProvider: function (provider) {
+ let index = this._providers.indexOf(provider);
+ if (index == -1)
+ return;
+ provider.searchSystem = null;
+ this._providers.splice(index, 1);
+ },
+
getProviders: function() {
return this._providers;
},
diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js
index 04ef64c..42c1a26 100644
--- a/js/ui/searchDisplay.js
+++ b/js/ui/searchDisplay.js
@@ -294,11 +294,23 @@ SearchResults.prototype = {
}
resultDisplayBin.set_child(resultDisplay.actor);
- this._providerMeta.push({ actor: providerBox,
+ this._providerMeta.push({ provider: provider,
+ actor: providerBox,
resultDisplay: resultDisplay });
this._content.add(providerBox);
},
+ destroyProviderMeta: function(provider) {
+ for (let i=0; i < this._providerMeta.length; i++) {
+ let meta = this._providerMeta[i];
+ if (meta.provider == provider) {
+ meta.actor.destroy();
+ this._providerMeta.splice(i, 1);
+ break;
+ }
+ }
+ },
+
_clearDisplay: function() {
this._selectedProvider = -1;
this._visibleResultsCount = 0;
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index b33139f..939fd4c 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -210,6 +210,11 @@ SearchTab.prototype = {
this._searchResults.createProviderMeta(provider);
},
+ removeSearchProvider: function(provider) {
+ this._searchSystem.unregisterProvider(provider);
+ this._searchResults.destroyProviderMeta(provider);
+ },
+
startSearch: function(event) {
global.stage.set_key_focus(this._text);
this._text.event(event, false);
@@ -563,6 +568,10 @@ ViewSelector.prototype = {
addSearchProvider: function(provider) {
this._searchTab.addSearchProvider(provider);
+ },
+
+ removeSearchProvider: function(provider) {
+ this._searchTab.removeSearchProvider(provider);
}
};
Signals.addSignalMethods(ViewSelector.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]