After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 675328 - Port all (currently) synchronous search providers to the async API
Port all (currently) synchronous search providers to the async API
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-05-02 19:59 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-05-07 19:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
search: Allow synchronous searches to be defined with the async API (2.46 KB, patch)
2012-05-02 19:59 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
search: Remove unused MUTLIPLE_* match types (2.42 KB, patch)
2012-05-02 19:59 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
placeDisplay: Create our own PlacesManager (3.40 KB, patch)
2012-05-02 19:59 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
search: Port all search providers over to the async API (9.10 KB, patch)
2012-05-02 19:59 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
search: Remove the ability to add synchronous search providers (17.05 KB, patch)
2012-05-02 19:59 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
placeDisplay: Create our own PlacesManager (3.16 KB, patch)
2012-05-03 18:15 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
search: Port all search providers over to the async API (9.34 KB, patch)
2012-05-03 18:15 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
search: Remove the ability to add synchronous search providers (17.05 KB, patch)
2012-05-03 18:15 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
searchDisplay: Remove a couple of no longer used variables (1.37 KB, patch)
2012-05-07 15:56 UTC, Rui Matos
needs-work Details | Review
searchDisplay: Remove the sync search completed code path (6.06 KB, patch)
2012-05-07 15:57 UTC, Rui Matos
committed Details | Review
searchDisplay: Remove a couple of no longer used variables (1.76 KB, patch)
2012-05-07 18:52 UTC, Rui Matos
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-05-02 19:59:15 UTC
... and scrap the synchronous API. There are still some focus issues that
happen with multiple asynchronous search providers in play that I'll have
to look into, but overall this is a decent code cleanup in my opinion,
and it should hopefully let us track down other bugs with the async search
provider API and lead into the search rework.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-05-02 19:59:17 UTC
Created attachment 213325 [details] [review]
search: Allow synchronous searches to be defined with the async API

To allow this to happen, we need to make sure that we don't overwrite the
previousResults when calling the async method. Note that this is a bug of
some sort, we were already using this synchronous style when a remote
search failed.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-05-02 19:59:20 UTC
Created attachment 213326 [details] [review]
search: Remove unused MUTLIPLE_* match types
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-05-02 19:59:22 UTC
Created attachment 213327 [details] [review]
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.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-05-02 19:59:25 UTC
Created attachment 213328 [details] [review]
search: Port all search providers over to the async API
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-05-02 19:59:28 UTC
Created attachment 213329 [details] [review]
search: Remove the ability to add synchronous search providers

As shown in the previous commits, synchronous search is easily implemented
by the asynchronous search API. The only reason we still have a
synchronous search API is of historical reasons. Well, we're not a museum,
and git log can keep our fossils safe if need be....
Comment 6 Rui Matos 2012-05-03 13:26:51 UTC
Review of attachment 213326 [details] [review]:

Looks good.
Comment 7 Rui Matos 2012-05-03 13:35:24 UTC
Review of attachment 213327 [details] [review]:

::: js/ui/placeDisplay.js
@@ +383,3 @@
                            });
         }
+        callback(metas);

Seems to belong to attachment 213328 [details] [review].

And then there are some more patch splitting mistakes below.
Comment 8 Rui Matos 2012-05-03 13:36:38 UTC
Review of attachment 213328 [details] [review]:

Needs work as noted on the previous patch.
Comment 9 Rui Matos 2012-05-03 13:49:33 UTC
Review of attachment 213325 [details] [review]:

Looks fine.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-05-03 18:15:03 UTC
Created attachment 213399 [details] [review]
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.
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-05-03 18:15:06 UTC
Created attachment 213400 [details] [review]
search: Port all search providers over to the async API
Comment 12 Jasper St. Pierre (not reading bugmail) 2012-05-03 18:15:09 UTC
Created attachment 213401 [details] [review]
search: Remove the ability to add synchronous search providers

