summaryrefslogtreecommitdiff
path: root/plugins/webkit2gtk/glade-webkit2gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/webkit2gtk/glade-webkit2gtk.c')
-rw-r--r--plugins/webkit2gtk/glade-webkit2gtk.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/webkit2gtk/glade-webkit2gtk.c b/plugins/webkit2gtk/glade-webkit2gtk.c
new file mode 100644
index 00000000..1fd3b466
--- /dev/null
+++ b/plugins/webkit2gtk/glade-webkit2gtk.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 Juan Pablo Ugarte
+ * 2016 Endless Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Juan Pablo Ugarte <juanpablougarte@gmail.com>
+ * Juan Pablo Ugarte <ugarte@endlessm.com>
+ */
+
+#include "config.h"
+
+#include <webkit2/webkit2.h>
+#include <gladeui/glade.h>
+
+void
+glade_webkit_web_view_set_property (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *id,
+ const GValue *value)
+{
+ if (g_str_equal(id, "glade-url"))
+ {
+ const gchar *url = g_value_get_string (value);
+ gchar *scheme = g_uri_parse_scheme (url);
+
+ if (scheme)
+ {
+ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (object), url);
+ g_free (scheme);
+ return;
+ }
+
+ gchar *full_url = g_strconcat ("http://", url, NULL);
+ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (object), full_url);
+ g_free (full_url);
+ }
+ else
+ GWA_GET_CLASS(G_TYPE_OBJECT)->set_property (adaptor, object, id, value);
+}