diff options
-rw-r--r-- | ChangeLog | 28 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 62 | ||||
-rw-r--r-- | doc/reference/Makefile.am | 24 | ||||
-rw-r--r-- | embed/Makefile.am | 12 | ||||
-rw-r--r-- | embed/ephy-embed-factory.c | 23 | ||||
-rw-r--r-- | embed/ephy-embed-persist.c | 1 | ||||
-rw-r--r-- | embed/ephy-embed-shell.c | 1 | ||||
-rw-r--r-- | embed/ephy-embed.c | 2 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 103 | ||||
-rw-r--r-- | embed/webkit/Makefile.am | 23 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-find.cpp | 105 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-find.h | 57 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-persist.cpp | 89 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-persist.h | 60 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-single.cpp | 342 | ||||
-rw-r--r-- | embed/webkit/webkit-embed-single.h | 57 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.cpp | 441 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.h | 59 | ||||
-rw-r--r-- | src/Makefile.am | 38 |
20 files changed, 1407 insertions, 122 deletions
@@ -1,3 +1,31 @@ +2007-07-27 Xan Lopez <xan@gnome.org> + + * Makefile.am: + * configure.ac: + * doc/reference/Makefile.am: + * embed/Makefile.am: + * embed/ephy-embed-factory.c: (ephy_embed_factory_new_object): + * embed/ephy-embed-persist.c: + * embed/ephy-embed-shell.c: + * embed/ephy-embed.c: + * embed/webkit/Makefile.am: + * embed/webkit/webkit-embed-find.cpp: + * embed/webkit/webkit-embed-find.h: + * embed/webkit/webkit-embed-persist.cpp: + * embed/webkit/webkit-embed-persist.h: + * embed/webkit/webkit-embed-single.cpp: + * embed/webkit/webkit-embed-single.h: + * embed/webkit/webkit-embed.cpp: + * embed/webkit/webkit-embed.h: + * src/Makefile.am: + + Add support for the WebKit engine, compile with + --with-engine=webkit to activate. + + * embed/mozilla/mozilla-embed-single.cpp: + + Move to the G_DEFINE_TYPE_WITH_CODE macro. + 2007-07-26 Diego Escalante Urrelo <diegoe@gnome.org> * src/ephy-window.c: diff --git a/Makefile.am b/Makefile.am index 85b05f438..2c3093f64 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,4 +30,4 @@ DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --disable-schemas-install \ --disable-scrollkeeper \ - --with-gecko=$(MOZILLA) + --with-gecko=$(GECKO) diff --git a/configure.ac b/configure.ac index ce89be190..c8ce6f964 100644 --- a/configure.ac +++ b/configure.ac @@ -164,11 +164,30 @@ if test "x$enable_maintainer_mode" = "xyes"; then AC_LANG_POP([C]) fi +# ************ +# Engine check +# ************ + +AC_MSG_CHECKING(for which engine to use) + +AC_ARG_WITH([engine], + AS_HELP_STRING([--with-engine@<:@=mozilla|webkit@:>@], + [Which engine to build against @<:@mozilla@:>@]), + [], [with_engine="mozilla"]) + +AC_MSG_RESULT($with_engine) +AC_SUBST([with_engine]) + # ******* # Mozilla # ******* -GECKO_INIT([GECKO]) +GECKO_INIT([GECKO], [gecko_found=yes],[gecko_found=no]) + +AM_CONDITIONAL([WITH_GECKO_ENGINE], [test "$with_engine" = "mozilla"]) +if test "$with_engine" = "mozilla" ; then + +AC_DEFINE([WITH_GECKO_ENGINE],[1],[Define if you wish to enable mozilla engine]) AC_SUBST([GECKO]) AC_SUBST([GECKO_FLAVOUR]) @@ -192,8 +211,6 @@ xulrunner) min_version=1.8 ;; *) AC_MSG_ERROR([Unsupported gecko "$gecko_cv_gecko"]) ;; esac -AM_CONDITIONAL([HAVE_XULRUNNER],[test "$gecko_cv_gecko" = "xulrunner"]) - # Added $gecko_cv_gecko-js for debian xulrunner brokenness PKG_CHECK_MODULES([GECKO],[${gecko_cv_gecko}-xpcom >= $min_version ${gecko_cv_gecko}-js $gecko_cv_extra_pkg_dependencies]) AC_SUBST([GECKO_CFLAGS]) @@ -280,8 +297,6 @@ if test "$enable_psm" = "yes" -a "$have_psm" = "yes"; then AC_DEFINE([HAVE_MOZILLA_PSM],[1],[Define if you have the mozilla NSS headers installed]) fi -AM_CONDITIONAL([HAVE_MOZILLA_PSM],[test "$enable_psm" = "yes" -a "$have_psm" = "yes"]) - # Check whether to enable our filepicker component AC_MSG_CHECKING([whether to enable native gtk+ filepicker]) @@ -290,7 +305,6 @@ AC_ARG_ENABLE([filepicker], [],[enable_filepicker=no]) AC_MSG_RESULT([$enable_filepicker]) -AM_CONDITIONAL([ENABLE_FILEPICKER],[test "$enable_filepicker" = "yes"]) if test "$enable_filepicker" = "yes"; then AC_DEFINE([ENABLE_FILEPICKER],[1],[Define to enable the native filepicker]) fi @@ -329,6 +343,24 @@ REQUIRED_EXTENSIONS="cookie,permissions" GECKO_CHECK_CONTRACTIDS([$REQUIRED_CONTRACTS], [],[AC_MSG_ERROR([$gecko_cv_gecko needs to be compiled with at least --enable-extensions=default,$REQUIRED_EXTENSIONS])]) +fi # with_engine = gecko + +AM_CONDITIONAL([HAVE_XULRUNNER],[test "$gecko_cv_gecko" = "xulrunner"]) +AM_CONDITIONAL([HAVE_MOZILLA_PSM],[test "$enable_psm" = "yes" -a "$have_psm" = "yes"]) +AM_CONDITIONAL([ENABLE_FILEPICKER],[test "$enable_filepicker" = "yes"]) + +# ******************************* +# webkit renderer +# ******************************* + +AM_CONDITIONAL([WITH_WEBKIT_ENGINE], test "$with_engine" = "webkit") +if test "$with_engine" = "webkit" ; then + AC_DEFINE([WITH_WEBKIT_ENGINE],[1],[Define if you wish to enable webkit engine]) + PKG_CHECK_MODULES([WEBKIT], WebKitGdk) + AC_SUBST([WEBKIT_CFLAGS]) + AC_SUBST([WEBKIT_LIBS]) +fi # with_engine = webkit + # *************** # Multimedia keys # *************** @@ -378,7 +410,7 @@ if test "x$have_python" != "xno"; then AC_SUBST([PYTHON_CFLAGS]) AC_SUBST([PYTHON_EXTRA_LIBS]) - dnl FIXME: do we really need this test? + # FIXME: do we really need this test? AC_MSG_CHECKING([whether we can build a shared library depending on libpython]) rm -rf testpython mkdir testpython @@ -432,7 +464,7 @@ if test "x$have_python" != "xno"; then AC_SUBST([PYGTK_CODEGEN]) AC_SUBST([PYGTK_H2DEF]) - dnl Check for -fno-strict-aliasing + # Check for -fno-strict-aliasing FLAGS="-fno-strict-aliasing" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $FLAGS" @@ -470,14 +502,14 @@ AC_SUBST([EPIPHANY_FEATURES]) # Gecko 1.9 can handle .desktop files from file: URLs itself, but we # also support windows .lnk files, so always enable this plugin +if test "$with_engine" = "mozilla" ; then + AC_MSG_CHECKING([whether to build the deskop file plugin]) AC_ARG_ENABLE([desktop-file-plugin], AS_HELP_STRING([--disable-desktop-file-plugin],[Disable the desktop file plugin (default: enabled)]), [],[enable_desktop_file_plugin=yes]) AC_MSG_RESULT([$enable_desktop_file_plugin]) -AM_CONDITIONAL([ENABLE_DESKTOP_FILE_PLUGIN],[test "x$enable_desktop_file_plugin" = "xyes"]) - if test "x$enable_desktop_file_plugin" = "xyes"; then PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0]) AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_CFLAGS]) @@ -488,6 +520,10 @@ if test "x$enable_desktop_file_plugin" = "xyes"; then AC_DEFINE([HAVE_PRIVATE_PLUGINS],[1],[Define if any private plugins are enabled]) fi +fi # with_engine = mozilla + +AM_CONDITIONAL([ENABLE_DESKTOP_FILE_PLUGIN],[test "x$enable_desktop_file_plugin" = "xyes"]) + # ******************* # Additional features # ******************* @@ -552,6 +588,8 @@ AM_CONDITIONAL([ENABLE_NETWORK_MANAGER],[test "$enable_network_manager" = "yes"] # Enchant spell checking # Does not appear to work on gecko 1.8.0, so only offer for >= 1.8.1 +if test "$with_engine" = "mozilla" ; then + if test "$gecko_cv_gecko_version_int" -ge "1008001"; then # Default to 'disabled' until it's fully functional @@ -580,6 +618,8 @@ if test "$enable_spell_checker" = "yes" -a "$have_gecko_spell_checker" = "yes"; AC_DEFINE([ENABLE_SPELLCHECKER],[1],[Define to enable the spell checker]) fi +fi # with_engine = mozilla + AM_CONDITIONAL([ENABLE_SPELLCHECKER],[test "$enable_spell_checker" = "yes" -a "$have_gecko_spell_checker" = "yes"]) # ************ @@ -694,6 +734,7 @@ lib/egg/Makefile lib/widgets/Makefile embed/Makefile embed/mozilla/Makefile +embed/webkit/Makefile src/Makefile src/bookmarks/Makefile help/Makefile @@ -717,6 +758,7 @@ Epiphany was configured with the following options: Prefix : $prefix Extra debugging support : $enable_debug + Engine : $with_engine Gecko backend : $gecko_cv_gecko version $gecko_cv_gecko_version PSM support : $enable_psm Zeroconf bookmarks support : $enable_zeroconf diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index ba985e0e6..edbc7e38e 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -80,6 +80,9 @@ IGNORE_HFILES = \ mozilla-notifiers.h \ MozillaPrivate.h \ MozRegisterComponents.h \ + webkit-embed.h \ + webkit-embed-persist.h \ + webkit-embed-single.h \ PrintingPromptService.h \ egg-editable-toolbar.h \ eggintl.h \ @@ -142,14 +145,10 @@ GTKDOC_CFLAGS = -I$(top_srcdir)/src \ -I$(top_srcdir)/lib/widgets \ -I$(top_srcdir)/embed \ -I$(top_builddir)/embed \ - -I$(top_srcdir)/embed/mozilla \ -I$(top_srcdir)/src/bookmarks \ -I$(top_srcdir)/lib/egg \ -I$(top_builddir)/lib/egg \ - -I$(GECKO_INCLUDE_ROOT) \ - -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz \ $(DEPENDENCIES_CFLAGS) \ - $(GECKO_CFLAGS) \ $(DBUS_CFLAGS) \ $(INCINTL) @@ -157,7 +156,6 @@ GTKDOC_LIBS = \ $(top_builddir)/src/libephymain.la \ $(top_builddir)/src/bookmarks/libephybookmarks.la \ $(top_builddir)/embed/libephyembedfactory.la \ - $(top_builddir)/embed/mozilla/libephymozillaembed.la \ $(top_builddir)/embed/libephyembed.la \ $(top_builddir)/lib/widgets/libephywidgets.la \ $(top_builddir)/lib/libephymisc.la \ @@ -168,6 +166,22 @@ GTKDOC_LIBS = \ $(DBUS_LIBS) \ $(LIBINTL) +if WITH_GECKO_ENGINE + GTKDOC_LIBS += $(top_builddir)/embed/mozilla/libephymozillaembed.la + + GTKDOC_CFLAGS += -I$(top_srcdir)/embed/mozilla \ + -I$(GECKO_INCLUDE_ROOT) \ + -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz \ + $(GECKO_CFLAGS) +endif + +if WITH_WEBKIT_ENGINE + GTKDOC_LIBS += $(top_builddir)/embed/webkit/libephywebkitembed.la + + GTKDOC_CFLAGS += -I$(top_srcdir)/embed/webkit \ + $(WEBKIT_CFLAGS) +endif + if ENABLE_PYTHON GTKDOC_LIBS += \ $(top_builddir)/src/libpyphany.la \ diff --git a/embed/Makefile.am b/embed/Makefile.am index 68859851f..e073b5d57 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -1,4 +1,5 @@ -SUBDIRS = mozilla +SUBDIRS = $(with_engine) +DIST_SUBDIRS = mozilla webkit noinst_LTLIBRARIES = libephyembed.la libephyembedfactory.la @@ -72,14 +73,12 @@ nodist_libephyembed_la_SOURCES = \ libephyembed_la_CPPFLAGS = \ -I$(top_builddir)/lib \ - -I$(top_srcdir)/embed/mozilla \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/egg \ -I$(top_srcdir)/lib/widgets \ $(AM_CPPFLAGS) libephyembed_la_CFLAGS = \ - -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz \ -DSHARE_DIR=\"$(pkgdatadir)\" \ $(DEPENDENCIES_CFLAGS) \ $(AM_CFLAGS) @@ -89,10 +88,13 @@ libephyembedfactory_la_SOURCES = \ ephy-embed-factory.h libephyembedfactory_la_CPPFLAGS = \ - -I$(top_srcdir)/embed/mozilla \ - -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz \ + -I$(top_srcdir)/embed/$(with_engine) \ $(AM_CPPFLAGS) +if WITH_GECKO_ENGINE +libephyembedfactory_la_CPPFLAGS += -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz +endif + libephyembedfactory_la_CFLAGS = \ $(DEPENDENCIES_CFLAGS) \ $(AM_CFLAGS) diff --git a/embed/ephy-embed-factory.c b/embed/ephy-embed-factory.c index d5d43ac39..1ab59f4a5 100644 --- a/embed/ephy-embed-factory.c +++ b/embed/ephy-embed-factory.c @@ -21,10 +21,17 @@ #include "config.h" #include "ephy-embed-factory.h" +#if defined(WITH_GECKO_ENGINE) #include "mozilla-embed.h" #include "mozilla-embed-find.h" #include "mozilla-embed-persist.h" #include "mozilla-embed-single.h" +#elif defined(WITH_WEBKIT_ENGINE) +#include "webkit-embed.h" +#include "webkit-embed-find.h" +#include "webkit-embed-persist.h" +#include "webkit-embed-single.h" +#endif #include "ephy-embed.h" #include "ephy-embed-find.h" #include "ephy-embed-persist.h" @@ -45,19 +52,35 @@ ephy_embed_factory_new_object (GType type) if (type == EPHY_TYPE_EMBED) { +#if defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED, NULL); +#elif defined(WITH_WEBKIT_ENGINE) + object = g_object_new (WEBKIT_TYPE_EMBED, NULL); +#endif } else if (type == EPHY_TYPE_EMBED_PERSIST) { +#if defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL); +#elif defined(WITH_WEBKIT_ENGINE) + object = g_object_new (WEBKIT_TYPE_EMBED_PERSIST, NULL); +#endif } else if (type == EPHY_TYPE_EMBED_FIND) { +#if defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED_FIND, NULL); +#elif defined(WITH_WEBKIT_ENGINE) + object = g_object_new (WEBKIT_TYPE_EMBED_FIND, NULL); +#endif } else if (type == EPHY_TYPE_EMBED_SINGLE) { +#if defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL); +#elif defined(WITH_WEBKIT_ENGINE) + object = g_object_new (WEBKIT_TYPE_EMBED_SINGLE, NULL); +#endif } else { diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c index 49c918d65..062cd0207 100644 --- a/embed/ephy-embed-persist.c +++ b/embed/ephy-embed-persist.c @@ -22,7 +22,6 @@ #include "config.h" #include "ephy-embed-persist.h" -#include "mozilla-embed-persist.h" #include "ephy-embed-type-builtins.h" #include "ephy-debug.h" diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index 65d2fe243..fe5da248a 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -37,7 +37,6 @@ #include "ephy-file-helpers.h" #include "ephy-history.h" #include "ephy-marshal.h" -#include "mozilla-embed-single.h" #include "ephy-print-utils.h" diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index afd6d0129..55bec83cc 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -24,8 +24,6 @@ #include "ephy-embed-type-builtins.h" #include "ephy-marshal.h" -#include "mozilla-embed-single.h" -#include "mozilla-embed.h" static void ephy_embed_base_init (gpointer g_class); diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 529ed1886..8930e1e9d 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -137,94 +137,19 @@ static void mozilla_embed_single_init (MozillaEmbedSingle *ges); static void ephy_certificate_manager_iface_init (EphyCertificateManagerIface *iface); #endif -static GObjectClass *parent_class = NULL; - -GType -mozilla_embed_single_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - const GTypeInfo our_info = - { - sizeof (MozillaEmbedSingleClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) mozilla_embed_single_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (MozillaEmbedSingle), - 0, /* n_preallocs */ - (GInstanceInitFunc) mozilla_embed_single_init - }; - - const GInterfaceInfo embed_single_info = - { - (GInterfaceInitFunc) ephy_embed_single_iface_init, - NULL, - NULL - }; - - const GInterfaceInfo cookie_manager_info = - { - (GInterfaceInitFunc) ephy_cookie_manager_iface_init, - NULL, - NULL - }; - - const GInterfaceInfo password_manager_info = - { - (GInterfaceInitFunc) ephy_password_manager_iface_init, - NULL, - NULL - }; - - const GInterfaceInfo permission_manager_info = - { - (GInterfaceInitFunc) ephy_permission_manager_iface_init, - NULL, - NULL - }; - +G_DEFINE_TYPE_WITH_CODE (MozillaEmbedSingle, mozilla_embed_single, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_SINGLE, + ephy_embed_single_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_COOKIE_MANAGER, + ephy_cookie_manager_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_PASSWORD_MANAGER, + ephy_password_manager_iface_init) #ifdef ENABLE_CERTIFICATE_MANAGER - const GInterfaceInfo certificate_manager_info = - { - (GInterfaceInitFunc) ephy_certificate_manager_iface_init, - NULL, - NULL - }; -#endif - - type = g_type_register_static (G_TYPE_OBJECT, - "MozillaEmbedSingle", - &our_info, - (GTypeFlags)0); - - g_type_add_interface_static (type, - EPHY_TYPE_EMBED_SINGLE, - &embed_single_info); - - g_type_add_interface_static (type, - EPHY_TYPE_COOKIE_MANAGER, - &cookie_manager_info); - - g_type_add_interface_static (type, - EPHY_TYPE_PASSWORD_MANAGER, - &password_manager_info); - - g_type_add_interface_static (type, - EPHY_TYPE_PERMISSION_MANAGER, - &permission_manager_info); -#ifdef ENABLE_CERTIFICATE_MANAGER - g_type_add_interface_static (type, - EPHY_TYPE_CERTIFICATE_MANAGER, - &certificate_manager_info); + G_IMPLEMENT_INTERFACE (EPHY_TYPE_CERTIFICATE_MANAGER, + ephy_certificate_manager_iface_init) #endif - } - - return type; -} + G_IMPLEMENT_INTERFACE (EPHY_TYPE_PERMISSION_MANAGER, + ephy_permission_manager_iface_init)) static gboolean mozilla_set_default_prefs (MozillaEmbedSingle *mes) @@ -739,7 +664,7 @@ mozilla_embed_single_dispose (GObject *object) priv->mSingleObserver = nsnull; } - parent_class->dispose (object); + G_OBJECT_CLASS (mozilla_embed_single_parent_class)->dispose (object); } static void @@ -749,7 +674,7 @@ mozilla_embed_single_finalize (GObject *object) /* Destroy EphyEmbedSingle before because some * services depend on xpcom */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (mozilla_embed_single_parent_class)->finalize (object); mozilla_notifiers_shutdown (); @@ -1363,8 +1288,6 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = (GObjectClass *) g_type_class_peek_parent (klass); - object_class->dispose = mozilla_embed_single_dispose; object_class->finalize = mozilla_embed_single_finalize; object_class->get_property = mozilla_embed_single_get_property; diff --git a/embed/webkit/Makefile.am b/embed/webkit/Makefile.am new file mode 100644 index 000000000..41d6fb98a --- /dev/null +++ b/embed/webkit/Makefile.am @@ -0,0 +1,23 @@ +noinst_LTLIBRARIES = libephywebkitembed.la + +libephywebkitembed_la_SOURCES = \ + webkit-embed.cpp \ + webkit-embed.h \ + webkit-embed-find.cpp \ + webkit-embed-find.h \ + webkit-embed-persist.cpp \ + webkit-embed-persist.h \ + webkit-embed-single.cpp \ + webkit-embed-single.h + +libephywebkitembed_la_CPPFLAGS = \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/embed \ + -I$(top_srcdir) \ + $(WEBKIT_CFLAGS) \ + -DSHARE_DIR=\"$(pkgdatadir)\" \ + -DBUILDING_GDK__=1 \ + -DBUILDING_CAIRO__=1 \ + $(DEPENDENCIES_CFLAGS) \ + $(AM_CPPFLAGS) + diff --git a/embed/webkit/webkit-embed-find.cpp b/embed/webkit/webkit-embed-find.cpp new file mode 100644 index 000000000..f38b0125e --- /dev/null +++ b/embed/webkit/webkit-embed-find.cpp @@ -0,0 +1,105 @@ +/* + * Copyright © 2000-2004 Marco Pesenti Gritti + * Copyright © 2003, 2004 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-debug.h" +#include "ephy-embed-find.h" +#include "ephy-embed-shell.h" + +#include "webkit-embed-find.h" + +#define WEBKIT_EMBED_FIND_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFindPrivate)) + +struct _WebkitEmbedFindPrivate +{ + +}; + +static void +impl_set_embed (EphyEmbedFind *efind, + EphyEmbed *embed) +{ +} + +static void +impl_set_properties (EphyEmbedFind *efind, + const char *find_string, + gboolean case_sensitive) +{ +} + +static EphyEmbedFindResult +impl_find (EphyEmbedFind *efind, + const char *find_string, + gboolean links_only) +{ + return EPHY_EMBED_FIND_FOUND; +} + +static EphyEmbedFindResult +impl_find_again (EphyEmbedFind *efind, + gboolean forward, + gboolean links_only) +{ + return EPHY_EMBED_FIND_FOUND; +} + +static void +impl_set_selection (EphyEmbedFind *efind, + gboolean attention) +{ +} + +static gboolean +impl_activate_link (EphyEmbedFind *efind, + GdkModifierType mask) +{ + return FALSE; +} + +static void +ephy_find_iface_init (EphyEmbedFindIface *iface) +{ + iface->set_embed = impl_set_embed; + iface->set_properties = impl_set_properties; + iface->find = impl_find; + iface->find_again = impl_find_again; + iface->set_selection = impl_set_selection; + iface->activate_link = impl_activate_link; +} + +static void +webkit_embed_find_init (WebkitEmbedFind *find) +{ +} + +static void +webkit_embed_find_class_init (WebkitEmbedFindClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (WebkitEmbedFindPrivate)); +} + +G_DEFINE_TYPE_WITH_CODE (WebkitEmbedFind, webkit_embed_find, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_FIND, + ephy_find_iface_init)) diff --git a/embed/webkit/webkit-embed-find.h b/embed/webkit/webkit-embed-find.h new file mode 100644 index 000000000..2999890dd --- /dev/null +++ b/embed/webkit/webkit-embed-find.h @@ -0,0 +1,57 @@ +/* + * Copyright © 2000-2004 Marco Pesenti Gritti + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_FIND_H +#define WEBKIT_EMBED_FIND_H + +#include <glib.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED_FIND (webkit_embed_find_get_type ()) +#define WEBKIT_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFind)) +#define WEBKIT_EMBED_FIND_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFindClass)) +#define WEBKIT_IS_EMBED_FIND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_FIND)) +#define WEBKIT_IS_EMBED_FIND_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_FIND)) +#define WEBKIT_EMBED_FIND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_FIND, WebkitEmbedFindClass)) + +typedef struct _WebkitEmbedFindClass WebkitEmbedFindClass; +typedef struct _WebkitEmbedFind WebkitEmbedFind; +typedef struct _WebkitEmbedFindPrivate WebkitEmbedFindPrivate; + +struct _WebkitEmbedFind +{ + GObject parent_instance; + + /*< private >*/ + WebkitEmbedFindPrivate *priv; +}; + +struct _WebkitEmbedFindClass +{ + GObjectClass parent_class; +}; + +GType webkit_embed_find_get_type (void); + +G_END_DECLS + +#endif diff --git a/embed/webkit/webkit-embed-persist.cpp b/embed/webkit/webkit-embed-persist.cpp new file mode 100644 index 000000000..98093f5a0 --- /dev/null +++ b/embed/webkit/webkit-embed-persist.cpp @@ -0,0 +1,89 @@ +/* + * Copyright © 2007 Xan Lopez <xan@gnome.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "webkit-embed-persist.h" + +static void +webkit_embed_persist_class_init (WebkitEmbedPersistClass *klass); +static void +webkit_embed_persist_init (WebkitEmbedPersist *ges); +static void +webkit_embed_persist_finalize (GObject *object); + +#define WEBKIT_EMBED_PERSIST_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersistPrivate)) + +G_DEFINE_TYPE (WebkitEmbedPersist, webkit_embed_persist, EPHY_TYPE_EMBED_PERSIST) + +static void +webkit_embed_persist_init (WebkitEmbedPersist *persist) +{ +} + +static void +webkit_embed_persist_finalize (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_persist_parent_class)->finalize (object); +} + +void +webkit_embed_persist_completed (WebkitEmbedPersist *persist) +{ + g_signal_emit_by_name (persist, "completed"); + g_object_unref (persist); +} + +void +webkit_embed_persist_cancelled (WebkitEmbedPersist *persist) +{ + g_signal_emit_by_name (persist, "cancelled"); + g_object_unref (persist); +} + +static void +impl_cancel (EphyEmbedPersist *persist) +{ + g_object_unref (persist); +} + +static gboolean +impl_save (EphyEmbedPersist *persist) +{ + g_object_ref (persist); +} + +static char * +impl_to_string (EphyEmbedPersist *persist) +{ +} + +static void +webkit_embed_persist_class_init (WebkitEmbedPersistClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + EphyEmbedPersistClass *persist_class = EPHY_EMBED_PERSIST_CLASS (klass); + + object_class->finalize = webkit_embed_persist_finalize; + + persist_class->save = impl_save; + persist_class->cancel = impl_cancel; + persist_class->to_string = impl_to_string; + + // g_type_class_add_private (object_class, sizeof(WebkitEmbedPersistPrivate)); +} diff --git a/embed/webkit/webkit-embed-persist.h b/embed/webkit/webkit-embed-persist.h new file mode 100644 index 000000000..b1728fb1d --- /dev/null +++ b/embed/webkit/webkit-embed-persist.h @@ -0,0 +1,60 @@ +/* + * Copyright © 2007 Xan Lopez <xan@gnome.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_PERSIST_H +#define WEBKIT_EMBED_PERSIST_H + +#include <glib.h> +#include <glib-object.h> + +#include "ephy-embed-persist.h" + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED_PERSIST (webkit_embed_persist_get_type ()) +#define WEBKIT_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersist)) +#define WEBKIT_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersistClass)) +#define WEBKIT_IS_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_PERSIST)) +#define WEBKIT_IS_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_PERSIST)) +#define WEBKIT_EMBED_PERSIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_PERSIST, WebkitEmbedPersistClass)) + +typedef struct WebkitEmbedPersistClass WebkitEmbedPersistClass; +typedef struct WebkitEmbedPersist WebkitEmbedPersist; +typedef struct WebkitEmbedPersistPrivate WebkitEmbedPersistPrivate; + +struct WebkitEmbedPersist +{ + EphyEmbedPersist parent; +}; + +struct WebkitEmbedPersistClass +{ + EphyEmbedPersistClass parent_class; +}; + +GType webkit_embed_persist_get_type (void); + +void webkit_embed_persist_completed (WebkitEmbedPersist *persist); + +void webkit_embed_persist_cancelled (WebkitEmbedPersist *persist); + +G_END_DECLS + +#endif diff --git a/embed/webkit/webkit-embed-single.cpp b/embed/webkit/webkit-embed-single.cpp new file mode 100644 index 000000000..12491776a --- /dev/null +++ b/embed/webkit/webkit-embed-single.cpp @@ -0,0 +1,342 @@ +/* Copyright © 2007 Xan Lopez <xan@gnome.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "config.h" + +#include <glib/gi18n.h> +#include <libgnomevfs/gnome-vfs-utils.h> + +#include "webkit-embed-single.h" +#include "ephy-embed-single.h" +#include "ephy-cookie-manager.h" +#include "ephy-password-manager.h" +#include "ephy-permission-manager.h" + +#ifdef ENABLE_CERTIFICATE_MANAGER +#include "ephy-certificate-manager.h" +#endif + +#define WEBKIT_EMBED_SINGLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSinglePrivate)) + +struct WebkitEmbedSinglePrivate +{ + guint online : 1; +}; + +enum +{ + PROP_0, + PROP_NETWORK_STATUS +}; + +static void webkit_embed_single_class_init (WebkitEmbedSingleClass *klass); +static void webkit_embed_single_init (WebkitEmbedSingle *ges); +static void ephy_embed_single_iface_init (EphyEmbedSingleIface *iface); +static void ephy_cookie_manager_iface_init (EphyCookieManagerIface *iface); +static void ephy_password_manager_iface_init (EphyPasswordManagerIface *iface); +static void ephy_permission_manager_iface_init (EphyPermissionManagerIface *iface); + +#ifdef ENABLE_CERTIFICATE_MANAGER +static void ephy_certificate_manager_iface_init (EphyCertificateManagerIface *iface); +#endif + + +G_DEFINE_TYPE_WITH_CODE (WebkitEmbedSingle, webkit_embed_single, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_SINGLE, + ephy_embed_single_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_COOKIE_MANAGER, + ephy_cookie_manager_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_PASSWORD_MANAGER, + ephy_password_manager_iface_init) +#ifdef ENABLE_CERTIFICATE_MANAGER + G_IMPLEMENT_INTERFACE (EPHY_TYPE_CERTIFICATE_MANAGER, + ephy_certificate_manager_iface_init) +#endif + G_IMPLEMENT_INTERFACE (EPHY_TYPE_PERMISSION_MANAGER, + ephy_permission_manager_iface_init)) + + +static void +webkit_embed_single_init (WebkitEmbedSingle *mes) +{ + mes->priv = WEBKIT_EMBED_SINGLE_GET_PRIVATE (mes); +} + +static void +webkit_embed_single_dispose (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_single_parent_class)->dispose (object); +} + +static void +webkit_embed_single_finalize (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_single_parent_class)->finalize (object); +} + +static void +impl_clear_cache (EphyEmbedSingle *shell) +{ +} + +static void +impl_clear_auth_cache (EphyEmbedSingle *shell) +{ +} + +static void +impl_set_network_status (EphyEmbedSingle *single, + gboolean online) +{ +} + +static gboolean +impl_get_network_status (EphyEmbedSingle *esingle) +{ + return FALSE; +} + +static const char* +impl_get_backend_name (EphyEmbedSingle *esingle) +{ + /* If you alter the return values here, remember to update + * the docs in ephy-embed-single.c */ + return "webkit"; +} + +static GList * +impl_get_font_list (EphyEmbedSingle *shell, + const char *langGroup) +{ + return NULL; +} + +static GList * +impl_list_cookies (EphyCookieManager *manager) +{ + return NULL; +} + +static void +impl_remove_cookie (EphyCookieManager *manager, + const EphyCookie *cookie) +{ +} + +static void +impl_clear_cookies (EphyCookieManager *manager) +{ +} + +static GList * +impl_list_passwords (EphyPasswordManager *manager) +{ + return NULL; +} + +static void +impl_remove_password (EphyPasswordManager *manager, + EphyPasswordInfo *info) +{ +} + +static void +impl_add_password (EphyPasswordManager *manager, + EphyPasswordInfo *info) +{ +} + +static void +impl_permission_manager_add (EphyPermissionManager *manager, + const char *host, + const char *type, + EphyPermission permission) +{ +} + +static void +impl_permission_manager_remove (EphyPermissionManager *manager, + const char *host, + const char *type) +{ +} + +static void +impl_permission_manager_clear (EphyPermissionManager *manager) +{ +} + +EphyPermission +impl_permission_manager_test (EphyPermissionManager *manager, + const char *host, + const char *type) +{ + g_return_val_if_fail (type != NULL && type[0] != '\0', EPHY_PERMISSION_DEFAULT); + + return (EphyPermission)0; +} + +static gboolean +impl_init (EphyEmbedSingle *esingle) +{ + return TRUE; +} + +GList * +impl_permission_manager_list (EphyPermissionManager *manager, + const char *type) +{ + GList *list = NULL; + return list; +} + +static GtkWidget * +impl_open_window (EphyEmbedSingle *single, + EphyEmbed *parent, + const char *address, + const char *name, + const char *features) +{ + return NULL; +} + +#ifdef ENABLE_CERTIFICATE_MANAGER + +static gboolean +impl_remove_certificate (EphyCertificateManager *manager, + EphyX509Cert *cert) +{ + return TRUE; +} + +#define NICK_DELIMITER PRUnichar('\001') +static GList * +impl_get_certificates (EphyCertificateManager *manager, + EphyX509CertType type) +{ + return NULL; +} + +static gboolean +impl_import (EphyCertificateManager *manager, + const gchar *file) +{ + return TRUE; +} + +#endif /* ENABLE_CERTIFICATE_MANAGER */ + +static void +webkit_embed_single_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EphyEmbedSingle *single = EPHY_EMBED_SINGLE (object); + + switch (prop_id) + { + case PROP_NETWORK_STATUS: + g_value_set_boolean (value, ephy_embed_single_get_network_status (single)); + break; + } +} + +static void +webkit_embed_single_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + EphyEmbedSingle *single = EPHY_EMBED_SINGLE (object); + + switch (prop_id) + { + case PROP_NETWORK_STATUS: + ephy_embed_single_set_network_status (single, g_value_get_boolean (value)); + break; + } +} +static void +webkit_embed_single_class_init (WebkitEmbedSingleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + webkit_embed_single_parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + + object_class->dispose = webkit_embed_single_dispose; + object_class->finalize = webkit_embed_single_finalize; + object_class->get_property = webkit_embed_single_get_property; + object_class->set_property = webkit_embed_single_set_property; + + g_object_class_override_property (object_class, PROP_NETWORK_STATUS, "network-status"); + + g_type_class_add_private (object_class, sizeof (WebkitEmbedSinglePrivate)); +} + +static void +ephy_embed_single_iface_init (EphyEmbedSingleIface *iface) +{ + iface->init = impl_init; + iface->clear_cache = impl_clear_cache; + iface->clear_auth_cache = impl_clear_auth_cache; + iface->set_network_status = impl_set_network_status; + iface->get_network_status = impl_get_network_status; + iface->get_font_list = impl_get_font_list; + iface->open_window = impl_open_window; + iface->get_backend_name = impl_get_backend_name; +} + +static void +ephy_cookie_manager_iface_init (EphyCookieManagerIface *iface) +{ + iface->list = impl_list_cookies; + iface->remove = impl_remove_cookie; + iface->clear = impl_clear_cookies; +} + +static void +ephy_password_manager_iface_init (EphyPasswordManagerIface *iface) +{ + iface->add = impl_add_password; + iface->remove = impl_remove_password; + iface->list = impl_list_passwords; +} + +static void +ephy_permission_manager_iface_init (EphyPermissionManagerIface *iface) +{ + iface->add = impl_permission_manager_add; + iface->remove = impl_permission_manager_remove; + iface->clear = impl_permission_manager_clear; + iface->test = impl_permission_manager_test; + iface->list = impl_permission_manager_list; +} + +#ifdef ENABLE_CERTIFICATE_MANAGER + +static void +ephy_certificate_manager_iface_init (EphyCertificateManagerIface *iface) +{ + iface->get_certificates = impl_get_certificates; + iface->remove_certificate = impl_remove_certificate; + iface->import = impl_import; +} + +#endif /* ENABLE_CERTIFICATE_MANAGER */ diff --git a/embed/webkit/webkit-embed-single.h b/embed/webkit/webkit-embed-single.h new file mode 100644 index 000000000..5dcaf2444 --- /dev/null +++ b/embed/webkit/webkit-embed-single.h @@ -0,0 +1,57 @@ +/* + * Copyright © 2000-2003 Marco Pesenti Gritti + * Copyright © 2003 Christian Persch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_SINGLE_H +#define WEBKIT_EMBED_SINGLE_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED_SINGLE (webkit_embed_single_get_type ()) +#define WEBKIT_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSingle)) +#define WEBKIT_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSingleClass)) +#define WEBKIT_IS_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED_SINGLE)) +#define WEBKIT_IS_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED_SINGLE)) +#define WEBKIT_EMBED_SINGLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED_SINGLE, WebkitEmbedSingleClass)) + +typedef struct WebkitEmbedSingle WebkitEmbedSingle; +typedef struct WebkitEmbedSingleClass WebkitEmbedSingleClass; +typedef struct WebkitEmbedSinglePrivate WebkitEmbedSinglePrivate; + +struct WebkitEmbedSingle +{ + GObject parent; + + /*< private >*/ + WebkitEmbedSinglePrivate *priv; +}; + +struct WebkitEmbedSingleClass +{ + GObjectClass parent_class; +}; + +GType webkit_embed_single_get_type (void); + +G_END_DECLS + +#endif diff --git a/embed/webkit/webkit-embed.cpp b/embed/webkit/webkit-embed.cpp new file mode 100644 index 000000000..009706b3e --- /dev/null +++ b/embed/webkit/webkit-embed.cpp @@ -0,0 +1,441 @@ +/* + * Copyright © 2007 Xan Lopez + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "config.h" + +#include "ephy-command-manager.h" +#include "ephy-debug.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-single.h" +#include "ephy-string.h" +#include "ephy-embed-event.h" + +#include <webkitgtkpage.h> +#include <webkitgtkglobal.h> +#include <string.h> + +#include "webkit-embed.h" +#include "ephy-embed.h" + +static void webkit_embed_class_init (WebkitEmbedClass *klass); +static void webkit_embed_init (WebkitEmbed *gs); +static void webkit_embed_destroy (GtkObject *object); +static void webkit_embed_finalize (GObject *object); +static void ephy_embed_iface_init (EphyEmbedIface *iface); + +#if 0 +static void webkit_embed_location_changed_cb (GtkMozEmbed *embed, + WebkitEmbed *membed); +static void webkit_embed_net_state_all_cb (GtkMozEmbed *embed, + const char *aURI, + gint state, + guint status, + WebkitEmbed *membed); +static gboolean webkit_embed_dom_mouse_click_cb(GtkMozEmbed *embed, + gpointer dom_event, + WebkitEmbed *membed); +static gboolean webkit_embed_dom_mouse_down_cb (GtkMozEmbed *embed, + + + WebkitEmbed *membed); +static gboolean webkit_embed_dom_key_press_cb (GtkMozEmbed *embed, + gpointer dom_event, + WebkitEmbed *membed); +static void webkit_embed_new_window_cb (GtkMozEmbed *embed, + GtkMozEmbed **newEmbed, + guint chrome_mask, + WebkitEmbed *membed); +#endif + +#define WEBKIT_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED, WebkitEmbedPrivate)) + +typedef enum + { + WEBKIT_EMBED_LOAD_STARTED, + WEBKIT_EMBED_LOAD_REDIRECTING, + WEBKIT_EMBED_LOAD_LOADING, + WEBKIT_EMBED_LOAD_STOPPED + } WebkitEmbedLoadState; + +struct WebkitEmbedPrivate +{ + WebKitGtkPage *page; + WebkitEmbedLoadState load_state; +}; + +static void +impl_manager_do_command (EphyCommandManager *manager, + const char *command) +{ +} + +static gboolean +impl_manager_can_do_command (EphyCommandManager *manager, + const char *command) +{ +} + +static void +ephy_command_manager_iface_init (EphyCommandManagerIface *iface) +{ + iface->do_command = impl_manager_do_command; + iface->can_do_command = impl_manager_can_do_command; +} + +G_DEFINE_TYPE_WITH_CODE (WebkitEmbed, webkit_embed, GTK_TYPE_SCROLLED_WINDOW, + G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED, + ephy_embed_iface_init) + G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER, + ephy_command_manager_iface_init)) + +static void +webkit_embed_grab_focus (GtkWidget *widget) +{ +} + +static void +impl_close (EphyEmbed *embed) +{ +} + +static void +webkit_embed_class_init (WebkitEmbedClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + webkit_embed_parent_class = (GObjectClass *) g_type_class_peek_parent (klass); + + object_class->finalize = webkit_embed_finalize; + + gtk_object_class->destroy = webkit_embed_destroy; + + widget_class->grab_focus = webkit_embed_grab_focus; + + g_type_class_add_private (object_class, sizeof(WebkitEmbedPrivate)); +} + +static void +webkit_embed_init (WebkitEmbed *embed) +{ + WebKitGtkPage *page; + + embed->priv = WEBKIT_EMBED_GET_PRIVATE (embed); + + gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (embed), NULL); + gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (embed), NULL); + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (embed), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + webkit_gtk_init (); + page = WEBKIT_GTK_PAGE (webkit_gtk_page_new ()); + embed->priv->page = page; + gtk_container_add (GTK_CONTAINER (embed), GTK_WIDGET (page)); + gtk_widget_show (GTK_WIDGET (page)); + +#if 0 + g_signal_connect (G_OBJECT (page), "title-changed", + G_CALLBACK (title_changed_cb), page); + g_signal_connect (G_OBJECT (page), "load-progress-changed", + G_CALLBACK (load_progress_changed), page); +#endif +} + +static void +webkit_embed_destroy (GtkObject *object) +{ + GTK_OBJECT_CLASS (webkit_embed_parent_class)->destroy (object); +} + +static void +webkit_embed_finalize (GObject *object) +{ + G_OBJECT_CLASS (webkit_embed_parent_class)->finalize (object); +} + +static void +impl_load_url (EphyEmbed *embed, + const char *url) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + g_debug ("a url %s", url); + + webkit_gtk_page_open (wembed->priv->page, url); +} + +static char * impl_get_location (EphyEmbed *embed, gboolean toplevel); + +static void +impl_load (EphyEmbed *embed, + const char *url, + EphyEmbedLoadFlags flags, + EphyEmbed *preview_embed) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + g_debug ("url %s", url); + webkit_gtk_page_open (wembed->priv->page, url); +} + +static void +impl_stop_load (EphyEmbed *embed) +{ +} + +static gboolean +impl_can_go_back (EphyEmbed *embed) +{ + return FALSE; +} + +static gboolean +impl_can_go_forward (EphyEmbed *embed) +{ + return FALSE; +} + +static GSList * +impl_get_go_up_list (EphyEmbed *embed) +{ + return NULL; +} + +static void +impl_go_back (EphyEmbed *embed) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + webkit_gtk_page_go_backward (wembed->priv->page); +} + +static void +impl_go_forward (EphyEmbed *embed) +{ + WebkitEmbed *wembed = WEBKIT_EMBED (embed); + + webkit_gtk_page_go_forward (wembed->priv->page); +} + +static void +impl_go_up (EphyEmbed *embed) +{ +} + +static char * +impl_get_title (EphyEmbed *embed) +{ + return NULL; +} + +static char * +impl_get_link_message (EphyEmbed *embed) +{ + return NULL; +} + +static char * +impl_get_js_status (EphyEmbed *embed) +{ + return NULL; +} + +static char * +impl_get_location (EphyEmbed *embed, + gboolean toplevel) +{ + return NULL; +} + +static void +impl_reload (EphyEmbed *embed, + gboolean force) +{ +} + +static void +impl_set_zoom (EphyEmbed *embed, + float zoom) +{ +} + +static float +impl_get_zoom (EphyEmbed *embed) +{ + return 0.0; +} + +static void +impl_scroll_lines (EphyEmbed *embed, + int num_lines) +{ +} + +static void +impl_scroll_pages (EphyEmbed *embed, + int num_pages) +{ +} + +static void +impl_scroll_pixels (EphyEmbed *embed, + int dx, + int dy) +{ +} + +static int +impl_shistory_n_items (EphyEmbed *embed) +{ + return 0; +} + +static void +impl_shistory_get_nth (EphyEmbed *embed, + int nth, + gboolean is_relative, + char **aUrl, + char **aTitle) +{ + *aUrl = NULL; + *aTitle = NULL; +} + +static int +impl_shistory_get_pos (EphyEmbed *embed) +{ + return 0; +} + +static void +impl_shistory_go_nth (EphyEmbed *embed, + int nth) +{ +} + +static void +impl_shistory_copy (EphyEmbed *source, + EphyEmbed *dest, + gboolean copy_back, + gboolean copy_forward, + gboolean copy_current) +{ +} + +static void +impl_get_security_level (EphyEmbed *embed, + EphyEmbedSecurityLevel *level, + char **description) +{ + if (level) *level = EPHY_EMBED_STATE_IS_UNKNOWN; +} + +static void +impl_show_page_certificate (EphyEmbed *embed) +{ +} + +static void +impl_print (EphyEmbed *embed) +{ +} + +static void +impl_set_print_preview_mode (EphyEmbed *embed, gboolean preview_mode) +{ +} + +static int +impl_print_preview_n_pages (EphyEmbed *embed) +{ + return 0; +} + +static void +impl_print_preview_navigate (EphyEmbed *embed, + EphyEmbedPrintPreviewNavType type, + int page) +{ +} + +static void +impl_set_encoding (EphyEmbed *embed, + const char *encoding) +{ +} + +static char * +impl_get_encoding (EphyEmbed *embed) +{ + return NULL; +} + +static gboolean +impl_has_automatic_encoding (EphyEmbed *embed) +{ + return FALSE; +} + +static gboolean +impl_has_modified_forms (EphyEmbed *embed) +{ +} + +static void +ephy_embed_iface_init (EphyEmbedIface *iface) +{ + iface->load_url = impl_load_url; + iface->load = impl_load; + iface->stop_load = impl_stop_load; + iface->can_go_back = impl_can_go_back; + iface->can_go_forward = impl_can_go_forward; + // iface->can_go_up = impl_can_go_up; + iface->get_go_up_list = impl_get_go_up_list; + iface->go_back = impl_go_back; + iface->go_forward = impl_go_forward; + iface->go_up = impl_go_up; + iface->get_title = impl_get_title; + iface->get_location = impl_get_location; + iface->get_link_message = impl_get_link_message; + iface->get_js_status = impl_get_js_status; + iface->reload = impl_reload; + iface->set_zoom = impl_set_zoom; + iface->get_zoom = impl_get_zoom; + iface->scroll_lines = impl_scroll_lines; + iface->scroll_pages = impl_scroll_pages; + iface->scroll_pixels = impl_scroll_pixels; + iface->shistory_n_items = impl_shistory_n_items; + iface->shistory_get_nth = impl_shistory_get_nth; + iface->shistory_get_pos = impl_shistory_get_pos; + iface->shistory_go_nth = impl_shistory_go_nth; + iface->shistory_copy = impl_shistory_copy; + iface->get_security_level = impl_get_security_level; + iface->show_page_certificate = impl_show_page_certificate; + iface->close = impl_close; + iface->set_encoding = impl_set_encoding; + iface->get_encoding = impl_get_encoding; + iface->has_automatic_encoding = impl_has_automatic_encoding; + iface->print = impl_print; + iface->set_print_preview_mode = impl_set_print_preview_mode; + iface->print_preview_n_pages = impl_print_preview_n_pages; + iface->print_preview_navigate = impl_print_preview_navigate; + iface->has_modified_forms = impl_has_modified_forms; +} diff --git a/embed/webkit/webkit-embed.h b/embed/webkit/webkit-embed.h new file mode 100644 index 000000000..ee25bf444 --- /dev/null +++ b/embed/webkit/webkit-embed.h @@ -0,0 +1,59 @@ +/* + * Copyright © 2007 Xan Lopez + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef WEBKIT_EMBED_H +#define WEBKIT_EMBED_H + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> +#include "ephy-embed.h" + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_EMBED (webkit_embed_get_type ()) +#define WEBKIT_EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), WEBKIT_TYPE_EMBED, WebkitEmbed)) +#define WEBKIT_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), WEBKIT_TYPE_EMBED, WebkitEmbedClass)) +#define WEBKIT_IS_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), WEBKIT_TYPE_EMBED)) +#define WEBKIT_IS_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), WEBKIT_TYPE_EMBED)) +#define WEBKIT_EMBED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), WEBKIT_TYPE_EMBED, WebkitEmbedClass)) + +typedef struct WebkitEmbedClass WebkitEmbedClass; +typedef struct WebkitEmbed WebkitEmbed; +typedef struct WebkitEmbedPrivate WebkitEmbedPrivate; + +struct WebkitEmbed +{ + GtkScrolledWindow parent; + + /*< private >*/ + WebkitEmbedPrivate *priv; +}; + +struct WebkitEmbedClass +{ + GtkScrolledWindowClass parent_class; +}; + +GType webkit_embed_get_type (void); + +G_END_DECLS + +#endif diff --git a/src/Makefile.am b/src/Makefile.am index ff3bdfdfb..214b813b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -153,14 +153,14 @@ libpyphany_la_CPPFLAGS = \ -I$(top_srcdir)/lib/widgets \ -I$(top_srcdir)/lib/egg \ -I$(top_srcdir)/embed \ - -I$(top_srcdir)/embed/mozilla \ + -I$(top_srcdir)/embed/$(with_engine) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/bookmarks \ -I$(top_builddir)/lib \ -I$(top_builddir)/lib/widgets \ -I$(top_builddir)/lib/egg \ -I$(top_builddir)/embed \ - -I$(top_builddir)/embed/mozilla \ + -I$(top_builddir)/embed/$(with_engine) \ -I$(top_builddir)/src \ -I$(top_builddir)/src/bookmarks \ $(PYTHON_INCLUDES) \ @@ -203,20 +203,44 @@ epiphany_CFLAGS = \ $(DBUS_CFLAGS) \ $(AM_CFLAGS) -epiphany_LDFLAGS = -R$(GECKO_HOME) -dlopen self +epiphany_LDFLAGS = -dlopen self epiphany_LDADD = \ libephymain.la \ $(top_builddir)/src/bookmarks/libephybookmarks.la \ - $(top_builddir)/embed/libephyembedfactory.la \ - $(top_builddir)/embed/mozilla/libephymozillaembed.la \ + $(top_builddir)/embed/libephyembedfactory.la + +if WITH_GECKO_ENGINE +epiphany_LDADD += \ + $(top_builddir)/embed/mozilla/libephymozillaembed.la +endif + +if WITH_WEBKIT_ENGINE +epiphany_LDADD += \ + $(top_builddir)/embed/webkit/libephywebkitembed.la +endif + +epiphany_LDADD += \ $(top_builddir)/embed/libephyembed.la \ $(top_builddir)/lib/widgets/libephywidgets.la \ $(top_builddir)/lib/libephymisc.la \ - $(top_builddir)/lib/egg/libegg.la \ + $(top_builddir)/lib/egg/libegg.la + +if WITH_GECKO_ENGINE +epiphany_LDFLAGS += -R$(GECKO_HOME) + +epiphany_LDADD += \ $(GECKO_LIBS) \ $(GECKO_EXTRA_LIBS) \ - $(GECKO_GLUE_LIBS) \ + $(GECKO_GLUE_LIBS) +endif + +if WITH_WEBKIT_ENGINE +epiphany_LDADD += \ + $(WEBKIT_LIBS) +endif + +epiphany_LDADD += \ $(DEPENDENCIES_LIBS) \ $(DBUS_LIBS) \ $(LIBINTL) |