summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-12 01:00:30 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-12 01:00:30 (EDT)
commit074fc5a66cb9f93f00535fe6dce4542d0a4e9dc2 (patch)
tree718406e4632070f97ec9c8f6458038c31a0dee9e /src
parentcbdb0854d2f0e08abfe7e4a06bf4cb4e4e4c2ccd (diff)
downloadmarquee-074fc5a66cb9f93f00535fe6dce4542d0a4e9dc2.zip
marquee-074fc5a66cb9f93f00535fe6dce4542d0a4e9dc2.tar.gz
marquee-074fc5a66cb9f93f00535fe6dce4542d0a4e9dc2.tar.bz2
mq_web_view_load_uri(): New function
Diffstat (limited to 'src')
-rw-r--r--src/web-view.c26
-rw-r--r--src/web-view.h3
2 files changed, 28 insertions, 1 deletions
diff --git a/src/web-view.c b/src/web-view.c
index 5c34694..c3eb483 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -89,7 +89,8 @@ set_property(GObject *object, guint property_id, const GValue *value,
web_view->tab = g_value_get_pointer(value);
break;
case PROP_URI:
- web_view->uri = g_value_get_string(value);
+ mq_web_view_load_uri(web_view,
+ g_value_get_string(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id,
@@ -659,6 +660,29 @@ mq_web_view_new(MqTab *tab, const gchar *uri)
NULL);
}
+void
+mq_web_view_load_uri(MqWebView *web_view, const gchar *uri)
+{
+ gchar *rw_uri;
+
+ /* Unlike webkit_web_view_load_uri(), allow NULL. */
+ if (!uri) {
+ return;
+ }
+
+ web_view->uri = uri;
+
+ if (g_str_has_prefix(uri, "about:")) {
+ rw_uri = g_strconcat("mq-about:", uri + strlen("about:"), NULL);
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), rw_uri);
+ g_free(rw_uri);
+ } else {
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), uri);
+ }
+
+ g_object_notify_by_pspec(G_OBJECT(web_view), obj_properties[PROP_URI]);
+}
+
GtkWidget *
mq_web_view_get_container(MqWebView *web_view)
{
diff --git a/src/web-view.h b/src/web-view.h
index 36c5638..7f1de44 100644
--- a/src/web-view.h
+++ b/src/web-view.h
@@ -54,6 +54,9 @@ mq_web_view_get_type(void);
MqWebView *
mq_web_view_new(MqTab *tab, const gchar *uri);
+void
+mq_web_view_load_uri(MqWebView *web_view, const gchar *uri);
+
/* Temporary compatibility methods */
GtkWidget *