From 5cd61f2ef4449b43ffd9348fa9c72cbbf0abb5a7 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 26 Aug 2014 18:16:03 +0100 Subject: Avoid include of browser_private.h --- riscos/search.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'riscos/search.c') diff --git a/riscos/search.c b/riscos/search.c index 23c148028..bf070a965 100644 --- a/riscos/search.c +++ b/riscos/search.c @@ -32,7 +32,7 @@ #include "content/hlcache.h" #include "desktop/browser.h" #include "desktop/gui.h" -#include "desktop/browser_private.h" +#include "desktop/browser.h" #include "desktop/search.h" #include "utils/log.h" #include "utils/messages.h" @@ -259,22 +259,33 @@ bool ro_gui_search_prepare_menu(void) return true; } -/** - * Open the search dialog - * - * \param bw the browser window to search - */ -void ro_gui_search_prepare(struct browser_window *bw) +bool ro_gui_search_bw_searchable(struct browser_window *bw) { hlcache_handle *h; assert(bw != NULL); - h = bw->current_content; + h = browser_window_get_content(bw); /* only handle html/textplain contents */ + /* TODO: Should have content_is_searchable() api */ if ((!h) || (content_get_type(h) != CONTENT_HTML && content_get_type(h) != CONTENT_TEXTPLAIN)) + return false; + + return true; +} + + +/** + * Open the search dialog + * + * \param bw the browser window to search + */ +void ro_gui_search_prepare(struct browser_window *bw) +{ + /* only handle searchable contents */ + if (!ro_gui_search_bw_searchable(bw)) return; /* if the search dialogue is reopened over a new window, we may -- cgit v1.2.3