Add call to test whether a browser window may be searched.

This commit is contained in:
Michael Drake 2014-10-18 17:39:03 +01:00
parent 10154d0e18
commit 03e7605bcf
2 changed files with 24 additions and 0 deletions

View File

@ -443,6 +443,22 @@ char * browser_window_get_selection(struct browser_window *bw)
return content_get_selection(bw->selection.bw->current_content);
}
/* exported interface, documented in browser.h */
bool browser_window_can_search(struct browser_window *bw)
{
if (bw == NULL || bw->current_content == NULL)
return false;
/* TODO: We shouldn't have to know about specific content types
* here. There should be a content_is_searchable() call. */
if (content_get_type(bw->current_content) != CONTENT_HTML &&
content_get_type(bw->current_content) !=
CONTENT_TEXTPLAIN)
return false;
return true;
}
/**
* Set or remove a selection.
*

View File

@ -462,6 +462,14 @@ browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw);
*/
char * browser_window_get_selection(struct browser_window *bw);
/**
* Find out if given browser window can be searched
*
* \param bw browser window to look at
* \return true iff browser window is searchable
*/
bool browser_window_can_search(struct browser_window *bw);
/**
* Dump debug info concerning the browser window's contents to file