diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Makefile.am | 4 | ||||
-rw-r--r-- | plugins/webkit2gtk/.gitignore | 6 | ||||
-rw-r--r-- | plugins/webkit2gtk/Makefile.am | 40 | ||||
-rw-r--r-- | plugins/webkit2gtk/glade-webkit2gtk.c | 54 | ||||
-rw-r--r-- | plugins/webkit2gtk/webkit2gtk.xml.in | 41 |
5 files changed, 145 insertions, 0 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 7366796e..ece23c2b 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -10,6 +10,10 @@ if BUILD_GLADEUI SUBDIRS += gladeui endif +if BUILD_WEBKIT2GTK +SUBDIRS += webkit2gtk +endif + dtddir = $(pkgdatadir)/catalogs dtd_DATA = glade-catalog.dtd diff --git a/plugins/webkit2gtk/.gitignore b/plugins/webkit2gtk/.gitignore new file mode 100644 index 00000000..a4100ae7 --- /dev/null +++ b/plugins/webkit2gtk/.gitignore @@ -0,0 +1,6 @@ +/.deps +/.libs + +/Makefile +/Makefile.in +/webkit2gtk.xml diff --git a/plugins/webkit2gtk/Makefile.am b/plugins/webkit2gtk/Makefile.am new file mode 100644 index 00000000..30d20b44 --- /dev/null +++ b/plugins/webkit2gtk/Makefile.am @@ -0,0 +1,40 @@ +## Process this file with automake to produce Makefile.in + +libgladeui = $(top_builddir)/gladeui/libgladeui-2.la + + +# libgladewebkit2gtk + +gladewebkit2gtk_LTLIBRARIES = libgladewebkit2gtk.la +gladewebkit2gtkdir = $(pkglibdir)/modules + +libgladewebkit2gtk_la_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GladeUI-WEBKIT2GTK\" \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + $(WEBKIT2GTK_INCLUDES) + +libgladewebkit2gtk_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(PLUGINS_WARN_CFLAGS) \ + $(WEBKIT2GTK_CFLAGS) + +libgladewebkit2gtk_la_SOURCES = glade-webkit2gtk.c + +libgladewebkit2gtk_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) $(WEBKIT2GTK_LDFLAGS) +libgladewebkit2gtk_la_LIBADD = $(libgladeui) $(WEBKIT2GTK_LIBS) + +if PLATFORM_WIN32 +libgladewebkit2gtk_la_LDFLAGS += -no-undefined +endif + +# catalog data +catalogsdir = $(pkgdatadir)/catalogs + +catalogs_DATA = webkit2gtk.xml + +@INTLTOOL_XML_NOMERGE_RULE@ + +EXTRA_DIST = webkit2gtk.xml webkit2gtk.xml.in + +CLEANFILES = webkit2gtk.xml
\ No newline at end of file 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); +} diff --git a/plugins/webkit2gtk/webkit2gtk.xml.in b/plugins/webkit2gtk/webkit2gtk.xml.in new file mode 100644 index 00000000..b44cf7a3 --- /dev/null +++ b/plugins/webkit2gtk/webkit2gtk.xml.in @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<glade-catalog name="webkit2gtk" + version="2.12" + library="gladewebkit2gtk" + domain="glade" + depends="gtk+" + book="WebKit2GTK"> + + <glade-widget-classes> + + <glade-widget-class name="WebKitWebView" + generic-name="webview" + title="WebKit Web View" + get-type-function="webkit_web_view_get_type"> + <set-property-function>glade_webkit_web_view_set_property</set-property-function> + <properties> + <property save="False" id="glade-url" name="URL" weight="1.1"> + <parameter-spec> + <type>GParamString</type> + </parameter-spec> + <tooltip>The URL to load in Glade (this property will not be saved)</tooltip> + </property> + <property id="user-content-manager" disabled="True" /> + <property id="web-context" disabled="True" /> + </properties> + </glade-widget-class> + + <glade-widget-class name="WebKitSettings" + generic-name="settings" + title="WebKit Settings" + toplevel="True" + get-type-function="webkit_settings_get_type"/> + + </glade-widget-classes> + + <glade-widget-group name="webkit2gtk" title="WebKit2GTK+ Widgets"> + <glade-widget-class-ref name="WebKitWebView"/> + <glade-widget-class-ref name="WebKitSettings"/> + </glade-widget-group> + +</glade-catalog> |