diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-08-31 23:53:51 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-08-31 23:53:51 +0100 |
commit | 67892ba18f738224e8c5a6e4336b4fe9011c40dd (patch) | |
tree | 7f521ad8fd28d7dce2687adec8f030f81aeff547 /desktop/searchweb.c | |
parent | d43df4b133335c62c6bc4d7c6d6a041ca1d7f62f (diff) | |
download | netsurf-67892ba18f738224e8c5a6e4336b4fe9011c40dd.tar.gz netsurf-67892ba18f738224e8c5a6e4336b4fe9011c40dd.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) { |