diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-08-31 23:53:51 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-09-21 10:53:41 +0100 |
commit | 2e8861dc05325c88cfb8130e7eddd0967e4d4b09 (patch) | |
tree | e2b97ebfd3f79f3045b0232e13d682bda5bc3b33 /desktop/searchweb.c | |
parent | e84990bc891c7a75930fddd614516d3eb170cd75 (diff) | |
download | netsurf-2e8861dc05325c88cfb8130e7eddd0967e4d4b09.tar.gz netsurf-2e8861dc05325c88cfb8130e7eddd0967e4d4b09.tar.bz2 |
make web search icon setting work properly
Diffstat (limited to 'desktop/searchweb.c')
-rw-r--r-- | desktop/searchweb.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/desktop/searchweb.c b/desktop/searchweb.c index 91a8118ca..2c0873de5 100644 --- a/desktop/searchweb.c +++ b/desktop/searchweb.c @@ -366,6 +366,33 @@ search_web_omni(const char *term, } /* exported interface documented in desktop/searchweb.h */ +nserror search_web_get_provider_bitmap(struct bitmap **bitmap_out) +{ + struct search_provider *provider; + struct bitmap *ico_bitmap = NULL; + + /* must be initialised */ + if (search_web_ctx.providers == NULL) { + return NSERROR_INIT_FAILED; + } + + provider = &search_web_ctx.providers[search_web_ctx.current]; + + /* set the icon now (if we can) at least to the default */ + if (provider->ico_handle != NULL) { + ico_bitmap = content_get_bitmap(provider->ico_handle); + } + if ((ico_bitmap == NULL) && + (search_web_ctx.default_ico_handle != NULL)) { + ico_bitmap = content_get_bitmap(search_web_ctx.default_ico_handle); + } + + *bitmap_out = ico_bitmap; + return NSERROR_OK; +} + + +/* exported interface documented in desktop/searchweb.h */ nserror search_web_select_provider(int selection) { struct search_provider *provider; @@ -520,10 +547,14 @@ nserror search_web_init(const char *provider_fname) } /* get default search icon */ - ret = hlcache_handle_retrieve(icon_nsurl, 0, NULL, NULL, + ret = hlcache_handle_retrieve(icon_nsurl, + 0, + NULL, + NULL, default_ico_callback, &search_web_ctx, - NULL, CONTENT_IMAGE, + NULL, + CONTENT_IMAGE, &search_web_ctx.default_ico_handle); nsurl_unref(icon_nsurl); if (ret != NSERROR_OK) { |