As shown in the previous commits, synchronous search is easily implemented
by the asynchronous search API. The only reason we still have a
synchronous search API is of historical reasons. Well, we're not a museum,
and git log can keep our fossils safe if need be....
Comment 13 Rui Matos 2012-05-07 13:44:39 UTC
Review of attachment 213399 [details] [review]:

::: js/ui/placeDisplay.js
@@ +393,3 @@
     _compareResultMeta: function (idA, idB) {
+        let infoA = this.placesManager.lookupPlaceById(idA);
+        let infoB = this.placesManager.lookupPlaceById(idB);

The .sort() calls that use this method have to use Lang.bind(this, ...) now.

@@ +424,2 @@
     getSubsearchResultSet: function(previousResults, terms) {
+        let places = previousResults.map(function (id) { return this.placesManager.lookupPlaceById(id); });

This also needs Lang.bind().
Comment 14 Rui Matos 2012-05-07 13:50:23 UTC
Review of attachment 213400 [details] [review]:

Looks good
Comment 15 Rui Matos 2012-05-07 15:53:01 UTC
Review of attachment 213401 [details] [review]:

Ok
Comment 16 Rui Matos 2012-05-07 15:53:22 UTC
Review of attachment 213400 [details] [review]:

Looks good
Comment 17 Rui Matos 2012-05-07 15:56:12 UTC
Created attachment 213603 [details] [review]
searchDisplay: Remove a couple of no longer used variables
Comment 18 Rui Matos 2012-05-07 15:57:43 UTC
Created attachment 213604 [details] [review]
searchDisplay: Remove the sync search completed code path

Now that all searches are async we can remove the code path for the
SearchSystem::search-completed signal which is no longer useful.

This patch ends up fixing the status text not being updated for when
there are no results.

--

This just followed from reviewing. Neat stuff indeed.
Comment 19 Jasper St. Pierre (not reading bugmail) 2012-05-07 18:32:15 UTC
Review of attachment 213603 [details] [review]:

::: js/ui/searchDisplay.js
@@ -212,3 @@
         for (let i = 0; i < this._providers.length; i++) {
             this.createProviderMeta(this._providers[i]);
-            this._providerMetaResults[this.providers[i].title] = [];

You forgot to remove the set to here in _updateProviderResults.
Comment 20 Jasper St. Pierre (not reading bugmail) 2012-05-07 18:34:18 UTC
Review of attachment 213604 [details] [review]:

Yeah, this makes sense.
Comment 21 Rui Matos 2012-05-07 18:52:00 UTC
Created attachment 213617 [details] [review]
searchDisplay: Remove a couple of no longer used variables

--
(In reply to comment #19)
> -            this._providerMetaResults[this.providers[i].title] =
[];
>
> You forgot to remove the set to here in _updateProviderResults.

Yeah, that's a patch splitting issue. Should be fixed here. The other
patch remains the same except without the removal of the line that
moved into this one.
Comment 22 Jasper St. Pierre (not reading bugmail) 2012-05-07 19:03:51 UTC
Review of attachment 213617 [details] [review]:

Go for it.
Comment 23 Jasper St. Pierre (not reading bugmail) 2012-05-07 19:05:55 UTC
Attachment 213325 [details] pushed as 0bf6c93 - search: Allow synchronous searches to be defined with the async API
Attachment 213326 [details] pushed as 7ba8c7c - search: Remove unused MUTLIPLE_* match types
Attachment 213399 [details] pushed as f2d883d - placeDisplay: Create our own PlacesManager
Attachment 213400 [details] pushed as 58f77a1 - search: Port all search providers over to the async API
Attachment 213401 [details] pushed as 333e380 - search: Remove the ability to add synchronous search providers


Pushed with fixes.
Comment 24 Rui Matos 2012-05-07 19:47:32 UTC
Attachment 213604 [details] pushed as 4ce2f80 - searchDisplay: Remove the sync search completed code path
Attachment 213617 [details] pushed as 0862d1c - searchDisplay: Remove a couple of no longer used variables