Skip to content

Commit 951af62

Browse files
authored
Updating code to follow current coding style
Updated the navigation handler function name and its description for clarity.
1 parent d54105b commit 951af62

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

include/webui.h

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -524,29 +524,17 @@ WEBUI_EXPORT void webui_set_browser_folder(const char* path);
524524
WEBUI_EXPORT bool webui_set_default_root_folder(const char* path);
525525

526526
/**
527-
* @brief Set a callback function on the given window to allow navigations.
528-
* Must return false if navigation is not allowed, true, otherwise.
529-
*
530-
* A 'NULL' navigation handler will remove the current navigation_handler.
531-
*
532-
* NB. This currently works only for GtkWebKit WebView implementations.
533-
* Because GtkWebKit allways navigates, i.e. doesnt react to
534-
* webui_bind(_webui_win, "", webui_event_handler) which is supposed to
535-
* catch navigation requests.
536-
*
537-
* Also, although bind(win, "", evt_handler) does not work for GtkWebKit,
538-
* this implementation will always fire an event on navigation, unless
539-
* mayNavigate() returns true (which is the default, when the callback is not set).
527+
* @brief Set a callback to catch the navigation event of the WebView window.
528+
* Must return `false` to prevent the navigation event, `true` otherwise.
540529
*
541530
* @example
542-
* bool mayNavigate(size_t window)
543-
* {
544-
* if (_just_called_show_with_url) { return true; }
545-
* else { return false; } // expect a navigation event to be handled
531+
* bool myNavigationEvent(size_t window) {
532+
* // Prevent WebView window navigation event
533+
* return false;
546534
* }
535+
* webui_set_navigation_handler_wv(myWindow, myNavigationEvent);
547536
*/
548-
WEBUI_EXPORT void webui_set_navigation_handler(size_t window, bool (*may_navigate_handler)(size_t window));
549-
537+
WEBUI_EXPORT void webui_set_navigation_handler_wv(size_t window, bool (*may_navigate_handler)(size_t window));
550538

551539
/**
552540
* @brief Set a callback to catch the close event of the WebView window.

0 commit comments

Comments
 (0)