[gnome-shell] [search] Fix activation of results from custom renderers



commit fbb88da134a6f77ade590cd18578dd0b451bd47d
Author: Colin Walters <walters verbum org>
Date:   Thu Mar 4 15:08:24 2010 -0500

    [search] Fix activation of results from custom renderers
    
    The previous commit broke activation when selecting an actor
    from a custom renderer.  Fix this by explicitly defining a method
    activateSelected on the search renderer.

 js/ui/appDisplay.js |    8 ++++++++
 js/ui/dash.js       |   11 ++++++++---
 js/ui/search.js     |    7 +++++++
 3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 1f6e442..fdb2387 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -251,6 +251,14 @@ AppSearchResultDisplay.prototype = {
         targetActor._delegate.setSelected(true);
         this.selectionIndex = index;
         return true;
+    },
+
+    activateSelected: function() {
+        if (this.selectionIndex < 0)
+            return;
+        let children = this._container.get_children();
+        let targetActor = children[this.selectionIndex];
+        this.provider.activateResult(targetActor._delegate.app.get_id())
     }
 }
 
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 81f63fd..4082bce 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -432,6 +432,12 @@ OverflowSearchResults.prototype = {
         targetActor._delegate.setSelected(true);
         this.selectionIndex = index;
         return true;
+    },
+
+    activateSelected: function() {
+        let children = this.actor.get_children();
+        let targetActor = children[this.selectionIndex];
+        targetActor._delegate.activate();
     }
 }
 
@@ -597,9 +603,8 @@ SearchResults.prototype = {
             return;
         let meta = this._providerMeta[current];
         let resultDisplay = meta.resultDisplay;
-        let children = resultDisplay.actor.get_children();
-        let targetActor = children[resultDisplay.getSelectionIndex()];
-        targetActor._delegate.activate();
+        resultDisplay.activateSelected();
+        Main.overview.hide();
     }
 }
 
diff --git a/js/ui/search.js b/js/ui/search.js
index 2b73852..c25e02d 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -80,6 +80,13 @@ SearchResultDisplay.prototype = {
      */
     selectIndex: function() {
         throw new Error("not implemented");
+    },
+
+    /**
+     * Activate the currently selected search result.
+     */
+    activateSelected: function() {
+        throw new Error("not implemented");
     }
 };
 



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