From b4b97d90032e7c52f1888b1b32132e30c0bd4094 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Oct 2014 09:22:05 +0100 Subject: Chage favicon set APIs to take gui_window rather than hlcache_handle. Let the front end pass its own types around, rather than core ones. This removes one "bw->current_content" from window.c. Now the current content is only accessed where its needed, in the favicon handler, and it is accessed via the appropriate API. --- riscos/gui/url_bar.c | 7 +++++-- riscos/gui/url_bar.h | 6 +++--- riscos/toolbar.c | 4 ++-- riscos/toolbar.h | 8 ++++---- riscos/window.c | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'riscos') diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c index d89004856..76a63aa2d 100644 --- a/riscos/gui/url_bar.c +++ b/riscos/gui/url_bar.c @@ -1164,13 +1164,16 @@ bool ro_gui_url_bar_test_for_text_field_keypress(struct url_bar *url_bar, /* This is an exported interface documented in url_bar.h */ bool ro_gui_url_bar_set_site_favicon(struct url_bar *url_bar, - struct hlcache_handle *h) + struct gui_window *g) { + struct hlcache_handle *h content_type type = CONTENT_NONE; - if (url_bar == NULL) + if (url_bar == NULL || g == NULL) return false; + h = browser_window_get_content(g->bw); + if (h != NULL) type = content_get_type(h); diff --git a/riscos/gui/url_bar.h b/riscos/gui/url_bar.h index 0f41a4b01..8e8d291ac 100644 --- a/riscos/gui/url_bar.h +++ b/riscos/gui/url_bar.h @@ -305,15 +305,15 @@ bool ro_gui_url_bar_set_site_favicon(struct url_bar *url_bar, /** * Set the favicon to a RISC OS filetype sprite based on the type of the - * supplied content. + * content within the supplied window. * * \param *url_bar The URL Bar to update the favicon on. - * \param *h The content to use. + * \param *g The window with the content to use. * \return true if successful; else false. */ bool ro_gui_url_bar_set_content_favicon(struct url_bar *url_bar, - struct hlcache_handle *h); + struct gui_window *g); /** diff --git a/riscos/toolbar.c b/riscos/toolbar.c index bd76e23de..879d97853 100644 --- a/riscos/toolbar.c +++ b/riscos/toolbar.c @@ -1665,12 +1665,12 @@ void ro_toolbar_set_site_favicon(struct toolbar *toolbar, /* This is an exported interface documented in toolbar.h */ void ro_toolbar_set_content_favicon(struct toolbar *toolbar, - struct hlcache_handle *h) + struct gui_window *g) { if (toolbar == NULL || toolbar->url == NULL) return; - ro_gui_url_bar_set_content_favicon(toolbar->url, h); + ro_gui_url_bar_set_content_favicon(toolbar->url, g); } diff --git a/riscos/toolbar.h b/riscos/toolbar.h index 336f95d15..41f1af728 100644 --- a/riscos/toolbar.h +++ b/riscos/toolbar.h @@ -428,15 +428,15 @@ void ro_toolbar_set_site_favicon(struct toolbar *toolbar, /** * Update the favicon in a browser window toolbar to reflect the RISC OS - * filetype of the supplied content. If the toolbar currently has a - * site favicon set, then this call will be ignored. + * filetype of the content within the supplied window. If the toolbar + * currently has a site favicon set, then this call will be ignored. * * \param *toolbar The toolbar to refresh. - * \param *h The page content to reflect. + * \param *g The gui window to set content favicon for. */ void ro_toolbar_set_content_favicon(struct toolbar *toolbar, - struct hlcache_handle *h); + struct gui_window *g); /** diff --git a/riscos/window.c b/riscos/window.c index af3365a95..071b7acca 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -1149,7 +1149,7 @@ static void gui_window_new_content(struct gui_window *g) ro_gui_menu_refresh(ro_gui_browser_window_menu); ro_gui_window_update_toolbar_buttons(g); ro_gui_dialog_close_persistent(g->window); - ro_toolbar_set_content_favicon(g->toolbar, g->bw->current_content); + ro_toolbar_set_content_favicon(g->toolbar, g); } -- cgit v1.2.3