Skip to content

Commit

Permalink
[102] Feature/Bug 580252 - Introduce pref gloda.list.immediate to ope…
Browse files Browse the repository at this point in the history
…n Gloda result list immediately, take 4: More hackery to display the list when ready (Issue #169)
  • Loading branch information
Betterbird committed Jul 7, 2023
1 parent 3efd2f8 commit 2951a40
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# HG changeset patch
# User Betterbird <[email protected]>
# Date 1688025052 -7200
# Parent 2d4670803d7d53cd565135a29a94734a3d10da12
# Date 1688715193 -7200
# Parent d9dd94ec690913d8b52234a3147b4321c162f2bb
Bug 580252 - Introduce pref gloda.list.immediate to open Gloda result list immediately.

diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderbird.js
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -631,16 +631,20 @@ pref("media.autoplay.enabled", false);
@@ -606,16 +606,20 @@ pref("media.autoplay.enabled", false);
pref("gloda.facetview.hidetimeline", true);

// Behavior of sort-by setting in search results:
Expand Down Expand Up @@ -63,3 +63,69 @@ diff --git a/mail/base/content/glodaFacetTab.js b/mail/base/content/glodaFacetTa
"src",
"chrome://messenger/content/glodaFacetViewWrapper.xhtml"
);
diff --git a/mail/base/content/glodaFacetView.js b/mail/base/content/glodaFacetView.js
--- a/mail/base/content/glodaFacetView.js
+++ b/mail/base/content/glodaFacetView.js
@@ -452,16 +452,17 @@ ActiveNonSingularConstraint.prototype =
isExcludedGroup(aGroupValue) {
let valId = aGroupValue[this.facetDef.groupIdAttr];
return valId in this.excludedGroupIds;
},
};

var FacetContext = {
facetDriver: new FacetDriver(Gloda.lookupNounDef("message"), window),
+ _readyToShow: false,

/**
* The root collection which our active set is a subset of. We hold onto this
* for garbage collection reasons, although the tab that owns us should also
* be holding on.
*/
_collection: null,
set collection(aCollection) {
@@ -698,16 +699,17 @@ var FacetContext = {
}
}

if (!this._timelineShown) {
this._hideTimeline(true);
}

this._showResults();
+ this._readyToShow = true;

if (this._callbackOnFacetComplete) {
let callback = this._callbackOnFacetComplete;
this._callbackOnFacetComplete = null;
callback();
}
},

@@ -989,17 +991,25 @@ var FacetContext = {
this.tab.searcher.andTerms = !this.tab.searcher.andTerms;
this._resetUI();
this.collection = this.tab.searcher.getCollection(this);
},

/**
* Show the active message set in a glodaList tab.
*/
- showActiveSetInTab() {
+ async showActiveSetInTab() {
+ let count = 0;
+ while (count++ < 20 && !this._readyToShow) {
+ await new Promise(r => top.window.setTimeout(r, 100));
+ }
+ if (!this._readyToShow) {
+ return;
+ }
+
let tabmail = this.rootWin.document.getElementById("tabmail");
tabmail.openTab("glodaList", {
collection: Gloda.explicitCollection(Gloda.NOUN_MESSAGE, this.activeSet),
title: this.tab.title,
});
},

/**
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HG changeset patch
# User Betterbird <[email protected]>
# Date 1688025052 -7200
# Parent 2d4670803d7d53cd565135a29a94734a3d10da12
# Date 1688715703 -7200
# Parent d3541986f0555cfad42873068f6536909e09785c
Bug 580252 - Introduce pref gloda.list.immediate to open Gloda result list immediately.

diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderbird.js
Expand Down Expand Up @@ -63,3 +63,69 @@ diff --git a/mail/base/content/glodaFacetTab.js b/mail/base/content/glodaFacetTa
"src",
"chrome://messenger/content/glodaFacetViewWrapper.xhtml"
);
diff --git a/mail/base/content/glodaFacetView.js b/mail/base/content/glodaFacetView.js
--- a/mail/base/content/glodaFacetView.js
+++ b/mail/base/content/glodaFacetView.js
@@ -457,16 +457,17 @@ ActiveNonSingularConstraint.prototype =
isExcludedGroup(aGroupValue) {
let valId = aGroupValue[this.facetDef.groupIdAttr];
return valId in this.excludedGroupIds;
},
};

var FacetContext = {
facetDriver: new FacetDriver(Gloda.lookupNounDef("message"), window),
+ _readyToShow: false,

/**
* The root collection which our active set is a subset of. We hold onto this
* for garbage collection reasons, although the tab that owns us should also
* be holding on.
*/
_collection: null,
set collection(aCollection) {
@@ -703,16 +704,17 @@ var FacetContext = {
}
}

if (!this._timelineShown) {
this._hideTimeline(true);
}

this._showResults();
+ this._readyToShow = true;

if (this._callbackOnFacetComplete) {
let callback = this._callbackOnFacetComplete;
this._callbackOnFacetComplete = null;
callback();
}
},

@@ -994,17 +996,25 @@ var FacetContext = {
this.tab.searcher.andTerms = !this.tab.searcher.andTerms;
this._resetUI();
this.collection = this.tab.searcher.getCollection(this);
},

/**
* Show the active message set in a 3-pane tab.
*/
- showActiveSetInTab() {
+ async showActiveSetInTab() {
+ let count = 0;
+ while (count++ < 20 && !this._readyToShow) {
+ await new Promise(r => top.window.setTimeout(r, 100));
+ }
+ if (!this._readyToShow) {
+ return;
+ }
+
let tabmail = this.rootWin.document.getElementById("tabmail");
tabmail.openTab("mail3PaneTab", {
folderPaneVisible: false,
syntheticView: new GlodaSyntheticView({
collection: Gloda.explicitCollection(
GlodaConstants.NOUN_MESSAGE,
this.activeSet
),

0 comments on commit 2951a40

Please sign in to comment.