summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web-view.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/web-view.c b/src/web-view.c
index 32a8958..a5f9f85 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -502,6 +502,30 @@ context_menu_cb(WebKitWebView *wk_web_view, WebKitContextMenu *context_menu,
}
static void
+uri_cb(WebKitWebView *wk_web_view, GParamSpec G_GNUC_UNUSED *paramspec)
+{
+ const gchar *uri;
+ MqWebView *web_view;
+
+ web_view = MQ_WEB_VIEW(wk_web_view);
+
+ if (web_view->uri) {
+ g_free(web_view->uri);
+ }
+
+ uri = webkit_web_view_get_uri(wk_web_view);
+
+ if (g_str_has_prefix(uri, "mq-about:")) {
+ web_view->uri = g_strconcat("about:", uri + strlen("mq-about:"),
+ NULL);
+ } else {
+ web_view->uri = g_strdup(uri);
+ }
+
+ g_object_notify_by_pspec(G_OBJECT(web_view), obj_properties[PROP_URI]);
+}
+
+static void
clipboard_text_recv_cb(GtkClipboard G_GNUC_UNUSED *clipboard,
const gchar *text, MqWebView *web_view)
{
@@ -644,6 +668,8 @@ mq_web_view_init(MqWebView *web_view)
g_signal_connect(web_view, "context-menu",
G_CALLBACK(context_menu_cb), NULL);
+ g_signal_connect(web_view, "notify::uri",
+ G_CALLBACK(uri_cb), NULL);
g_signal_connect(web_view, "mouse-target-changed",
G_CALLBACK(mouse_target_changed_cb), NULL);
g_signal_connect(web_view, "button-press-event",