BlinkGTK Navigation API Reference

Version: 1.2.0-build2
Last updated: 2026-07-29
Language: 日本語 | English


Overview

The Navigation API provides functions for browser history navigation and page control.

Features:

Available since: v1.1.0 or later


API List

Feature Function Return value Default behavior
Back blink_web_view_go_back() None Go back one entry in history
Forward blink_web_view_go_forward() None Go forward one entry in history
Reload blink_web_view_reload() None Reload the current page
Stop blink_web_view_stop() None Stop the page load
Check if can go back blink_web_view_can_go_back() gboolean Check whether history exists
Check if can go forward blink_web_view_can_go_forward() gboolean Check whether forward history exists

History Navigation

Goes back one entry in history.

Signature:

void blink_web_view_go_back(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | GtkWidget* | BlinkWebView widget |

Return value: None

Behavior:

Example:

// Back button callback
static void on_back_button_clicked(GtkButton* button, gpointer user_data) {
    GtkWidget* web_view = GTK_WIDGET(user_data);
    blink_web_view_go_back(web_view);
}

// Connect to the button
GtkWidget* back_button = gtk_button_new_from_icon_name("go-previous");
g_signal_connect(back_button, "clicked",
                 G_CALLBACK(on_back_button_clicked), web_view);

WebKitGTK equivalent:

// WebKitGTK
webkit_web_view_go_back(WEBKIT_WEB_VIEW(web_view));

// BlinkGTK (equivalent)
blink_web_view_go_back(web_view);

Available since: v1.1.0 or later


Goes forward one entry in history.

Signature:

void blink_web_view_go_forward(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | GtkWidget* | BlinkWebView widget |

Return value: None

Behavior:

Example:

// Forward button callback
static void on_forward_button_clicked(GtkButton* button, gpointer user_data) {
    GtkWidget* web_view = GTK_WIDGET(user_data);
    blink_web_view_go_forward(web_view);
}

// Connect to the button
GtkWidget* forward_button = gtk_button_new_from_icon_name("go-next");
g_signal_connect(forward_button, "clicked",
                 G_CALLBACK(on_forward_button_clicked), web_view);

WebKitGTK equivalent:

// WebKitGTK
webkit_web_view_go_forward(WEBKIT_WEB_VIEW(web_view));

// BlinkGTK (equivalent)
blink_web_view_go_forward(web_view);

Available since: v1.1.0 or later


Page Control

Reloads the current page.

Signature:

void blink_web_view_reload(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | GtkWidget* | BlinkWebView widget |

Return value: None

Behavior:

Example:

// Reload button callback
static void on_reload_button_clicked(GtkButton* button, gpointer user_data) {
    GtkWidget* web_view = GTK_WIDGET(user_data);
    blink_web_view_reload(web_view);
}

// Connect to the button
GtkWidget* reload_button = gtk_button_new_from_icon_name("view-refresh");
g_signal_connect(reload_button, "clicked",
                 G_CALLBACK(on_reload_button_clicked), web_view);

Practical example - reload after a settings change:

// Reload the page after a settings change to apply it
static void on_js_toggle(GtkToggleButton* button, gpointer user_data) {
    GtkWidget* web_view = GTK_WIDGET(user_data);
    gboolean active = gtk_toggle_button_get_active(button);

    blink_web_view_set_javascript_enabled(web_view, active);
    blink_web_view_reload(web_view);  // Apply the setting
}

WebKitGTK equivalent:

// WebKitGTK
webkit_web_view_reload(WEBKIT_WEB_VIEW(web_view));

// BlinkGTK (equivalent)
blink_web_view_reload(web_view);

Available since: v1.1.0 or later


Stops the page load.

Signature:

void blink_web_view_stop(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | GtkWidget* | BlinkWebView widget |

Return value: None

Behavior:

Example:

// Stop button callback
static void on_stop_button_clicked(GtkButton* button, gpointer user_data) {
    GtkWidget* web_view = GTK_WIDGET(user_data);
    blink_web_view_stop(web_view);
}

// Connect to the button
GtkWidget* stop_button = gtk_button_new_from_icon_name("process-stop");
g_signal_connect(stop_button, "clicked",
                 G_CALLBACK(on_stop_button_clicked), web_view);

Practical example - timeout handling:

// Time out after 10 seconds
static gboolean on_load_timeout(gpointer user_data) {
    GtkWidget* web_view = GTK_WIDGET(user_data);
    blink_web_view_stop(web_view);
    g_print("Loading timed out\n");
    return G_SOURCE_REMOVE;
}

// Start on the load-changed signal
static void on_load_changed(GtkWidget* web_view,
                            BlinkLoadEvent event,
                            gpointer user_data) {
    if (event == BLINK_LOAD_STARTED) {
        g_timeout_add_seconds(10, on_load_timeout, web_view);
    }
}

WebKitGTK equivalent:

// WebKitGTK
webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(web_view));

// BlinkGTK (equivalent)
blink_web_view_stop(web_view);

Note: This corresponds to WebKitGTK's webkit_web_view_stop_loading(), but the function name is shortened to stop().

Available since: v1.1.0 or later


History State Inspection

Checks whether it is possible to go back in history.

Signature:

gboolean blink_web_view_can_go_back(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | GtkWidget* | BlinkWebView widget |

Return value: gboolean - TRUE = can go back, FALSE = cannot go back

Example:

// Enable/disable the back button
static void update_back_button_sensitivity(GtkWidget* web_view,
                                           GtkWidget* back_button) {
    gboolean can_back = blink_web_view_can_go_back(web_view);
    gtk_widget_set_sensitive(back_button, can_back);
}

// Update on the load-changed signal
static void on_load_changed(GtkWidget* web_view,
                            BlinkLoadEvent event,
                            gpointer user_data) {
    if (event == BLINK_LOAD_FINISHED) {
        GtkWidget* back_button = GTK_WIDGET(user_data);
        update_back_button_sensitivity(web_view, back_button);
    }
}

Practical example - managing navigation buttons:

typedef struct {
    GtkWidget* back_button;
    GtkWidget* forward_button;
} NavButtons;

static void update_navigation_buttons(GtkWidget* web_view,
                                      NavButtons* buttons) {
    gtk_widget_set_sensitive(buttons->back_button,
                            blink_web_view_can_go_back(web_view));
    gtk_widget_set_sensitive(buttons->forward_button,
                            blink_web_view_can_go_forward(web_view));
}

WebKitGTK equivalent:

// WebKitGTK
gboolean can_back = webkit_web_view_can_go_back(WEBKIT_WEB_VIEW(web_view));

// BlinkGTK (equivalent)
gboolean can_back = blink_web_view_can_go_back(web_view);

Available since: v1.1.0 or later


Checks whether forward history exists.

Signature:

gboolean blink_web_view_can_go_forward(BlinkWebView* web_view);

Parameters:
| Parameter | Type | Description |
|-----------|---|------|
| web_view | GtkWidget* | BlinkWebView widget |

Return value: gboolean - TRUE = can go forward, FALSE = cannot go forward

Example:

// Enable/disable the forward button
static void update_forward_button_sensitivity(GtkWidget* web_view,
                                              GtkWidget* forward_button) {
    gboolean can_forward = blink_web_view_can_go_forward(web_view);
    gtk_widget_set_sensitive(forward_button, can_forward);
}

WebKitGTK equivalent:

// WebKitGTK
gboolean can_forward = webkit_web_view_can_go_forward(WEBKIT_WEB_VIEW(web_view));

// BlinkGTK (equivalent)
gboolean can_forward = blink_web_view_can_go_forward(web_view);

Available since: v1.1.0 or later


Practical Combined Example

A Complete Navigation Toolbar

typedef struct {
    GtkWidget* web_view;
    GtkWidget* back_button;
    GtkWidget* forward_button;
    GtkWidget* reload_button;
    GtkWidget* stop_button;
} BrowserWidgets;

// Update the state of the navigation buttons
static void update_nav_buttons(BrowserWidgets* widgets) {
    gtk_widget_set_sensitive(widgets->back_button,
                            blink_web_view_can_go_back(widgets->web_view));
    gtk_widget_set_sensitive(widgets->forward_button,
                            blink_web_view_can_go_forward(widgets->web_view));
}

// load-changed callback
static void on_load_changed(GtkWidget* web_view,
                            BlinkLoadEvent event,
                            gpointer user_data) {
    BrowserWidgets* widgets = (BrowserWidgets*)user_data;

    if (event == BLINK_LOAD_STARTED) {
        gtk_widget_set_sensitive(widgets->stop_button, TRUE);
        gtk_widget_set_sensitive(widgets->reload_button, FALSE);
    } else if (event == BLINK_LOAD_FINISHED) {
        gtk_widget_set_sensitive(widgets->stop_button, FALSE);
        gtk_widget_set_sensitive(widgets->reload_button, TRUE);
        update_nav_buttons(widgets);
    }
}

// Button callbacks
static void on_back_clicked(GtkButton* button, gpointer user_data) {
    BrowserWidgets* widgets = (BrowserWidgets*)user_data;
    blink_web_view_go_back(widgets->web_view);
}

static void on_forward_clicked(GtkButton* button, gpointer user_data) {
    BrowserWidgets* widgets = (BrowserWidgets*)user_data;
    blink_web_view_go_forward(widgets->web_view);
}

static void on_reload_clicked(GtkButton* button, gpointer user_data) {
    BrowserWidgets* widgets = (BrowserWidgets*)user_data;
    blink_web_view_reload(widgets->web_view);
}

static void on_stop_clicked(GtkButton* button, gpointer user_data) {
    BrowserWidgets* widgets = (BrowserWidgets*)user_data;
    blink_web_view_stop(widgets->web_view);
}

WebKitGTK Migration Guide

API Mapping

WebKitGTK BlinkGTK Compatibility
webkit_web_view_go_back() blink_web_view_go_back() Fully compatible
webkit_web_view_go_forward() blink_web_view_go_forward() Fully compatible
webkit_web_view_reload() blink_web_view_reload() Fully compatible
webkit_web_view_stop_loading() blink_web_view_stop() Compatible (function renamed)
webkit_web_view_can_go_back() blink_web_view_can_go_back() Fully compatible
webkit_web_view_can_go_forward() blink_web_view_can_go_forward() Fully compatible

Migration Example

Before (WebKitGTK):

webkit_web_view_go_back(WEBKIT_WEB_VIEW(web_view));
webkit_web_view_go_forward(WEBKIT_WEB_VIEW(web_view));
webkit_web_view_reload(WEBKIT_WEB_VIEW(web_view));
webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(web_view));

After (BlinkGTK):

blink_web_view_go_back(web_view);
blink_web_view_go_forward(web_view);
blink_web_view_reload(web_view);
blink_web_view_stop(web_view);  // Function renamed


Version History

Version Release date Changes
v0.9.28-dev 2026-01-01 Build 174: Navigation API documentation completed
v0.9.0-dev 2025-10-24 Build 106: Navigation API implemented

License: BSD-3-Clause
Project: BlinkGTK
Maintainer: BlinkGTK Project daisy19@gmail.com