GNOME Bugzilla – Bug 625954
Enable extensions to extend the dash search
Last modified: 2010-08-21 19:58:21 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);
(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
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); ?
(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
Created attachment 167330 [details] [review] Second go. New patch.
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!).
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. ]
Thanks!