aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2009-01-14 21:31:17 +0800
committerGustavo Noronha Silva <kov@debian.org>2009-05-30 00:15:58 +0800
commit682bbd135a3cde308e5c067892ad43e2dcecb44f (patch)
tree38c2503a0ce25b3b9f38ad85e1fc2f292cf3471b /embed
parent6eb907dcc69c4024bb86227522d6bb394028d670 (diff)
downloadgsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.tar
gsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.tar.gz
gsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.tar.bz2
gsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.tar.lz
gsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.tar.xz
gsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.tar.zst
gsoc2013-epiphany-682bbd135a3cde308e5c067892ad43e2dcecb44f.zip
Adding a new EphyWebView object
This is an object inheriting from WebKitWebView, and will be used to house most of the functionality we move from EphyEmbed.
Diffstat (limited to 'embed')
-rw-r--r--embed/Makefile.am6
-rw-r--r--embed/ephy-web-view.c57
-rw-r--r--embed/ephy-web-view.h65
-rw-r--r--embed/webkit/webkit-embed.c5
4 files changed, 130 insertions, 3 deletions
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 03b33333d..8164a9bb0 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -31,7 +31,9 @@ INST_H_FILES = \
ephy-embed-utils.h \
ephy-history.h \
ephy-password-manager.h \
- ephy-permission-manager.h
+ ephy-permission-manager.h \
+ ephy-web-view.h
+
BUILT_SOURCES = \
ephy-embed-type-builtins.c \
@@ -56,6 +58,8 @@ libephyembed_la_SOURCES = \
ephy-history.c \
ephy-password-manager.c \
ephy-permission-manager.c \
+ ephy-web-view.c
+
$(INST_H_FILES) \
$(NOINST_H_FILES)
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
new file mode 100644
index 000000000..f5a1dbf57
--- /dev/null
+++ b/embed/ephy-web-view.c
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: f; c-basic-offset: 2 -*- */
+/*
+ * Copyright © 2008 Gustavo Noronha Silva
+ *
+ * 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.
+ *
+ */
+
+#include "config.h"
+
+#include "ephy-web-view.h"
+#include "ephy-debug.h"
+
+#include <gtk/gtk.h>
+#include <webkit/webkit.h>
+
+static void ephy_web_view_class_init (EphyWebViewClass *klass);
+static void ephy_web_view_init (EphyWebView *gs);
+
+G_DEFINE_TYPE (EphyWebView, ephy_web_view, WEBKIT_TYPE_WEB_VIEW)
+
+static void
+ephy_web_view_class_init (EphyWebViewClass *klass)
+{
+}
+
+static void
+ephy_web_view_init (EphyWebView *web_view)
+{
+}
+
+/**
+ * ephy_web_view_new:
+ *
+ * Equivalent to g_object_new() but returns an #GtkWidget so you don't have
+ * to cast it when dealing with most code.
+ *
+ * Return value: the newly created #EphyWebView widget
+ **/
+GtkWidget *
+ephy_web_view_new (void)
+{
+ return GTK_WIDGET (g_object_new (EPHY_TYPE_WEB_VIEW, NULL));
+}
+
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
new file mode 100644
index 000000000..3fe9623bc
--- /dev/null
+++ b/embed/ephy-web-view.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2008 Gustavo Noronha Silva
+ *
+ * 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$
+ */
+
+#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
+#error "Only <epiphany/epiphany.h> can be included directly."
+#endif
+
+#ifndef EPHY_WEB_VIEW_H
+#define EPHY_WEB_VIEW_H
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <webkit/webkit.h>
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_WEB_VIEW (ephy_web_view_get_type ())
+#define EPHY_WEB_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_WEB_VIEW, EphyWebView))
+#define EPHY_WEB_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_WEB_VIEW, EphyWebViewClass))
+#define EPHY_IS_WEB_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_WEB_VIEW))
+#define EPHY_IS_WEB_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_WEB_VIEW))
+#define EPHY_WEB_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_WEB_VIEW, EphyWebViewClass))
+
+typedef struct _EphyWebViewClass EphyWebViewClass;
+typedef struct _EphyWebView EphyWebView;
+typedef struct _EphyWebViewPrivate EphyWebViewPrivate;
+
+struct _EphyWebView
+{
+ WebKitWebView parent;
+
+ /*< private >*/
+ EphyWebViewPrivate *priv;
+};
+
+struct _EphyWebViewClass
+{
+ WebKitWebViewClass parent_class;
+};
+
+GType ephy_web_view_get_type (void);
+
+GtkWidget *ephy_web_view_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index 66da62f32..778106ab2 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -41,6 +41,7 @@
#include "ephy-embed-event.h"
#include "ephy-embed-utils.h"
#include "ephy-prefs.h"
+#include "ephy-web-view.h"
#include <webkit/webkit.h>
#include <errno.h>
@@ -352,7 +353,7 @@ webkit_embed_inspect_web_view_cb (WebKitWebInspector *inspector,
GtkWidget *inspector_sw = GTK_WIDGET (data);
GtkWidget *inspector_web_view;
- inspector_web_view = webkit_web_view_new ();
+ inspector_web_view = ephy_web_view_new ();
gtk_container_add (GTK_CONTAINER (inspector_sw), inspector_web_view);
gtk_widget_show_all (gtk_widget_get_toplevel (inspector_sw));
@@ -726,7 +727,7 @@ webkit_embed_init (WebKitEmbed *embed)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
+ web_view = WEBKIT_WEB_VIEW (ephy_web_view_new ());
embed->priv->web_view = web_view;
gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (web_view));
gtk_widget_show (sw);