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 625954 - Enable extensions to extend the dash search
Enable extensions to extend the dash search
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: extensions
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-08-03 16:11 UTC by Tor-björn Claesson
Modified: 2010-08-21 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (4.35 KB, patch)
2010-08-03 16:11 UTC, Tor-björn Claesson
none Details | Review
Second go. (4.62 KB, patch)
2010-08-07 17:50 UTC, Tor-björn Claesson
committed Details | Review

Description Tor-björn Claesson 2010-08-03 16:11:20 UTC
Created attachment 167053 [details] [review]
Patch

To be able to add a search provider to the dash search, I had to create _providerMeta and add a provider box to the SearchResults object for the new provider.

This is done at _init for built in search providers. 

This patch factors out the code to do that from _init so that extensions can add search providers as:

Main.overview._dash._searchSystem.registerProvider(newProvider);
Main.overview._dash.searchResults._createProviderMeta(newProvider);
Comment 1 Owen Taylor 2010-08-04 16:37:15 UTC
(In reply to comment #0)
> Created an attachment (id=167053) [details] [review]
> Patch
> 
> To be able to add a search provider to the dash search, I had to create
> _providerMeta and add a provider box to the SearchResults object for the new
> provider.
> 
> This is done at _init for built in search providers. 
> 
> This patch factors out the code to do that from _init so that extensions can
> add search providers as:
> 
> Main.overview._dash._searchSystem.registerProvider(newProvider);
> Main.overview._dash.searchResults._createProviderMeta(newProvider);

Extensions really shouldn't be using anything with a _ in it. _ means "internal to the implementation of this object only" - so if you find yourself needing to use properties and methods with a _ in them, then either:

 - The _ should be removed
 - Alternate API should be added to access the relevant information
Comment 2 Tor-björn Claesson 2010-08-04 18:12:59 UTC
Thanks for taking time to review my report!

Would this be ok:

refactor out code from SearchResults._init,
add registerSearchProvider(newSearchProvider) to overview so that extensions can register with:
Main.overview.registerSearchProvider(newSearchProvider);

?
Comment 3 Florian Müllner 2010-08-06 07:37:12 UTC
(In reply to comment #2)
> Would this be ok:
> 
> refactor out code from SearchResults._init,
> add registerSearchProvider(newSearchProvider) to overview so that extensions
> can register with:
> Main.overview.registerSearchProvider(newSearchProvider);

The code in overview is not supposed to access private/internal methods or properties either - so registerSearchProvider() should use neither _dash._searchSystem nor _dash.searchResults._createProviderMeta().

I suggest adding the method to Dash (though I'd call it addSearchProvider(), as it will create the providerMeta as well). Extensions are still not supposed to access Main.overview._dash, so you should either rename it to Main.overview.dash or ignore it for now. If you saw the latest mockups[0], you probably noticed that the dash is going to be split up between a side bar and a tabbed view selector. It probably makes sense to make the latter public, so extensions can add additional views and search providers.


[0] http://git.gnome.org/browse/gnome-shell-design/plain/mockups/static/overview-window-picker.png
Comment 4 Tor-björn Claesson 2010-08-07 17:50:39 UTC
Created attachment 167330 [details] [review]
Second go.

New patch.
Comment 5 Tor-björn Claesson 2010-08-07 17:52:16 UTC
Added addSearchProvider to dash.

Left it as Main.overview._dash for now, will look at this again when new overview lands (looks awesome, good work!).
Comment 6 Owen Taylor 2010-08-19 22:07:48 UTC
Looks good to me. Pushed (with trailing whitespace at the ends of lines removed - if
you do 'git config diff.color auto' then git diff will highlight such whitespace.)

[ Let me know if you already have a GNOME Git account, and I can tell you to push
instead of pushing for you next time. ]
Comment 7 Tor-björn Claesson 2010-08-21 19:58:21 UTC
Thanks!