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 508750 - search bar extensibility
search bar extensibility
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: general
HEAD
Other Linux
: Normal enhancement
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks: 320243
 
 
Reported: 2008-01-11 12:37 UTC by Jonathan Matthew
Modified: 2009-03-08 23:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
search rework (88.65 KB, patch)
2008-01-13 12:06 UTC, Jonathan Matthew
committed Details | Review
it works (2.16 KB, patch)
2008-01-13 12:09 UTC, Jonathan Matthew
none Details | Review

Description Jonathan Matthew 2008-01-11 12:37:19 UTC
We have a few different bugs about adding new ways to interpret the search text (bug 320243, bug 348627, probably more), which isn't really possible at the moment.

There's also lots of duplicated code to deal with search actions in the various sources.  rb-auto-playlist-source, rb-browser-source, rb-static-playlist-source all have some very similar code; the podcast and iradio sources have some variation on that too.

My (mostly implemented) plan is:
- add a new class for text->query function implementations
- attach the search implementation directly to the GtkRadioAction used to select the search, rather than having functions like search_action_to_prop everywhere
- in addition to the get_search_actions method on the source, emit a signal from some well-known object to allow plugins to add more search actions

Aside from consolidating a lot of search-related code in rb-source-header.c, this means a plugin can add a new arbitrarily complex text->query function and insert a corresponding action into the search bar, without the source having to know anything about it.
Comment 1 Jonathan Matthew 2008-01-13 12:06:05 UTC
Created attachment 102724 [details] [review]
search rework

Pretty much as described above.  To make this available to plugins, I've added two signals on the RBSourceHeader object: get_search_actions, which returns a list of additional search actions for the selected source, and refresh_search_bar, which is an action signal (emitted by other objects) that rebuilds the search bar.  Plugins need to call refresh_search_bar on activation and probably on deactivation too.
Comment 2 Jonathan Matthew 2008-01-13 12:09:55 UTC
Created attachment 102725 [details] [review]
it works

Just to show it works, this is a python plugin that adds a 'location' search action to all sources.  It doesn't create the search query itself, but that's easy enough to do.
Comment 3 Jonathan Matthew 2009-03-08 23:49:37 UTC
No point leaving this here gathering dust..