diff options
author | Xan Lopez <xan@gnome.org> | 2009-06-05 23:40:11 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-06-05 23:40:11 +0800 |
commit | b8fa1b0cc55b60a0363a0cbe82e01e0d55e36e63 (patch) | |
tree | b9f1e67d0884f03b3b33f73164267b7c0dc2c0a4 | |
parent | 8f3aa835aa3fb12e8f9805c3ecb454027398102c (diff) | |
download | gsoc2013-epiphany-b8fa1b0cc55b60a0363a0cbe82e01e0d55e36e63.tar.gz gsoc2013-epiphany-b8fa1b0cc55b60a0363a0cbe82e01e0d55e36e63.tar.zst gsoc2013-epiphany-b8fa1b0cc55b60a0363a0cbe82e01e0d55e36e63.zip |
Change EphyEmbed to not be an interface type.
Holds the code that used to be in WebKitEmbed, which is now dead.
-rw-r--r-- | embed/Makefile.am | 5 | ||||
-rw-r--r-- | embed/ephy-embed-factory.c | 3 | ||||
-rw-r--r-- | embed/ephy-embed-utils.h | 2 | ||||
-rw-r--r-- | embed/ephy-embed.c (renamed from embed/webkit/webkit-embed.c) | 88 | ||||
-rw-r--r-- | embed/ephy-embed.h | 59 | ||||
-rw-r--r-- | embed/ephy-web-view.h | 2 | ||||
-rw-r--r-- | embed/webkit-embed-prefs.c (renamed from embed/webkit/webkit-embed-prefs.c) | 4 | ||||
-rw-r--r-- | embed/webkit-embed-prefs.h (renamed from embed/webkit/webkit-embed-prefs.h) | 4 | ||||
-rw-r--r-- | embed/webkit/Makefile.am | 4 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.h | 58 |
10 files changed, 110 insertions, 119 deletions
diff --git a/embed/Makefile.am b/embed/Makefile.am index 8164a9bb0..ebbdd26df 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -58,8 +58,9 @@ libephyembed_la_SOURCES = \ ephy-history.c \ ephy-password-manager.c \ ephy-permission-manager.c \ - ephy-web-view.c - + ephy-web-view.c \ + webkit-embed-prefs.c \ + webkit-embed-prefs.h \ $(INST_H_FILES) \ $(NOINST_H_FILES) diff --git a/embed/ephy-embed-factory.c b/embed/ephy-embed-factory.c index 4c4488ad5..3fa881837 100644 --- a/embed/ephy-embed-factory.c +++ b/embed/ephy-embed-factory.c @@ -20,7 +20,6 @@ #include "config.h" #include "ephy-embed-factory.h" -#include "webkit-embed.h" #include "webkit-embed-persist.h" #include "webkit-embed-single.h" #include "ephy-embed.h" @@ -42,7 +41,7 @@ ephy_embed_factory_new_object (GType type) if (type == EPHY_TYPE_EMBED) { - object = g_object_new (WEBKIT_TYPE_EMBED, NULL); + object = g_object_new (EPHY_TYPE_EMBED, NULL); } else if (type == EPHY_TYPE_EMBED_PERSIST) { diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h index 226eff3f7..d9b63b1a1 100644 --- a/embed/ephy-embed-utils.h +++ b/embed/ephy-embed-utils.h @@ -29,7 +29,7 @@ #ifndef EPHY_EMBED_UTILS_H #define EPHY_EMBED_UTILS_H -#include "ephy-embed.h" +#include "ephy-web-view.h" #include <webkit/webkit.h> diff --git a/embed/webkit/webkit-embed.c b/embed/ephy-embed.c index cff761572..ad0a9f5f6 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/ephy-embed.c @@ -48,29 +48,28 @@ #include <string.h> #include <glib/gi18n.h> -#include "webkit-embed.h" #include "webkit-embed-prefs.h" #include "ephy-embed.h" #include "ephy-base-embed.h" -static void webkit_embed_class_init (WebKitEmbedClass *klass); -static void webkit_embed_init (WebKitEmbed *gs); +static void ephy_embed_class_init (EphyEmbedClass *klass); +static void ephy_embed_init (EphyEmbed *gs); -#define WEBKIT_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), WEBKIT_TYPE_EMBED, WebKitEmbedPrivate)) +#define EPHY_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED, EphyEmbedPrivate)) typedef enum { - WEBKIT_EMBED_LOAD_STARTED, - WEBKIT_EMBED_LOAD_REDIRECTING, - WEBKIT_EMBED_LOAD_LOADING, - WEBKIT_EMBED_LOAD_STOPPED -} WebKitEmbedLoadState; + EPHY_EMBED_LOAD_STARTED, + EPHY_EMBED_LOAD_REDIRECTING, + EPHY_EMBED_LOAD_LOADING, + EPHY_EMBED_LOAD_STOPPED +} EphyEmbedLoadState; -struct WebKitEmbedPrivate +struct EphyEmbedPrivate { WebKitWebView *web_view; GtkScrolledWindow *scrolled_window; - WebKitEmbedLoadState load_state; + EphyEmbedLoadState load_state; EphyHistory *history; GtkWidget *inspector_window; guint is_setting_zoom : 1; @@ -80,7 +79,7 @@ static void impl_manager_do_command (EphyCommandManager *manager, const char *command) { - WebKitWebView *web_view = WEBKIT_EMBED (manager)->priv->web_view; + WebKitWebView *web_view = EPHY_EMBED (manager)->priv->web_view; if (! strcmp (command, "cmd_copy")) return webkit_web_view_copy_clipboard (web_view); @@ -96,7 +95,7 @@ static gboolean impl_manager_can_do_command (EphyCommandManager *manager, const char *command) { - WebKitWebView *web_view = WEBKIT_EMBED (manager)->priv->web_view; + WebKitWebView *web_view = EPHY_EMBED (manager)->priv->web_view; if (! strcmp (command, "cmd_copy")) return webkit_web_view_can_copy_clipboard (web_view); @@ -115,14 +114,7 @@ ephy_command_manager_iface_init (EphyCommandManagerIface *iface) iface->can_do_command = impl_manager_can_do_command; } -static void -ephy_embed_iface_init (EphyEmbedIface *iface) -{ -} - -G_DEFINE_TYPE_WITH_CODE (WebKitEmbed, webkit_embed, EPHY_TYPE_BASE_EMBED, - G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED, - ephy_embed_iface_init) +G_DEFINE_TYPE_WITH_CODE (EphyEmbed, ephy_embed, EPHY_TYPE_BASE_EMBED, G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER, ephy_command_manager_iface_init)) @@ -142,7 +134,7 @@ title_changed_cb (WebKitWebView *web_view, frame = webkit_web_view_get_main_frame (web_view); uri = webkit_web_frame_get_uri (frame); - ephy_history_set_page_title (WEBKIT_EMBED (embed)->priv->history, + ephy_history_set_page_title (EPHY_EMBED (embed)->priv->history, uri, title); g_free (title); @@ -150,12 +142,12 @@ title_changed_cb (WebKitWebView *web_view, } static void -update_load_state (WebKitEmbed *embed, WebKitWebView *web_view) +update_load_state (EphyEmbed *embed, WebKitWebView *web_view) { EphyWebViewNetState estate = EPHY_WEB_VIEW_STATE_UNKNOWN; const char *loading_uri = ephy_web_view_get_typed_address (EPHY_WEB_VIEW (web_view)); - if (embed->priv->load_state == WEBKIT_EMBED_LOAD_STARTED) + if (embed->priv->load_state == EPHY_EMBED_LOAD_STARTED) { estate = (EphyWebViewNetState) (estate | EPHY_WEB_VIEW_STATE_START | @@ -166,13 +158,13 @@ update_load_state (WebKitEmbed *embed, WebKitWebView *web_view) g_signal_emit_by_name (EPHY_WEB_VIEW (web_view), "new-document-now", loading_uri); } - if (embed->priv->load_state == WEBKIT_EMBED_LOAD_LOADING) + if (embed->priv->load_state == EPHY_EMBED_LOAD_LOADING) estate = (EphyWebViewNetState) (estate | EPHY_WEB_VIEW_STATE_TRANSFERRING | EPHY_WEB_VIEW_STATE_IS_REQUEST | EPHY_WEB_VIEW_STATE_IS_NETWORK); - if (embed->priv->load_state == WEBKIT_EMBED_LOAD_STOPPED) + if (embed->priv->load_state == EPHY_EMBED_LOAD_STOPPED) estate = (EphyWebViewNetState) (estate | EPHY_WEB_VIEW_STATE_STOP | EPHY_WEB_VIEW_STATE_IS_DOCUMENT | @@ -184,10 +176,10 @@ update_load_state (WebKitEmbed *embed, WebKitWebView *web_view) } static void -restore_zoom_level (WebKitEmbed *embed, +restore_zoom_level (EphyEmbed *embed, const char *address) { - WebKitEmbedPrivate *priv = embed->priv; + EphyEmbedPrivate *priv = embed->priv; /* restore zoom level */ if (ephy_embed_utils_address_has_web_scheme (address)) { @@ -223,7 +215,7 @@ restore_zoom_level (WebKitEmbed *embed, static void load_committed_cb (WebKitWebView *web_view, WebKitWebFrame *web_frame, - WebKitEmbed *embed) + EphyEmbed *embed) { const gchar* uri; EphyWebViewSecurityLevel security_level; @@ -256,8 +248,8 @@ load_started_cb (WebKitWebView *web_view, WebKitWebFrame *web_frame, EphyEmbed *embed) { - WebKitEmbed *wembed = WEBKIT_EMBED (embed); - wembed->priv->load_state = WEBKIT_EMBED_LOAD_STARTED; + EphyEmbed *wembed = EPHY_EMBED (embed); + wembed->priv->load_state = EPHY_EMBED_LOAD_STARTED; update_load_state (wembed, web_view); } @@ -267,10 +259,10 @@ load_progress_changed_cb (WebKitWebView *web_view, int progress, EphyEmbed *embed) { - WebKitEmbed *wembed = WEBKIT_EMBED (embed); + EphyEmbed *wembed = EPHY_EMBED (embed); - if (wembed->priv->load_state == WEBKIT_EMBED_LOAD_STARTED) - wembed->priv->load_state = WEBKIT_EMBED_LOAD_LOADING; + if (wembed->priv->load_state == EPHY_EMBED_LOAD_STARTED) + wembed->priv->load_state = EPHY_EMBED_LOAD_LOADING; ephy_web_view_set_load_percent (EPHY_WEB_VIEW (web_view), progress); } @@ -280,9 +272,9 @@ load_finished_cb (WebKitWebView *web_view, WebKitWebFrame *web_frame, EphyEmbed *embed) { - WebKitEmbed *wembed = WEBKIT_EMBED (embed); + EphyEmbed *wembed = EPHY_EMBED (embed); - wembed->priv->load_state = WEBKIT_EMBED_LOAD_STOPPED; + wembed->priv->load_state = EPHY_EMBED_LOAD_STOPPED; update_load_state (wembed, web_view); } @@ -307,7 +299,7 @@ zoom_changed_cb (WebKitWebView *web_view, "zoom-level", &zoom, NULL); - if (WEBKIT_EMBED (embed)->priv->is_setting_zoom) { + if (EPHY_EMBED (embed)->priv->is_setting_zoom) { return; } @@ -330,13 +322,13 @@ zoom_changed_cb (WebKitWebView *web_view, } static void -webkit_embed_class_init (WebKitEmbedClass *klass) +ephy_embed_class_init (EphyEmbedClass *klass) { - g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(WebKitEmbedPrivate)); + g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(EphyEmbedPrivate)); } static WebKitWebView * -webkit_embed_inspect_web_view_cb (WebKitWebInspector *inspector, +ephy_embed_inspect_web_view_cb (WebKitWebInspector *inspector, WebKitWebView *web_view, gpointer data) { @@ -352,7 +344,7 @@ webkit_embed_inspect_web_view_cb (WebKitWebInspector *inspector, } static gboolean -webkit_embed_inspect_show_cb (WebKitWebInspector *inspector, +ephy_embed_inspect_show_cb (WebKitWebInspector *inspector, GtkWidget *widget) { gtk_widget_show (widget); @@ -360,7 +352,7 @@ webkit_embed_inspect_show_cb (WebKitWebInspector *inspector, } static gboolean -webkit_embed_inspect_close_cb (WebKitWebInspector *inspector, +ephy_embed_inspect_close_cb (WebKitWebInspector *inspector, GtkWidget *widget) { gtk_widget_hide (widget); @@ -373,7 +365,7 @@ mime_type_policy_decision_requested_cb (WebKitWebView *web_view, WebKitNetworkRequest *request, const char *mime_type, WebKitWebPolicyDecision *decision, - WebKitEmbed *embed) + EphyEmbed *embed) { EphyWebViewDocumentType type; @@ -704,14 +696,14 @@ download_requested_cb (WebKitWebView *web_view, } static void -webkit_embed_init (WebKitEmbed *embed) +ephy_embed_init (EphyEmbed *embed) { WebKitWebView *web_view; WebKitWebInspector *inspector; GtkWidget *sw; GtkWidget *inspector_sw; - embed->priv = WEBKIT_EMBED_GET_PRIVATE (embed); + embed->priv = EPHY_EMBED_GET_PRIVATE (embed); sw = gtk_scrolled_window_new (NULL, NULL); embed->priv->scrolled_window = GTK_SCROLLED_WINDOW (sw); @@ -757,11 +749,11 @@ webkit_embed_init (WebKitEmbed *embed) NULL); g_object_connect (inspector, - "signal::inspect-web-view", G_CALLBACK (webkit_embed_inspect_web_view_cb), + "signal::inspect-web-view", G_CALLBACK (ephy_embed_inspect_web_view_cb), inspector_sw, - "signal::show-window", G_CALLBACK (webkit_embed_inspect_show_cb), + "signal::show-window", G_CALLBACK (ephy_embed_inspect_show_cb), embed->priv->inspector_window, - "signal::close-window", G_CALLBACK (webkit_embed_inspect_close_cb), + "signal::close-window", G_CALLBACK (ephy_embed_inspect_close_cb), embed->priv->inspector_window, NULL); diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h new file mode 100644 index 000000000..9de9f70d2 --- /dev/null +++ b/embed/ephy-embed.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ +/* + * Copyright © 2007 Xan Lopez + * Copyright © 2009 Igalia S.L. + * + * 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. + * + */ + +#ifndef EPHY_EMBED_H +#define EPHY_EMBED_H + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "ephy-web-view.h" + +G_BEGIN_DECLS + +#define EPHY_TYPE_EMBED (ephy_embed_get_type ()) +#define EPHY_EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED, EphyEmbed)) +#define EPHY_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_EMBED, EphyEmbedClass)) +#define EPHY_IS_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED)) +#define EPHY_IS_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED)) +#define EPHY_EMBED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED, EphyEmbedClass)) + +typedef struct EphyEmbedClass EphyEmbedClass; +typedef struct EphyEmbed EphyEmbed; +typedef struct EphyEmbedPrivate EphyEmbedPrivate; + +struct EphyEmbed { + GtkBin parent_instance; + + /*< private >*/ + EphyEmbedPrivate *priv; +}; + +struct EphyEmbedClass { + GtkBinClass parent_class; +}; + +GType ephy_embed_get_type (void); + +G_END_DECLS + +#endif diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h index b804670a0..ed8b7a4dd 100644 --- a/embed/ephy-web-view.h +++ b/embed/ephy-web-view.h @@ -30,6 +30,8 @@ #include <gtk/gtk.h> #include <webkit/webkit.h> +#include "ephy-embed-event.h" + G_BEGIN_DECLS #define EPHY_TYPE_WEB_VIEW (ephy_web_view_get_type ()) diff --git a/embed/webkit/webkit-embed-prefs.c b/embed/webkit-embed-prefs.c index df0eeaa93..bcddd9523 100644 --- a/embed/webkit/webkit-embed-prefs.c +++ b/embed/webkit-embed-prefs.c @@ -195,7 +195,7 @@ static const PrefData webkit_pref_entries[] = }; static void -webkit_embed_prefs_apply (WebKitEmbed *embed, WebKitWebSettings *settings) +webkit_embed_prefs_apply (EphyEmbed *embed, WebKitWebSettings *settings) { webkit_web_view_set_settings (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed), settings); @@ -234,7 +234,7 @@ webkit_embed_prefs_shutdown (void) } void -webkit_embed_prefs_add_embed (WebKitEmbed *embed) +webkit_embed_prefs_add_embed (EphyEmbed *embed) { webkit_embed_prefs_apply (embed, settings); } diff --git a/embed/webkit/webkit-embed-prefs.h b/embed/webkit-embed-prefs.h index e8cf0c198..37f109bb3 100644 --- a/embed/webkit/webkit-embed-prefs.h +++ b/embed/webkit-embed-prefs.h @@ -20,13 +20,13 @@ #ifndef __WEBKIT_EMBED_PREFS_H__ #define __WEBKIT_EMBED_PREFS_H__ -#include "webkit-embed.h" +#include "ephy-embed.h" G_BEGIN_DECLS void webkit_embed_prefs_init (void); void webkit_embed_prefs_shutdown (void); -void webkit_embed_prefs_add_embed (WebKitEmbed *embed); +void webkit_embed_prefs_add_embed (EphyEmbed *embed); G_END_DECLS diff --git a/embed/webkit/Makefile.am b/embed/webkit/Makefile.am index 33b5b3b42..ca204a8ec 100644 --- a/embed/webkit/Makefile.am +++ b/embed/webkit/Makefile.am @@ -1,12 +1,8 @@ noinst_LTLIBRARIES = libephywebkitembed.la libephywebkitembed_la_SOURCES = \ - webkit-embed.c \ - webkit-embed.h \ webkit-embed-persist.c \ webkit-embed-persist.h \ - webkit-embed-prefs.c \ - webkit-embed-prefs.h \ webkit-embed-single.c \ webkit-embed-single.h diff --git a/embed/webkit/webkit-embed.h b/embed/webkit/webkit-embed.h deleted file mode 100644 index 9060ae5e3..000000000 --- a/embed/webkit/webkit-embed.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ -/* - * 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. - * - */ - -#ifndef WEBKIT_EMBED_H -#define WEBKIT_EMBED_H - -#include <glib.h> -#include <glib-object.h> -#include <gtk/gtk.h> -#include "ephy-embed.h" -#include "ephy-base-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 { - EphyBaseEmbed parent_instance; - - /*< private >*/ - WebKitEmbedPrivate *priv; -}; - -struct WebKitEmbedClass { - EphyBaseEmbedClass parent_class; -}; - -GType webkit_embed_get_type (void); - -G_END_DECLS - -#endif |