[gnome-shell/wip/raresv/uiTweaks: 1/2] search.js: Propagate searchResultsView down the hierarchy



commit 87683bfa20f8083ccd04691dd8c6245278902d64
Author: raresvis <rares visalom gmail com>
Date:   Wed Jun 28 00:58:07 2017 +0300

    search.js: Propagate searchResultsView down the hierarchy

 js/ui/search.js |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index 660fdc7..46291a6 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -48,9 +48,10 @@ const MaxWidthBin = new Lang.Class({
 const SearchResult = new Lang.Class({
     Name: 'SearchResult',
 
-    _init: function(provider, metaInfo) {
+    _init: function(provider, metaInfo, searchResultsView) {
         this.provider = provider;
         this.metaInfo = metaInfo;
+        this._searchResultsView = searchResultsView;
 
         this.actor = new St.Button({ reactive: true,
                                      can_focus: true,
@@ -74,8 +75,8 @@ const ListSearchResult = new Lang.Class({
 
     ICON_SIZE: 24,
 
-    _init: function(provider, metaInfo) {
-        this.parent(provider, metaInfo);
+    _init: function(provider, metaInfo, searchResultsView) {
+        this.parent(provider, metaInfo, searchResultsView);
 
         this.actor.style_class = 'list-search-result';
         this.actor.x_fill = true;
@@ -121,8 +122,8 @@ const GridSearchResult = new Lang.Class({
     Name: 'GridSearchResult',
     Extends: SearchResult,
 
-    _init: function(provider, metaInfo) {
-        this.parent(provider, metaInfo);
+    _init: function(provider, metaInfo, searchResultsView) {
+        this.parent(provider, metaInfo, searchResultsView);
 
         this.actor.style_class = 'grid-search-result';
 
@@ -137,8 +138,9 @@ const GridSearchResult = new Lang.Class({
 const SearchResultsBase = new Lang.Class({
     Name: 'SearchResultsBase',
 
-    _init: function(provider) {
+    _init: function(provider, searchResultsView) {
         this.provider = provider;
+        this._searchResultsView = searchResultsView;
 
         this._terms = [];
 
@@ -270,8 +272,8 @@ const ListSearchResults = new Lang.Class({
     Name: 'ListSearchResults',
     Extends: SearchResultsBase,
 
-    _init: function(provider) {
-        this.parent(provider);
+    _init: function(provider, searchResultsView) {
+        this.parent(provider, searchResultsView);
 
         this._container = new St.BoxLayout({ style_class: 'search-section-content' });
         this.providerInfo = new ProviderInfo(provider);
@@ -308,7 +310,7 @@ const ListSearchResults = new Lang.Class({
     },
 
     _createResultDisplay: function(meta) {
-        return this.parent(meta) || new ListSearchResult(this.provider, meta);
+        return this.parent(meta) || new ListSearchResult(this.provider, meta, this._searchResultsView);
     },
 
     _addItem: function(display) {
@@ -328,14 +330,14 @@ const GridSearchResults = new Lang.Class({
     Name: 'GridSearchResults',
     Extends: SearchResultsBase,
 
-    _init: function(provider, parentContainer) {
-        this.parent(provider);
+    _init: function(provider, searchResultsView) {
+        this.parent(provider, searchResultsView);
         // We need to use the parent container to know how much results we can show.
         // None of the actors in this class can be used for that, since the main actor
         // goes hidden when no results are displayed, and then it lost its allocation.
         // Then on the next use of _getMaxDisplayedResults allocation is 0, en therefore
         // it doesn't show any result although we have some.
-        this._parentContainer = parentContainer;
+        this._parentContainer = searchResultsView.actor;
 
         this._grid = new IconGrid.IconGrid({ rowLimit: MAX_GRID_SEARCH_RESULTS_ROWS,
                                              xAlign: St.Align.START });
@@ -356,7 +358,7 @@ const GridSearchResults = new Lang.Class({
     },
 
     _createResultDisplay: function(meta) {
-        return this.parent(meta) || new GridSearchResult(this.provider, meta);
+        return this.parent(meta) || new GridSearchResult(this.provider, meta, this._searchResultsView);
     },
 
     _addItem: function(display) {
@@ -558,9 +560,9 @@ const SearchResults = new Lang.Class({
 
         let providerDisplay;
         if (provider.appInfo)
-            providerDisplay = new ListSearchResults(provider);
+            providerDisplay = new ListSearchResults(provider, this);
         else
-            providerDisplay = new GridSearchResults(provider, this.actor);
+            providerDisplay = new GridSearchResults(provider, this);
 
         providerDisplay.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
         providerDisplay.actor.hide();


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