NetSurf
Data Structures | Enumerations | Functions
searchweb.h File Reference

core web search facilities interface. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gui_search_web_table
 Graphical user interface browser web search function table. More...
 

Enumerations

enum  search_web_omni_flags { SEARCH_WEB_OMNI_NONE = 0 , SEARCH_WEB_OMNI_SEARCHONLY = 1 }
 Flags which alter the behaviour of the omin search. More...
 

Functions

nserror search_web_omni (const char *term, enum search_web_omni_flags flags, struct nsurl **url_out)
 Generate a nsurl from a search term. More...
 
nserror search_web_get_provider_bitmap (struct bitmap **bitmap_out)
 obtain the current providers bitmap More...
 
nserror search_web_select_provider (int selection)
 Change the currently selected web search provider. More...
 
ssize_t search_web_iterate_providers (ssize_t from, const char **name)
 Iterate the search providers, returning their names. More...
 
nserror search_web_init (const char *provider_fname)
 Initialise the web search operations. More...
 
nserror search_web_finalise (void)
 Finalise the web search operations freeing all resources. More...
 

Detailed Description

core web search facilities interface.

Definition in file searchweb.h.

Enumeration Type Documentation

◆ search_web_omni_flags

Flags which alter the behaviour of the omin search.

Enumerator
SEARCH_WEB_OMNI_NONE 

no changes to default operation

SEARCH_WEB_OMNI_SEARCHONLY 

The search does not attempt to interpret the url as a url before using it as a search term.

Definition at line 48 of file searchweb.h.

Function Documentation

◆ search_web_finalise()

nserror search_web_finalise ( void  )

Finalise the web search operations freeing all resources.

Returns
NSERROR_OK on success or appropriate error code.

Definition at line 574 of file searchweb.c.

References search_web_ctx_s::default_ico_handle, hlcache_handle_release(), search_provider::ico_handle, search_provider::name, NSERROR_INIT_FAILED, NSERROR_OK, search_web_ctx_s::providers, search_web_ctx_s::providers_count, and search_web_ctx.

Referenced by netsurf_exit(), and nsbeos_scaffolding_dispatch_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_web_get_provider_bitmap()

nserror search_web_get_provider_bitmap ( struct bitmap **  bitmap_out)

obtain the current providers bitmap

obtain the icon representing the current web search provider

Parameters
bitmap_outrecives the resulting bitmap which may be NULL
Returns
NSERROR_OK on success or NSERROR_INIT_FAILED if not initialised

Definition at line 370 of file searchweb.c.

References content_get_bitmap(), search_web_ctx_s::current, search_web_ctx_s::default_ico_handle, search_provider::ico_handle, NSERROR_INIT_FAILED, NSERROR_OK, search_web_ctx_s::providers, and search_web_ctx.

Referenced by make_toolbar_item_websearch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_web_init()

nserror search_web_init ( const char *  provider_fname)

Initialise the web search operations.

Parameters
provider_fnamePath to web search providers file.
Returns
NSERROR_OK on successful initialisation or appropriate error code.

Definition at line 517 of file searchweb.c.

References CONTENT_IMAGE, default_ico_callback(), search_web_ctx_s::default_ico_handle, default_providers, default_search_icon_url, hlcache_handle_retrieve(), NSERROR_NOMEM, NSERROR_OK, nsurl_create(), nsurl_unref(), parse_providers(), search_web_ctx_s::providers, search_web_ctx_s::providers_count, read_providers(), and search_web_ctx.

Referenced by main(), nsbeos_scaffolding_dispatch_event(), and nsgtk_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_web_iterate_providers()

ssize_t search_web_iterate_providers ( ssize_t  from,
const char **  name 
)

Iterate the search providers, returning their names.

Parameters
fromIndex to start iteration from. Use 0 to begin iteration. Use the value returned from search_web_iterate_providers to continue an iteration.
namePointer to fill in with the search provider name requested.
Returns
-1 if there are no more, otherwise the iterator for the next item.
*     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);
*     }
* 

Definition at line 502 of file searchweb.c.

References from, search_provider::name, search_web_ctx_s::providers, search_web_ctx_s::providers_count, and search_web_ctx.

Referenced by ami_gui_opts_websearch(), and nsgtk_preferences_comboSearch_realize().

Here is the caller graph for this function:

◆ search_web_omni()

nserror search_web_omni ( const char *  term,
enum search_web_omni_flags  flags,
struct nsurl **  url_out 
)

Generate a nsurl from a search term.

This interface obtains a url appropriate for the given search term. The flags allow control over the operation. By default the operations are:

  • interpret the term as a url
  • if missing a scheme as a https: url
  • combined with the search providers url into a url for that provider.
Parameters
termThe search term.
flagsFlags to control operation.
url_outThe ourput url on success.
Returns
NSERROR_OK on success or appropriate error code.

Definition at line 318 of file searchweb.c.

References search_web_ctx_s::current, make_search_nsurl(), NSERROR_BAD_URL, NSERROR_INIT_FAILED, NSERROR_NOMEM, NSERROR_OK, nsoption_bool, nsurl_create(), search_web_ctx_s::providers, search_web_ctx, SEARCH_WEB_OMNI_SEARCHONLY, and SLEN.

Referenced by ami_gui_event(), nsbeos_scaffolding_dispatch_event(), nsgtk_completion_match_select(), ro_gui_dialog_openurl_apply(), ro_gui_window_launch_url(), url_entry_activate_cb(), and websearch_entry_activate_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_web_select_provider()

nserror search_web_select_provider ( int  selection)

Change the currently selected web search provider.

Parameters
selectionIndex of the search provider to select or -1 to reselect the current provider
Returns
NSERROR_OK on success or appropriate error code.

Definition at line 397 of file searchweb.c.

References content_get_bitmap(), CONTENT_IMAGE, search_web_ctx_s::current, search_web_ctx_s::default_ico_handle, guit, hlcache_handle_retrieve(), search_provider::ico, search_provider::ico_handle, search_provider::name, NSERROR_INIT_FAILED, NSERROR_OK, nsurl_create(), nsurl_unref(), gui_search_web_table::provider_update, search_web_ctx_s::providers, search_web_ctx_s::providers_count, netsurf_table::search_web, search_web_ctx, and search_web_ico_callback().

Referenced by ami_gui_event(), ami_gui_opts_use(), ami_gui_search_ico_refresh(), gui_init2(), nsgtk_preferences_comboSearch_changed(), and nsgtk_setup().

Here is the call graph for this function:
Here is the caller graph for this function: