From 185a2bf31935f9293493dc89fe4e229e372ffda1 Mon Sep 17 00:00:00 2001 From: Juan Pablo Ugarte Date: Wed, 14 Sep 2016 10:39:38 -0300 Subject: plugins/webkit2gtk: added initial support for WebKit2GTK+ library. --- plugins/webkit2gtk/glade-webkit2gtk.c | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/webkit2gtk/glade-webkit2gtk.c (limited to 'plugins/webkit2gtk/glade-webkit2gtk.c') 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 + * Juan Pablo Ugarte + */ + +#include "config.h" + +#include +#include + +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); +} -- cgit v1.2.1