[glade/gladewebkit2gtk] plugins/webkit2gtk: added initial support for WebKit2GTK+ library.



commit a5cfd779a61027d14dbb1e186987cea4f111a29e
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Sep 14 10:39:38 2016 -0300

    plugins/webkit2gtk: added initial support for WebKit2GTK+ library.

 configure.ac                          |   18 +++++++++++
 plugins/Makefile.am                   |    4 ++
 plugins/webkit2gtk/.gitignore         |    6 ++++
 plugins/webkit2gtk/Makefile.am        |   40 ++++++++++++++++++++++++
 plugins/webkit2gtk/glade-webkit2gtk.c |   54 +++++++++++++++++++++++++++++++++
 plugins/webkit2gtk/webkit2gtk.xml.in  |   41 +++++++++++++++++++++++++
 6 files changed, 163 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 021622c..ac59f09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,6 +207,22 @@ fi
 
 AM_CONDITIONAL(BUILD_PYTHON, test x"$have_python" = "xyes")
 
+dnl ================================================================
+dnl WebKit2GTK support
+dnl ================================================================
+WEBKIT2GTK_REQUIRED=2.12.0
+
+AC_ARG_ENABLE(webkit2gtk,
+    AS_HELP_STRING([--disable-webkit2gtk], [disable webkit2gtk catalog]),
+    check_webkit2gtk=$enableval, check_webkit2gtk=yes)
+
+if test x"$check_webkit2gtk" = x"yes"; then
+  PKG_CHECK_MODULES([WEBKIT2GTK],[webkit2gtk-4.0 >= 
$WEBKIT2GTK_REQUIRED],[have_webkit2gtk=yes],[have_webkit2gtk=no])
+else
+  have_webkit2gtk=no
+fi
+AM_CONDITIONAL(BUILD_WEBKIT2GTK, test x"$have_webkit2gtk" = "xyes")
+
 # ==================================================================
 # Glade User Manual (requires yelp-tools)
 # ==================================================================
@@ -342,6 +358,7 @@ plugins/gtk+/icons/16x16/Makefile
 plugins/gtk+/icons/22x22/Makefile
 plugins/python/Makefile
 plugins/gladeui/Makefile
+plugins/webkit2gtk/Makefile
 po/Makefile.in
 doc/Makefile
 doc/version.xml
@@ -363,6 +380,7 @@ Configuration:
        GTK+ UNIX Print Widgets: ${have_unix_print}
        PYTHON Widgets support:  ${have_python}
        Gladeui Catalog:         ${enable_gladeui}
+       WebKit2GTK+ Catalog:     ${have_webkit2gtk}
        Introspection Data:      ${found_introspection}
 
        Build Reference Manual:  ${enable_gtk_doc}
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 7366796..ece23c2 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 0000000..a4100ae
--- /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 0000000..30d20b4
--- /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 0000000..1fd3b46
--- /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 0000000..b44cf7a
--- /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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]