Add iterator for search providers

This commit is contained in:
Daniel Silverstone 2014-06-03 15:40:28 +01:00
parent e2633a9a63
commit d35b27d44e
2 changed files with 39 additions and 0 deletions

View File

@ -464,6 +464,21 @@ default_ico_callback(hlcache_handle *ico,
return NSERROR_OK;
}
/* exported interface documented in desktop/searchweb.h */
ssize_t search_web_iterate_providers(ssize_t from, const char **name)
{
if (from < 0)
return -1;
if ((size_t)from >= search_web_ctx.providers_count)
return -1;
*name = search_web_ctx.providers[from].name;
return from + 1;
}
/* exported interface documented in desktop/searchweb.h */
nserror search_web_init(const char *provider_fname)
{

View File

@ -78,6 +78,30 @@ nserror search_web_omni(const char *term, enum search_web_omni_flags flags, stru
*/
nserror search_web_select_provider(int selection);
/**
* Iterate the search providers, returning their names.
*
* \param from Index to start iteration from. Use 0 to begin iteration.
* Use the value returned from search_web_iterate_providers to
* continue an iteration.
* \param name Pointer to fill in with the search provider name requested.
* \return -1 if there are no more, otherwise the iterator for the next item.
*
* \verb
* ssize_t iter;
* const char *name;
* ...
* for (iter = search_web_iterate_providers(0, &name);
* iter != -1;
* iter = search_web_iterate_providers(iter, &name)) {
* do_something_with(name);
* }
* \endverb
*/
ssize_t search_web_iterate_providers(ssize_t from, const char **name);
/**
* Initialise the web search operations.
*