static void context_menu_cb(WebKitWebView *view, GtkMenu *menu, gpointer data);
#endif
static void context_menu_activate_cb(GtkMenuItem *item, gpointer data);
+static void uri_change_cb(WebKitWebView *view, GParamSpec param_spec);
static void webview_progress_cb(WebKitWebView *view, GParamSpec *pspec);
static void webview_download_progress_cb(WebKitWebView *view, GParamSpec *pspec);
static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec);
#endif
}
+static void uri_change_cb(WebKitWebView *view, GParamSpec param_spec)
+{
+ g_free(vb.state.uri);
+ g_object_get(view, "uri", &vb.state.uri, NULL);
+ vb_update_urlbar(vb.state.uri);
+
+ g_setenv("VIMB_URI", vb.state.uri, true);
+}
+
static void webview_progress_cb(WebKitWebView *view, GParamSpec *pspec)
{
vb.state.progress = webkit_web_view_get_progress(view) * 100;
static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec)
{
+ const char *uri;
+
switch (webkit_web_view_get_load_status(view)) {
case WEBKIT_LOAD_PROVISIONAL:
/* update load progress in statusbar */
break;
case WEBKIT_LOAD_COMMITTED:
+ uri = webkit_web_view_get_uri(view);
{
- /* save the current uri */
- g_free(vb.state.uri);
- g_object_get(view, "uri", &vb.state.uri, NULL);
- /* export the uri */
- g_setenv("VIMB_URI", vb.state.uri, true);
-
WebKitWebFrame *frame = webkit_web_view_get_main_frame(view);
/* set the status */
- if (g_str_has_prefix(vb.state.uri, "https://")) {
+ if (g_str_has_prefix(uri, "https://")) {
WebKitWebDataSource *src = webkit_web_frame_get_data_source(frame);
WebKitNetworkRequest *request = webkit_web_data_source_get_request(src);
SoupMessage *msg = webkit_network_request_get_message(request);
}
vb_update_statusbar();
- vb_update_urlbar(vb.state.uri);
+ vb_update_urlbar(uri);
/* save the current URI in register % */
- vb_register_add('%', vb.state.uri);
+ vb_register_add('%', uri);
/* clear possible set marks */
marks_clear();
break;
case WEBKIT_LOAD_FINISHED:
+ uri = webkit_web_view_get_uri(view);
+
/* update load progress in statusbar */
vb.state.progress = 100;
vb_update_statusbar();
update_title();
- if (strncmp(vb.state.uri, "about:", 6)) {
+ if (strncmp(uri, "about:", 6)) {
dom_check_auto_insert(view);
- history_add(HISTORY_URL, vb.state.uri, webkit_web_view_get_title(view));
+ history_add(HISTORY_URL, uri, webkit_web_view_get_title(view));
}
break;
#else
"signal::populate-popup", G_CALLBACK(context_menu_cb), NULL,
#endif
+ "signal::notify::uri", G_CALLBACK(uri_change_cb), NULL,
"signal::notify::progress", G_CALLBACK(webview_progress_cb), NULL,
"signal::notify::load-status", G_CALLBACK(webview_load_status_cb), NULL,
"signal::button-release-event", G_CALLBACK(button_relase_cb), NULL,