Commit b8fa1b0c authored by Xan Lopez's avatar Xan Lopez

Change EphyEmbed to not be an interface type.

Holds the code that used to be in WebKitEmbed, which is now dead.
parent 8f3aa835
......@@ -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)
......
......@@ -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)
{
......
......@@ -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>
......
......@@ -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);
......
/* -*- 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
......@@ -18,40 +19,40 @@
*
*/
#ifndef WEBKIT_EMBED_H
#define WEBKIT_EMBED_H
#ifndef EPHY_EMBED_H
#define EPHY_EMBED_H
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "ephy-embed.h"
#include "ephy-base-embed.h"
#include "ephy-web-view.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))
#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 WebKitEmbedClass WebKitEmbedClass;
typedef struct WebKitEmbed WebKitEmbed;
typedef struct WebKitEmbedPrivate WebKitEmbedPrivate;
typedef struct EphyEmbedClass EphyEmbedClass;
typedef struct EphyEmbed EphyEmbed;
typedef struct EphyEmbedPrivate EphyEmbedPrivate;
struct WebKitEmbed {
EphyBaseEmbed parent_instance;
struct EphyEmbed {
GtkBin parent_instance;
/*< private >*/
WebKitEmbedPrivate *priv;
EphyEmbedPrivate *priv;
};
struct WebKitEmbedClass {
EphyBaseEmbedClass parent_class;
struct EphyEmbedClass {
GtkBinClass parent_class;
};
GType webkit_embed_get_type (void);
GType ephy_embed_get_type (void);
G_END_DECLS
......
......@@ -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 ())
......
......@@ -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);
}
......
......@@ -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
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment