[epiphany] Remove all WebKit1 code
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Remove all WebKit1 code
- Date: Sun, 8 Dec 2013 11:42:41 +0000 (UTC)
commit 3df6f8c4678f1a0068ed06576180c2e9a4c1629e
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Sun Dec 8 12:40:12 2013 +0100
Remove all WebKit1 code
We are using WebKit2 unconditionally already.
configure.ac | 2 -
embed/ephy-embed-prefs.c | 4 -
embed/ephy-web-view.c | 8 -
lib/ephy-smaps.c | 9 -
lib/ephy-snapshot-service.c | 65 ----
lib/ephy-snapshot-service.h | 4 -
lib/ephy-web-app-utils.c | 18 --
lib/ephy-web-app-utils.h | 5 -
lib/widgets/ephy-download-widget.c | 99 ------
lib/widgets/ephy-hosts-store.c | 79 +-----
lib/widgets/ephy-location-entry.c | 11 -
lib/widgets/ephy-overview-store.h | 4 -
src/Makefile.am | 4 -
src/bookmarks/ephy-bookmark-action.c | 68 +----
src/bookmarks/ephy-bookmarks-editor.c | 75 -----
src/bookmarks/ephy-bookmarks.c | 24 --
src/ephy-completion-model.c | 29 +--
src/ephy-encoding-dialog.c | 35 +--
src/ephy-encoding-menu.c | 23 +--
src/ephy-find-toolbar.c | 216 +-------------
src/ephy-history-window.c | 6 -
src/ephy-navigation-history-action.c | 171 +-----------
src/ephy-notebook.c | 8 -
src/ephy-session.c | 56 +----
src/ephy-shell.c | 31 --
src/ephy-shell.h | 8 -
src/ephy-window.c | 527 ---------------------------------
src/pdm-dialog.c | 199 -------------
src/popup-commands.c | 114 -------
src/popup-commands.h | 6 -
src/resources/epiphany-ui.xml | 11 -
src/window-commands.c | 189 +------------
tests/ephy-session-test.c | 97 ------
tests/ephy-shell-test.c | 38 ---
tests/ephy-test-utils.c | 12 -
tests/ephy-web-view-test.c | 78 +-----
36 files changed, 33 insertions(+), 2300 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7740a5f..22450b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,8 +79,6 @@ GCR_REQUIRED=3.5.5
AVAHI_REQUIRED=0.6.22
WEBKIT_GTK_PC_NAME=webkit2gtk-3.0
-AC_DEFINE([HAVE_WEBKIT2],[1],[Define if building with WebKit2])
-AM_CONDITIONAL(WITH_WEBKIT2, [test "yes" = "yes"])
# Tests
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index e329179..a0cb640 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -199,10 +199,6 @@ webkit_pref_callback_user_agent (GSettings *settings,
"Epiphany", VERSION);
}
-/* This doesn't contain WebKit2 specific API, but it's only used inside
- * HAVE_WEBKIT2 blocks, so it gives a compile warning when building
- * with WebKit1.
- */
static gdouble
get_screen_dpi (GdkScreen *screen)
{
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index d4be61e..f4e0136 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2549,7 +2549,6 @@ ephy_web_view_set_typed_address (EphyWebView *view,
g_object_notify (G_OBJECT (view), "typed-address");
}
-#ifdef HAVE_WEBKIT2
static void
has_modified_forms_cb (GDBusProxy *web_extension,
GAsyncResult *result,
@@ -2567,7 +2566,6 @@ has_modified_forms_cb (GDBusProxy *web_extension,
g_task_return_boolean (task, retval);
g_object_unref (task);
}
-#endif
/**
* ephy_web_view_has_modified_forms:
@@ -2590,7 +2588,6 @@ ephy_web_view_has_modified_forms (EphyWebView *view,
gpointer user_data)
{
GTask *task = g_task_new (view, cancellable, callback, user_data);
-#ifdef HAVE_WEBKIT2
GDBusProxy *web_extension;
web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ());
@@ -2606,11 +2603,6 @@ ephy_web_view_has_modified_forms (EphyWebView *view,
} else {
g_task_return_boolean (task, FALSE);
}
-#else
- WebKitDOMDocument *document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
-
- g_task_return_boolean (task, ephy_web_dom_utils_has_modified_forms (document));
-#endif
g_object_unref (task);
}
diff --git a/lib/ephy-smaps.c b/lib/ephy-smaps.c
index 3484137..9f5acd2 100644
--- a/lib/ephy-smaps.c
+++ b/lib/ephy-smaps.c
@@ -66,7 +66,6 @@ typedef enum {
EPHY_PROCESS_OTHER
} EphyProcess;
-#ifdef HAVE_WEBKIT2
static const char *get_ephy_process_name (EphyProcess process)
{
switch (process) {
@@ -82,7 +81,6 @@ static const char *get_ephy_process_name (EphyProcess process)
return NULL;
}
-#endif
static void vma_free (VMA_t* vma)
{
@@ -306,9 +304,7 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E
g_slist_free (vma_entries);
-#ifdef HAVE_WEBKIT2
g_string_append_printf (str, "<h2>%s</h2>", get_ephy_process_name (process));
-#endif
/* Anon table. */
print_vma_table (str, anon_hash, "Anonymous memory");
@@ -321,7 +317,6 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E
g_hash_table_unref (mapped_hash);
}
-#ifdef HAVE_WEBKIT2
static pid_t get_pid_from_proc_name (const char *name)
{
guint i;
@@ -442,7 +437,6 @@ static void ephy_smaps_pid_children_to_html (EphySMaps *smaps, GString *str, pid
}
g_dir_close (proc);
}
-#endif
char* ephy_smaps_to_html (EphySMaps *smaps)
{
@@ -452,10 +446,7 @@ char* ephy_smaps_to_html (EphySMaps *smaps)
g_string_append (str, "<body>");
ephy_smaps_pid_to_html (smaps, str, pid, EPHY_PROCESS_EPIPHANY);
-
-#ifdef HAVE_WEBKIT2
ephy_smaps_pid_children_to_html (smaps, str, pid);
-#endif
g_string_append (str, "</body>");
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index 797665a..0a4a6f1 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -27,11 +27,7 @@
#define GNOME_DESKTOP_USE_UNSTABLE_API
#endif
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define EPHY_SNAPSHOT_SERVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_SNAPSHOT_SERVICE,
EphySnapshotServicePrivate))
@@ -182,7 +178,6 @@ save_snapshot (cairo_surface_t *surface,
(GAsyncReadyCallback)snapshot_saved, result);
}
-#ifdef HAVE_WEBKIT2
static void
on_snapshot_ready (WebKitWebView *webview,
GAsyncResult *result,
@@ -202,46 +197,22 @@ on_snapshot_ready (WebKitWebView *webview,
save_snapshot (surface, simple);
cairo_surface_destroy (surface);
}
-#endif
static gboolean
retrieve_snapshot_from_web_view (GSimpleAsyncResult *result)
{
-#ifndef HAVE_WEBKIT2
- cairo_surface_t *surface;
-#endif
SnapshotAsyncData *data;
data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result);
-#ifdef HAVE_WEBKIT2
webkit_web_view_get_snapshot (data->web_view,
WEBKIT_SNAPSHOT_REGION_VISIBLE,
WEBKIT_SNAPSHOT_OPTIONS_NONE,
NULL, (GAsyncReadyCallback)on_snapshot_ready,
result);
-#else
- surface = webkit_web_view_get_snapshot (data->web_view);
-
- if (surface == NULL) {
- g_simple_async_result_set_error (result,
- EPHY_SNAPSHOT_SERVICE_ERROR,
- EPHY_SNAPSHOT_SERVICE_ERROR_WEB_VIEW,
- "%s", "Error getting snapshot from web view");
- g_simple_async_result_complete (result);
- g_object_unref (result);
-
- return FALSE;
- }
-
- save_snapshot (surface, result);
- cairo_surface_destroy (surface);
-#endif
-
return FALSE;
}
-#ifdef HAVE_WEBKIT2
static void
webview_load_changed_cb (WebKitWebView *webview,
WebKitLoadEvent load_event,
@@ -277,33 +248,6 @@ webview_load_failed_cb (WebKitWebView *webview,
return FALSE;
}
-#else
-static void
-webview_load_status_changed_cb (WebKitWebView *webview,
- GParamSpec *pspec,
- GSimpleAsyncResult *result)
-{
- switch (webkit_web_view_get_load_status (webview)) {
- case WEBKIT_LOAD_FINISHED:
- /* Load finished doesn't ensure that we actually have visible
- content yet, so hold a bit before retrieving the snapshot. */
- g_idle_add ((GSourceFunc) retrieve_snapshot_from_web_view, result);
- g_signal_handlers_disconnect_by_func (webview, webview_load_status_changed_cb, result);
- break;
- case WEBKIT_LOAD_FAILED:
- g_signal_handlers_disconnect_by_func (webview, webview_load_status_changed_cb, result);
- g_simple_async_result_set_error (result,
- EPHY_SNAPSHOT_SERVICE_ERROR,
- EPHY_SNAPSHOT_SERVICE_ERROR_WEB_VIEW,
- "%s", "Error getting snapshot, web view failed to load");
- g_simple_async_result_complete_in_idle (result);
- g_object_unref (result);
- break;
- default:
- break;
- }
-}
-#endif
static gboolean
ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result)
@@ -312,7 +256,6 @@ ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result)
data = (SnapshotAsyncData *)g_simple_async_result_get_op_res_gpointer (result);
-#ifdef HAVE_WEBKIT2
if (webkit_web_view_get_estimated_load_progress (WEBKIT_WEB_VIEW (data->web_view)) == 1.0)
retrieve_snapshot_from_web_view (result);
else {
@@ -321,14 +264,6 @@ ephy_snapshot_service_take_from_webview (GSimpleAsyncResult *result)
g_signal_connect (data->web_view, "load-failed",
G_CALLBACK (webview_load_failed_cb), result);
}
-#else
- if (webkit_web_view_get_load_status (data->web_view) == WEBKIT_LOAD_FINISHED)
- retrieve_snapshot_from_web_view (result);
- else
- g_signal_connect (data->web_view, "notify::load-status",
- G_CALLBACK (webview_load_status_changed_cb),
- result);
-#endif
return FALSE;
}
diff --git a/lib/ephy-snapshot-service.h b/lib/ephy-snapshot-service.h
index ec34c6b..0250ce6 100644
--- a/lib/ephy-snapshot-service.h
+++ b/lib/ephy-snapshot-service.h
@@ -22,11 +22,7 @@
#define _EPHY_SNAPSHOT_SERVICE_H
#include <gtk/gtk.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#include <glib-object.h>
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 9f23fb8..165e83f 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -27,11 +27,7 @@
#include <glib/gstdio.h>
#include <libsoup/soup.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define EPHY_WEB_APP_DESKTOP_FILE_PREFIX "epiphany-"
@@ -257,7 +253,6 @@ out:
return desktop_file_path;
}
-#ifdef HAVE_WEBKIT2
static SoupCookieJar *get_current_cookie_jar (void)
{
char *filename;
@@ -273,19 +268,6 @@ static SoupCookieJar *get_current_cookie_jar (void)
return jar;
}
-#else
-static SoupCookieJar *get_current_cookie_jar (void)
-{
- SoupSession *session = webkit_get_default_session ();
- SoupCookieJar *jar;
-
- jar = (SoupCookieJar*)soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
-
- /* WebKit might not have a cookie jar yet, if it has not needed one
- * and none has been set by Epiphany. */
- return jar ? g_object_ref (jar) : NULL;
-}
-#endif
static void
create_cookie_jar_for_domain (const char *address, const char *directory)
diff --git a/lib/ephy-web-app-utils.h b/lib/ephy-web-app-utils.h
index adc2acd..39157fd 100644
--- a/lib/ephy-web-app-utils.h
+++ b/lib/ephy-web-app-utils.h
@@ -26,12 +26,7 @@
#include <glib.h>
#include <gtk/gtk.h>
-
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
G_BEGIN_DECLS
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c
index 8de9fe3..70ece7c 100644
--- a/lib/widgets/ephy-download-widget.c
+++ b/lib/widgets/ephy-download-widget.c
@@ -31,11 +31,7 @@
#include "totem-glow-button.h"
#include <glib/gi18n.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
G_DEFINE_TYPE (EphyDownloadWidget, ephy_download_widget, GTK_TYPE_BOX)
@@ -88,11 +84,7 @@ get_destination_basename_from_download (EphyDownload *ephy_download)
char *unescaped;
download = ephy_download_get_webkit_download (ephy_download);
-#ifdef HAVE_WEBKIT2
dest = webkit_download_get_destination (download);
-#else
- dest = webkit_download_get_destination_uri (download);
-#endif
if (!dest)
return NULL;
@@ -134,17 +126,11 @@ get_remaining_time (WebKitDownload *download)
gdouble elapsed_time;
gdouble remaining_time;
gdouble per_byte_time;
-#ifdef HAVE_WEBKIT2
WebKitURIResponse *response;
response = webkit_download_get_response (download);
total = webkit_uri_response_get_content_length (response);
cur = webkit_download_get_received_data_length (download);
-#else
-
- total = webkit_download_get_total_size (download);
- cur = webkit_download_get_current_size (download);
-#endif
elapsed_time = webkit_download_get_elapsed_time (download);
if (cur <= 0)
@@ -193,11 +179,7 @@ update_download_label_and_tooltip (EphyDownloadWidget *widget,
char *destination;
download = ephy_download_get_webkit_download (widget->priv->download);
-#ifdef HAVE_WEBKIT2
destination = g_filename_display_basename (webkit_download_get_destination (download));
-#else
- destination = g_filename_display_basename (webkit_download_get_destination_uri (download));
-#endif
remaining_tooltip = g_markup_printf_escaped ("%s\n%s", destination, download_label);
g_free (destination);
@@ -210,19 +192,10 @@ update_download_label_and_tooltip (EphyDownloadWidget *widget,
static gboolean
download_content_length_is_known (WebKitDownload *download)
{
-#ifdef HAVE_WEBKIT2
WebKitURIResponse *response;
response = webkit_download_get_response (download);
return webkit_uri_response_get_content_length (response);
-#else
- WebKitNetworkResponse *response;
- SoupMessage* message;
-
- response = webkit_download_get_network_response (download);
- message = webkit_network_response_get_message (response);
- return soup_message_headers_get_content_length (message->response_headers) > 0;
-#endif
}
static void
@@ -233,14 +206,10 @@ widget_progress_cb (WebKitDownload *download,
int progress;
char *download_label = NULL;
-#ifdef HAVE_WEBKIT2
if (!webkit_download_get_destination (download))
return;
progress = webkit_download_get_estimated_progress (download) * 100;
-#else
- progress = webkit_download_get_progress (download) * 100;
-#endif
if (progress % 10 == 0)
update_download_icon (widget);
@@ -260,11 +229,7 @@ widget_progress_cb (WebKitDownload *download,
gint64 current_size;
/* Unknown content length, show received bytes instead. */
-#ifdef HAVE_WEBKIT2
current_size = webkit_download_get_received_data_length (download);
-#else
- current_size = webkit_download_get_current_size (download);
-#endif
if (current_size > 0)
download_label = g_format_size (current_size);
}
@@ -275,7 +240,6 @@ widget_progress_cb (WebKitDownload *download,
}
}
-#ifdef HAVE_WEBKIT2
static void
widget_destination_changed_cb (WebKitDownload *download,
GParamSpec *pspec,
@@ -296,26 +260,7 @@ widget_finished_cb (WebKitDownload *download,
update_download_label_and_tooltip (widget, _("Finished"));
totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (widget->priv->button), TRUE);
}
-#else
-static void
-widget_status_cb (WebKitDownload *download,
- GParamSpec *pspec,
- EphyDownloadWidget *widget)
-{
- WebKitDownloadStatus status;
- status = webkit_download_get_status (download);
-
- if (status != WEBKIT_DOWNLOAD_STATUS_FINISHED)
- return;
-
- widget->priv->finished = TRUE;
- update_download_label_and_tooltip (widget, _("Finished"));
- totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (widget->priv->button), TRUE);
-}
-#endif
-
-#ifdef HAVE_WEBKIT2
static void
widget_failed_cb (WebKitDownload *download,
GError *error,
@@ -330,31 +275,6 @@ widget_failed_cb (WebKitDownload *download,
gtk_widget_set_tooltip_text (GTK_WIDGET (widget), error_msg);
g_free (error_msg);
}
-#else
-static gboolean
-widget_error_cb (WebKitDownload *download,
- gint error_code,
- gint error_detail,
- char *reason,
- EphyDownloadWidget *widget)
-{
- char *error_msg;
-
- g_signal_handlers_disconnect_by_func (download, widget_status_cb, widget);
- g_signal_handlers_disconnect_by_func (download, widget_progress_cb, widget);
-
- error_msg = g_strdup_printf (_("Error downloading: %s"), reason);
-
- gtk_label_set_text (GTK_LABEL (widget->priv->remaining), error_msg);
- gtk_widget_set_tooltip_text (GTK_WIDGET (widget), error_msg);
-
- g_free (error_msg);
-
- totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (widget->priv->button), TRUE);
-
- return FALSE;
-}
-#endif
static void
open_activate_cb (GtkMenuItem *item, EphyDownloadWidget *widget)
@@ -391,11 +311,7 @@ download_menu_clicked_cb (GtkWidget *button,
download = ephy_download_get_webkit_download (widget->priv->download);
-#ifdef HAVE_WEBKIT2
basename = g_filename_display_basename (webkit_download_get_destination (download));
-#else
- basename = g_filename_display_basename (webkit_download_get_destination_uri (download));
-#endif
name = g_uri_unescape_string (basename, NULL);
box = gtk_widget_get_parent (button);
@@ -491,16 +407,10 @@ ephy_download_widget_dispose (GObject *object)
if (widget->priv->download != NULL) {
download = ephy_download_get_webkit_download (widget->priv->download);
-#ifdef HAVE_WEBKIT2
g_signal_handlers_disconnect_by_func (download, widget_progress_cb, widget);
g_signal_handlers_disconnect_by_func (download, widget_destination_changed_cb, widget);
g_signal_handlers_disconnect_by_func (download, widget_finished_cb, widget);
g_signal_handlers_disconnect_by_func (download, widget_failed_cb, widget);
-#else
- g_signal_handlers_disconnect_by_func (download, widget_progress_cb, widget);
- g_signal_handlers_disconnect_by_func (download, widget_status_cb, widget);
- g_signal_handlers_disconnect_by_func (download, widget_error_cb, widget);
-#endif
g_object_unref (widget->priv->download);
widget->priv->download = NULL;
@@ -642,7 +552,6 @@ ephy_download_widget_new (EphyDownload *ephy_download)
widget->priv->remaining = remain;
widget->priv->menu = menu;
-#ifdef HAVE_WEBKIT2
g_signal_connect (download, "notify::estimated-progress",
G_CALLBACK (widget_progress_cb), widget);
g_signal_connect (download, "notify::destination",
@@ -651,14 +560,6 @@ ephy_download_widget_new (EphyDownload *ephy_download)
G_CALLBACK (widget_finished_cb), widget);
g_signal_connect (download, "failed",
G_CALLBACK (widget_failed_cb), widget);
-#else
- g_signal_connect (download, "notify::progress",
- G_CALLBACK (widget_progress_cb), widget);
- g_signal_connect (download, "notify::status",
- G_CALLBACK (widget_status_cb), widget);
- g_signal_connect (download, "error",
- G_CALLBACK (widget_error_cb), widget);
-#endif
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_HALF);
gtk_button_set_relief (GTK_BUTTON (menu), GTK_RELIEF_NORMAL);
diff --git a/lib/widgets/ephy-hosts-store.c b/lib/widgets/ephy-hosts-store.c
index 3173f1b..8949492 100644
--- a/lib/widgets/ephy-hosts-store.c
+++ b/lib/widgets/ephy-hosts-store.c
@@ -26,9 +26,7 @@
#include "ephy-hosts-store.h"
#include <glib/gi18n.h>
-#ifdef HAVE_WEBKIT2
#include <libsoup/soup.h>
-#endif
G_DEFINE_TYPE (EphyHostsStore, ephy_hosts_store, GTK_TYPE_LIST_STORE)
@@ -45,22 +43,16 @@ async_update_favicon_icon (GObject *source, GAsyncResult *result, gpointer user_
IconLoadData *data = (IconLoadData *)user_data;
WebKitFaviconDatabase *database;
GdkPixbuf *favicon = NULL;
-#ifdef HAVE_WEBKIT2
cairo_surface_t *icon_surface;
-#endif
database = WEBKIT_FAVICON_DATABASE (source);
-#ifdef HAVE_WEBKIT2
icon_surface = webkit_favicon_database_get_favicon_finish (database, result, NULL);
if (icon_surface) {
favicon = ephy_pixbuf_get_from_surface_scaled (icon_surface, FAVICON_SIZE, FAVICON_SIZE);
cairo_surface_destroy (icon_surface);
}
-#else
- favicon = webkit_favicon_database_get_favicon_pixbuf_finish (database, result, NULL);
-#endif
if (favicon) {
/* The completion model might have changed its contents */
@@ -82,9 +74,7 @@ async_update_favicon_icon (GObject *source, GAsyncResult *result, gpointer user_
static void
icon_changed_cb (WebKitFaviconDatabase *database,
const char *page_uri,
-#ifdef HAVE_WEBKIT2
const char *favicon_uri,
-#endif
GtkTreeModel *model)
{
GtkTreeIter iter;
@@ -108,7 +98,6 @@ icon_changed_cb (WebKitFaviconDatabase *database,
g_free (host_address);
if (cmp == 0) {
-#ifdef HAVE_WEBKIT2
IconLoadData *data;
GtkTreePath *path;
@@ -123,19 +112,6 @@ icon_changed_cb (WebKitFaviconDatabase *database,
0,
async_update_favicon_icon,
data);
-#else
- GdkPixbuf *favicon = webkit_favicon_database_try_get_favicon_pixbuf (database,
- page_uri,
- FAVICON_SIZE,
- FAVICON_SIZE);
- if (favicon) {
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- EPHY_HOSTS_STORE_COLUMN_FAVICON, favicon,
- -1);
- g_object_unref (favicon);
- }
-
-#endif
}
valid = gtk_tree_model_iter_next (model, &iter);
@@ -152,11 +128,7 @@ ephy_hosts_store_finalize (GObject *object)
EphyHostsStore *store = EPHY_HOSTS_STORE (object);
WebKitFaviconDatabase *database;
-#ifdef HAVE_WEBKIT2
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
-#else
- database = webkit_get_favicon_database ();
-#endif
g_signal_handlers_disconnect_by_func (database, icon_changed_cb, store);
@@ -189,13 +161,8 @@ ephy_hosts_store_init (EphyHostsStore *self)
EPHY_HOSTS_STORE_COLUMN_ADDRESS,
GTK_SORT_ASCENDING);
-#ifdef HAVE_WEBKIT2
g_signal_connect (webkit_web_context_get_favicon_database (webkit_web_context_get_default ()),
"favicon-changed", G_CALLBACK (icon_changed_cb), self);
-#else
- g_signal_connect (webkit_get_favicon_database (), "icon-loaded",
- G_CALLBACK (icon_changed_cb), self);
-#endif
}
EphyHostsStore *
@@ -213,25 +180,13 @@ ephy_hosts_store_add_hosts (EphyHostsStore *store,
GtkTreeIter treeiter;
GtkTreePath *path;
GList *iter;
- GdkPixbuf *favicon;
IconLoadData *data;
WebKitFaviconDatabase *database;
-#ifdef HAVE_WEBKIT2
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
-#else
- database = webkit_get_favicon_database ();
-#endif
for (iter = hosts; iter != NULL; iter = iter->next) {
host = (EphyHistoryHost *)iter->data;
-#ifdef HAVE_WEBKIT2
- /* Flag favicon to NULL to reuse some code later on */
- favicon = NULL;
-#else
- favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, host->url,
- FAVICON_SIZE, FAVICON_SIZE);
-#endif
gtk_list_store_insert_with_values (GTK_LIST_STORE (store),
&treeiter, G_MAXINT,
@@ -239,31 +194,19 @@ ephy_hosts_store_add_hosts (EphyHostsStore *store,
EPHY_HOSTS_STORE_COLUMN_TITLE, host->title,
EPHY_HOSTS_STORE_COLUMN_ADDRESS, host->url,
EPHY_HOSTS_STORE_COLUMN_VISIT_COUNT, host->visit_count,
-#ifndef HAVE_WEBKIT2
- EPHY_HOSTS_STORE_COLUMN_FAVICON, favicon,
-#endif
-1);
- if (favicon)
- g_object_unref (favicon);
- else {
- data = g_slice_new (IconLoadData);
- data->model = GTK_LIST_STORE (g_object_ref (store));
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &treeiter);
- data->row_reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path);
- gtk_tree_path_free (path);
-#ifdef HAVE_WEBKIT2
- webkit_favicon_database_get_favicon (database,
- host->url,
- NULL,
- async_update_favicon_icon,
- data);
-#else
- webkit_favicon_database_get_favicon_pixbuf (database, host->url,
- FAVICON_SIZE, FAVICON_SIZE, NULL,
- async_update_favicon_icon, data);
-#endif
- }
+ data = g_slice_new (IconLoadData);
+ data->model = GTK_LIST_STORE (g_object_ref (store));
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &treeiter);
+ data->row_reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path);
+ gtk_tree_path_free (path);
+
+ webkit_favicon_database_get_favicon (database,
+ host->url,
+ NULL,
+ async_update_favicon_icon,
+ data);
}
}
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 577011c..1426939 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -35,11 +35,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
/**
* SECTION:ephy-location-entry
@@ -953,17 +949,10 @@ free_prefetch_helper (PrefetchHelper *helper)
static gboolean
do_dns_prefetch (PrefetchHelper *helper)
{
-#ifdef HAVE_WEBKIT2
WebKitWebContext *context = webkit_web_context_get_default ();
if (helper->uri)
webkit_web_context_prefetch_dns (context, helper->uri->host);
-#else
- SoupSession *session = webkit_get_default_session ();
-
- if (helper->uri)
- soup_session_prefetch_dns (session, helper->uri->host, NULL, NULL, NULL);
-#endif
helper->entry->priv->dns_prefetch_handler = 0;
diff --git a/lib/widgets/ephy-overview-store.h b/lib/widgets/ephy-overview-store.h
index 49303bc..b065fe5 100644
--- a/lib/widgets/ephy-overview-store.h
+++ b/lib/widgets/ephy-overview-store.h
@@ -22,11 +22,7 @@
#define _EPHY_OVERVIEW_STORE_H
#include <gtk/gtk.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#include "gd-main-view.h"
G_BEGIN_DECLS
diff --git a/src/Makefile.am b/src/Makefile.am
index 0046e67..3afd7eb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -92,10 +92,6 @@ libephymain_la_CPPFLAGS = \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
$(AM_CPPFLAGS)
-if WITH_WEBKIT2
-libephymain_la_CPPFLAGS += -DHAVE_WEBKIT2
-endif
-
libephymain_la_CFLAGS = \
$(DEPENDENCIES_CFLAGS) \
$(WEBKIT_CFLAGS) \
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 639d780..fb8b55f 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -67,7 +67,6 @@ typedef struct
G_DEFINE_TYPE (EphyBookmarkAction, ephy_bookmark_action, EPHY_TYPE_LINK_ACTION)
-#ifdef HAVE_WEBKIT2
static void
favicon_changed_cb (WebKitFaviconDatabase *database,
const char *page_address,
@@ -121,33 +120,6 @@ async_get_favicon_pixbuf_callback (GObject *source, GAsyncResult *result, gpoint
g_object_unref (proxy);
}
-#else
-static void
-favicon_changed_cb (WebKitFaviconDatabase *database,
- const char *page_address,
- EphyBookmarkAction *action)
-{
- const char *icon;
- char *icon_address;
-
- g_return_if_fail (action->priv->node != NULL);
-
- icon = ephy_node_get_property_string (action->priv->node,
- EPHY_NODE_BMK_PROP_ICON);
- icon_address = webkit_favicon_database_get_favicon_uri (database, page_address);
-
- if (g_strcmp0 (icon, icon_address) == 0)
- {
- g_signal_handler_disconnect (database, action->priv->cache_handler);
- action->priv->cache_handler = 0;
-
- g_object_notify (G_OBJECT (action), "icon");
- }
-
- g_free (icon_address);
-}
-#endif
-
static void
ephy_bookmark_action_sync_icon (GtkAction *action,
GParamSpec *pspec,
@@ -162,42 +134,10 @@ ephy_bookmark_action_sync_icon (GtkAction *action,
page_location = ephy_node_get_property_string (bma->priv->node,
EPHY_NODE_BMK_PROP_LOCATION);
-#ifdef HAVE_WEBKIT2
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
-#else
- database = webkit_get_favicon_database ();
-#endif
+
if (page_location && *page_location)
{
-#ifndef HAVE_WEBKIT2
- GdkPixbuf *pixbuf = webkit_favicon_database_try_get_favicon_pixbuf (database, page_location,
- FAVICON_SIZE,
FAVICON_SIZE);
- if (pixbuf == NULL && bma->priv->cache_handler == 0)
- {
- bma->priv->cache_handler =
- g_signal_connect_object (database, "icon-loaded",
- G_CALLBACK (favicon_changed_cb),
- action, 0);
- }
-
- if (GTK_IS_MENU_ITEM (proxy) && pixbuf)
- {
- GtkWidget *image;
-
- image = gtk_image_new_from_pixbuf (pixbuf);
- gtk_widget_show (image);
-
- gtk_image_menu_item_set_image
- (GTK_IMAGE_MENU_ITEM (proxy), image);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (proxy),
- TRUE);
- }
-
- if (pixbuf)
- {
- g_object_unref (pixbuf);
- }
-#else
webkit_favicon_database_get_favicon (database, page_location,
0, async_get_favicon_pixbuf_callback,
g_object_ref (proxy));
@@ -209,7 +149,6 @@ ephy_bookmark_action_sync_icon (GtkAction *action,
G_CALLBACK (favicon_changed_cb),
action, 0);
}
-#endif
}
}
@@ -449,11 +388,8 @@ ephy_bookmark_action_dispose (GObject *object)
if (priv->cache_handler != 0)
{
WebKitFaviconDatabase *database;
-#ifdef HAVE_WEBKIT2
+
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
-#else
- database = webkit_get_favicon_database ();
-#endif
g_signal_handler_disconnect (database, priv->cache_handler);
priv->cache_handler = 0;
}
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 659fda7..889920f 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1448,89 +1448,14 @@ node_dropped_cb (EphyNodeView *view,
}
}
-#ifdef HAVE_WEBKIT2
/* TODO: Favicons */
-#else
-static gboolean
-webkit_favicon_database_has_favicon (WebKitFaviconDatabase *database, const char *page_uri)
-{
- gboolean result;
- char *uri;
-
- uri = webkit_favicon_database_get_favicon_uri (database, page_uri);
- result = (uri != NULL);
- g_free (uri);
-
- return result;
-}
-
-static void
-icon_loaded_cb (WebKitFaviconDatabase *database, GAsyncResult *result, GtkTreeRowReference *reference)
-{
- GdkPixbuf *favicon = webkit_favicon_database_get_favicon_pixbuf_finish (database, result, NULL);
-
- if (favicon && gtk_tree_row_reference_valid (reference)) {
- GtkTreeModel *model = gtk_tree_row_reference_get_model (reference);
- GtkTreePath *path = gtk_tree_row_reference_get_path (reference);
- GtkTreeIter iter;
-
- /* Force repaint. */
- if (gtk_tree_model_get_iter (model, &iter, path))
- gtk_tree_model_row_changed (model, path, &iter);
-
- gtk_tree_path_free (path);
- }
-
- gtk_tree_row_reference_free (reference);
- if (favicon)
- g_object_unref (favicon);
-}
-#endif
static void
provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
{
GdkPixbuf *favicon = NULL;
-#ifndef HAVE_WEBKIT2
- const char *page_location;
- page_location = ephy_node_get_property_string
- (node, EPHY_NODE_BMK_PROP_LOCATION);
-
- LOG ("Get favicon for %s", page_location ? page_location : "None");
-#endif
-
-#ifdef HAVE_WEBKIT2
/* TODO: Favicons */
-#else
- if (page_location)
- {
- WebKitFaviconDatabase *database = webkit_get_favicon_database ();
-
- /* Try with the sync version first as this method will be frequently called. */
- favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, page_location,
- FAVICON_SIZE, FAVICON_SIZE);
-
- if (!favicon && webkit_favicon_database_has_favicon (database, page_location)) {
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (user_data));
- GtkTreeIter iter;
-
- if (ephy_node_view_get_iter_for_node (EPHY_NODE_VIEW (user_data), &iter, node)) {
- GtkTreeRowReference *reference;
- GtkTreePath *path;
-
- path = gtk_tree_model_get_path (model, &iter);
- reference = gtk_tree_row_reference_new (model, path);
- gtk_tree_path_free (path);
-
- webkit_favicon_database_get_favicon_pixbuf (database, page_location,
- FAVICON_SIZE, FAVICON_SIZE, NULL,
- (GAsyncReadyCallback)
icon_loaded_cb,
- reference);
- }
- }
- }
-#endif
g_value_init (value, GDK_TYPE_PIXBUF);
g_value_take_object (value, favicon);
}
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index ac41a64..066ede2 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -231,7 +231,6 @@ ephy_bookmarks_save_delayed (EphyBookmarks *bookmarks, int delay)
}
}
-#ifdef HAVE_WEBKIT2
static void
icon_updated_cb (WebKitFaviconDatabase *favicon_database,
const char *address,
@@ -240,34 +239,15 @@ icon_updated_cb (WebKitFaviconDatabase *favicon_database,
{
ephy_bookmarks_set_icon (eb, address, icon);
}
-#else
-static void
-icon_updated_cb (WebKitFaviconDatabase *favicon_database,
- const char *address,
- EphyBookmarks *eb)
-{
- char *icon;
-
- icon = webkit_favicon_database_get_favicon_uri (favicon_database, address);
- ephy_bookmarks_set_icon (eb, address, icon);
- g_free (icon);
-}
-#endif
static void
ephy_setup_history_notifiers (EphyBookmarks *eb)
{
WebKitFaviconDatabase *favicon_database;
-#ifdef HAVE_WEBKIT2
favicon_database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
g_signal_connect (favicon_database, "favicon-changed",
G_CALLBACK (icon_updated_cb), eb);
-#else
- favicon_database = webkit_get_favicon_database ();
- g_signal_connect (favicon_database, "icon-loaded",
- G_CALLBACK (icon_updated_cb), eb);
-#endif
}
static void
@@ -1168,11 +1148,7 @@ ephy_bookmarks_add (EphyBookmarks *eb,
}
ephy_node_set_property_string (bm, EPHY_NODE_BMK_PROP_TITLE, title);
-#ifdef HAVE_WEBKIT2
favicon_database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
-#else
- favicon_database = webkit_get_favicon_database ();
-#endif
if (favicon_database != NULL)
{
char *icon = webkit_favicon_database_get_favicon_uri (favicon_database, url);
diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c
index 33d84bb..35bd43e 100644
--- a/src/ephy-completion-model.c
+++ b/src/ephy-completion-model.c
@@ -180,16 +180,12 @@ icon_loaded_cb (GObject *source, GAsyncResult *result, gpointer user_data)
IconLoadData *data = (IconLoadData *) user_data;
WebKitFaviconDatabase *database = WEBKIT_FAVICON_DATABASE (source);
GdkPixbuf *favicon = NULL;
-
-#ifdef HAVE_WEBKIT2
cairo_surface_t *icon_surface = webkit_favicon_database_get_favicon_finish (database, result, NULL);
+
if (icon_surface) {
favicon = ephy_pixbuf_get_from_surface_scaled (icon_surface, FAVICON_SIZE, FAVICON_SIZE);
cairo_surface_destroy (icon_surface);
}
-#else
- favicon = webkit_favicon_database_get_favicon_pixbuf_finish (database, result, NULL);
-#endif
if (favicon) {
/* The completion model might have changed its contents */
@@ -215,12 +211,7 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row)
IconLoadData *data;
WebKitFaviconDatabase* database;
-#ifndef HAVE_WEBKIT2
- GdkPixbuf *favicon;
- database = webkit_get_favicon_database ();
-#else
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
-#endif
gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, position,
EPHY_COMPLETION_TEXT_COL, row->title ? row->title : "",
@@ -231,32 +222,14 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row)
EPHY_COMPLETION_RELEVANCE_COL, row->relevance,
-1);
-#ifndef HAVE_WEBKIT2
- /* We try first with the try_get_favicon_pixbuf() because if the icon
- is in the DB it's faster than the async version. */
- favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, row->location,
- FAVICON_SIZE, FAVICON_SIZE);
- if (favicon) {
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, EPHY_COMPLETION_FAVICON_COL, favicon, -1);
- g_object_unref (favicon);
- return;
- }
-#endif
-
data = g_slice_new (IconLoadData);
data->model = GTK_LIST_STORE (g_object_ref(model));
path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
data->row_reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
gtk_tree_path_free (path);
-#ifdef HAVE_WEBKIT2
webkit_favicon_database_get_favicon (database, row->location,
NULL, icon_loaded_cb, data);
-#else
- webkit_favicon_database_get_favicon_pixbuf (database, row->location,
- FAVICON_SIZE, FAVICON_SIZE,
- NULL, icon_loaded_cb, data);
-#endif
}
static void
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 411745c..609a837 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -35,11 +35,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define EPHY_ENCODING_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),
EPHY_TYPE_ENCODING_DIALOG, EphyEncodingDialogPrivate))
@@ -117,18 +113,9 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
g_return_if_fail (EPHY_IS_EMBED (embed));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
+
encoding = webkit_web_view_get_custom_charset (view);
if (encoding == NULL) goto out;
-#else
- encoding = webkit_web_view_get_custom_encoding (view);
- if (encoding == NULL)
- {
- encoding = webkit_web_view_get_encoding (view);
- if (encoding == NULL) goto out;
- is_automatic = TRUE;
- }
-#endif
node = ephy_encodings_get_encoding (dialog->priv->encodings, encoding, TRUE);
g_assert (EPHY_IS_ENCODING (node));
@@ -162,15 +149,9 @@ out:
static void
-#ifdef HAVE_WEBKIT2
embed_net_stop_cb (EphyWebView *view,
WebKitLoadEvent load_event,
EphyEncodingDialog *dialog)
-#else
-embed_net_stop_cb (EphyWebView *view,
- GParamSpec *pspec,
- EphyEncodingDialog *dialog)
-#endif
{
if (ephy_web_view_is_loading (view) == FALSE)
sync_encoding_against_embed (dialog);
@@ -189,13 +170,9 @@ sync_embed_cb (EphyEncodingDialog *dialog, GParamSpec *pspec, gpointer dummy)
dialog);
}
-#ifdef HAVE_WEBKIT2
g_signal_connect (G_OBJECT (ephy_embed_get_web_view (embed)), "load-changed",
G_CALLBACK (embed_net_stop_cb), dialog);
-#else
- g_signal_connect (G_OBJECT (ephy_embed_get_web_view (embed)), "notify::load-status",
- G_CALLBACK (embed_net_stop_cb), dialog);
-#endif
+
dialog->priv->embed = embed;
sync_encoding_against_embed (dialog);
@@ -252,11 +229,7 @@ activate_choice (EphyEncodingDialog *dialog)
if (is_automatic)
{
-#ifdef HAVE_WEBKIT2
webkit_web_view_set_custom_charset (view, NULL);
-#else
- webkit_web_view_set_custom_encoding (view, NULL);
-#endif
}
else if (dialog->priv->selected_encoding != NULL)
{
@@ -264,11 +237,7 @@ activate_choice (EphyEncodingDialog *dialog)
code = dialog->priv->selected_encoding;
-#ifdef HAVE_WEBKIT2
webkit_web_view_set_custom_charset (view, code);
-#else
- webkit_web_view_set_custom_encoding (view, code);
-#endif
ephy_encodings_add_recent (dialog->priv->encodings, code);
}
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index ff23305..5f95813 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -35,11 +35,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define EPHY_ENCODING_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),
EPHY_TYPE_ENCODING_MENU, EphyEncodingMenuPrivate))
@@ -135,18 +131,9 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->window));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
+
encoding = webkit_web_view_get_custom_charset (view);
if (encoding == NULL) goto build_menu;
-#else
- encoding = webkit_web_view_get_custom_encoding (view);
- if (encoding == NULL)
- {
- encoding = webkit_web_view_get_encoding (view);
- if (encoding == NULL) goto build_menu;
- is_automatic = TRUE;
- }
-#endif
enc_node = ephy_encodings_get_encoding (p->encodings, encoding, TRUE);
g_assert (EPHY_IS_ENCODING (enc_node));
@@ -254,11 +241,7 @@ encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (menu->priv->window));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
webkit_web_view_set_custom_charset (view, encoding);
-#else
- webkit_web_view_set_custom_encoding (view, encoding);
-#endif
ephy_encodings_add_recent (menu->priv->encodings, encoding);
}
@@ -329,11 +312,7 @@ ephy_encoding_menu_automatic_cb (GtkAction *action, EphyEncodingMenu *menu)
/* setting NULL will clear the forced encoding */
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
webkit_web_view_set_custom_charset (view, NULL);
-#else
- webkit_web_view_set_custom_encoding (view, NULL);
-#endif
}
static const GtkActionEntry menu_entries [] =
diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c
index 49c855d..d6aac37 100644
--- a/src/ephy-find-toolbar.c
+++ b/src/ephy-find-toolbar.c
@@ -31,11 +31,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define EPHY_FIND_TOOLBAR_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object),
EPHY_TYPE_FIND_TOOLBAR, EphyFindToolbarPrivate))
@@ -43,9 +39,7 @@ struct _EphyFindToolbarPrivate
{
EphyWindow *window;
WebKitWebView *web_view;
-#ifdef HAVE_WEBKIT2
WebKitFindController *controller;
-#endif
GtkWidget *entry;
GtkWidget *next;
GtkWidget *prev;
@@ -93,44 +87,6 @@ G_DEFINE_TYPE (EphyFindToolbar, ephy_find_toolbar, GTK_TYPE_SEARCH_BAR)
/* private functions */
static void
-scroll_lines (WebKitWebView *web_view,
- int num_lines)
-{
-#ifdef HAVE_WEBKIT2
- /* TODO: Scroll API? */
-#else
- GtkScrolledWindow *scrolled_window;
- GtkAdjustment *vadj;
- gdouble value;
-
- scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view)));
- vadj = gtk_scrolled_window_get_vadjustment (scrolled_window);
-
- value = gtk_adjustment_get_value (vadj) + (num_lines * gtk_adjustment_get_step_increment (vadj));
- gtk_adjustment_set_value (vadj, value);
-#endif
-}
-
-static void
-scroll_pages (WebKitWebView *web_view,
- int num_pages)
-{
-#ifdef HAVE_WEBKIT2
- /* TODO: Scroll API */
-#else
- GtkScrolledWindow *scrolled_window;
- GtkAdjustment *vadj;
- gdouble value;
-
- scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view)));
- vadj = gtk_scrolled_window_get_vadjustment (scrolled_window);
-
- value = gtk_adjustment_get_value (vadj) + (num_pages * gtk_adjustment_get_page_increment (vadj));
- gtk_adjustment_set_value (vadj, value);
-#endif
-}
-
-static void
set_status (EphyFindToolbar *toolbar,
EphyFindResult result)
{
@@ -180,11 +136,8 @@ clear_status (EphyFindToolbar *toolbar)
gtk_widget_set_sensitive (priv->next, FALSE);
if (priv->web_view == NULL) return;
-#ifdef HAVE_WEBKIT2
+
webkit_find_controller_search_finish (priv->controller);
-#else
- webkit_web_view_unmark_text_matches (priv->web_view);
-#endif
}
/* Code adapted from gtktreeview.c:gtk_tree_view_key_press() and
@@ -246,27 +199,6 @@ str_has_uppercase (const char *str)
return FALSE;
}
-#ifndef HAVE_WEBKIT2
-static void
-ephy_find_toolbar_mark_matches (EphyFindToolbar *toolbar)
-{
- EphyFindToolbarPrivate *priv = toolbar->priv;
- WebKitWebView *web_view = priv->web_view;
- gboolean case_sensitive;
-
- case_sensitive = str_has_uppercase (priv->find_string);
-
- webkit_web_view_unmark_text_matches (web_view);
- if (priv->find_string != NULL && priv->find_string[0] != '\0')
- webkit_web_view_mark_text_matches (web_view,
- priv->find_string,
- case_sensitive,
- 0);
- webkit_web_view_set_highlight_text_matches (web_view, TRUE);
-}
-#endif
-
-#ifdef HAVE_WEBKIT2
static void
real_find (EphyFindToolbarPrivate *priv,
EphyFindDirection direction)
@@ -284,59 +216,18 @@ real_find (EphyFindToolbarPrivate *priv,
webkit_find_controller_search (priv->controller, priv->find_string, options, G_MAXUINT);
}
-#else
-static EphyFindResult
-real_find (EphyFindToolbarPrivate *priv,
- EphyFindDirection direction)
-{
- WebKitWebView *web_view = priv->web_view;
- gboolean case_sensitive;
- gboolean forward = (direction == EPHY_FIND_DIRECTION_NEXT);
-
- case_sensitive = str_has_uppercase (priv->find_string);
- if (!priv->find_string || !g_strcmp0 (priv->find_string, ""))
- return EPHY_FIND_RESULT_NOTFOUND;
-
- if (!webkit_web_view_search_text
- (web_view, priv->find_string, case_sensitive, forward, FALSE)) {
- /* not found, try to wrap */
- if (!webkit_web_view_search_text
- (web_view, priv->find_string, case_sensitive, forward, TRUE)) {
- /* there's no result */
- return EPHY_FIND_RESULT_NOTFOUND;
- } else {
- /* found wrapped */
- return EPHY_FIND_RESULT_FOUNDWRAPPED;
- }
- }
-
- return EPHY_FIND_RESULT_FOUND;
-}
-#endif
-
static gboolean
do_search (EphyFindToolbar *toolbar)
{
EphyFindToolbarPrivate *priv = toolbar->priv;
-#ifndef HAVE_WEBKIT2
- EphyFindResult result;
-#endif
priv->find_source_id = 0;
-#ifdef HAVE_WEBKIT2
real_find (priv, EPHY_FIND_DIRECTION_NEXT);
-#else
- ephy_find_toolbar_mark_matches (toolbar);
-
- result = real_find (priv, EPHY_FIND_DIRECTION_NEXT);
- set_status (toolbar, result);
-#endif
return FALSE;
}
-#ifdef HAVE_WEBKIT2
static void
found_text_cb (WebKitFindController *controller,
guint n_matches,
@@ -367,8 +258,6 @@ failed_to_find_text_cb (WebKitFindController *controller,
options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
webkit_find_controller_search (controller, priv->find_string, options, G_MAXUINT);
}
-#endif
-
static void
update_find_string (EphyFindToolbar *toolbar)
@@ -412,22 +301,6 @@ entry_key_press_event_cb (GtkEntry *entry,
handled = TRUE;
switch (event->keyval)
{
- case GDK_KEY_Up:
- case GDK_KEY_KP_Up:
- scroll_lines (priv->web_view, -1);
- break;
- case GDK_KEY_Down:
- case GDK_KEY_KP_Down:
- scroll_lines (priv->web_view, 1);
- break;
- case GDK_KEY_Page_Up:
- case GDK_KEY_KP_Page_Up:
- scroll_pages (priv->web_view, -1);
- break;
- case GDK_KEY_Page_Down:
- case GDK_KEY_KP_Page_Down:
- scroll_pages (priv->web_view, 1);
- break;
case GDK_KEY_Escape:
/* Hide the toolbar when ESC is pressed */
ephy_find_toolbar_request_close (toolbar);
@@ -762,21 +635,14 @@ ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar,
if (priv->web_view != NULL)
{
-#ifdef HAVE_WEBKIT2
g_signal_handlers_disconnect_matched (priv->controller,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, toolbar);
-#endif
-
- g_signal_handlers_disconnect_matched (EPHY_WEB_VIEW (web_view),
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, toolbar);
}
priv->web_view = web_view;
if (web_view != NULL)
{
-#ifdef HAVE_WEBKIT2
priv->controller = webkit_web_view_get_find_controller (web_view);
g_signal_connect_object (priv->controller, "found-text",
G_CALLBACK (found_text_cb),
@@ -784,7 +650,6 @@ ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar,
g_signal_connect_object (priv->controller, "failed-to-find-text",
G_CALLBACK (failed_to_find_text_cb),
toolbar, 0);
-#endif
clear_status (toolbar);
@@ -794,90 +659,16 @@ ephy_find_toolbar_set_embed (EphyFindToolbar *toolbar,
}
}
-#ifndef HAVE_WEBKIT2
-typedef struct
-{
- EphyFindToolbar *toolbar;
- gboolean direction;
- gboolean highlight;
-} FindAgainCBStruct;
-
-static void
-find_again_data_destroy_cb (FindAgainCBStruct *data)
-{
- g_slice_free (FindAgainCBStruct, data);
-}
-
-static gboolean
-find_again_cb (FindAgainCBStruct *data)
-{
- EphyFindResult result;
- EphyFindToolbarPrivate *priv = data->toolbar->priv;
-
- result = real_find (priv, data->direction);
-
- /* Highlight matches again if the toolbar was hidden when the user
- * requested find-again. */
- if (result != EPHY_FIND_RESULT_NOTFOUND && data->highlight)
- ephy_find_toolbar_mark_matches (data->toolbar);
-
- set_status (data->toolbar, result);
-
- priv->find_again_source_id = 0;
-
- return FALSE;
-}
-
-static void
-find_again (EphyFindToolbar *toolbar, EphyFindDirection direction)
-{
- GtkWidget *widget = GTK_WIDGET (toolbar);
- EphyFindToolbarPrivate *priv = toolbar->priv;
- FindAgainCBStruct *data;
- gboolean visible;
-
- visible = gtk_widget_get_visible (widget);
- if (!visible) {
- gtk_widget_show (widget);
- gtk_widget_grab_focus (widget);
- }
-
- /* We need to do this to give time to the embed to sync with the size
- * change due to the toolbar being shown, otherwise the toolbar can
- * obscure the result. See GNOME bug #415074.
- */
- if (priv->find_again_source_id != 0) return;
-
- data = g_slice_new0 (FindAgainCBStruct);
- data->toolbar = toolbar;
- data->direction = direction;
- data->highlight = !visible;
-
- priv->find_again_source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
- (GSourceFunc) find_again_cb,
- data,
- (GDestroyNotify) find_again_data_destroy_cb);
-}
-#endif
-
void
ephy_find_toolbar_find_next (EphyFindToolbar *toolbar)
{
-#ifdef HAVE_WEBKIT2
webkit_find_controller_search_next (toolbar->priv->controller);
-#else
- find_again (toolbar, EPHY_FIND_DIRECTION_NEXT);
-#endif
}
void
ephy_find_toolbar_find_previous (EphyFindToolbar *toolbar)
{
-#ifdef HAVE_WEBKIT2
webkit_find_controller_search_previous (toolbar->priv->controller);
-#else
- find_again (toolbar, EPHY_FIND_DIRECTION_PREV);
-#endif
}
void
@@ -909,11 +700,8 @@ ephy_find_toolbar_close (EphyFindToolbar *toolbar)
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (toolbar), FALSE);
if (priv->web_view == NULL) return;
-#ifdef HAVE_WEBKIT2
+
webkit_find_controller_search_finish (priv->controller);
-#else
- webkit_web_view_set_highlight_text_matches (priv->web_view, FALSE);
-#endif
}
void
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 91133cc..34fe4ea 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -869,13 +869,7 @@ provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
{
/* No need to use the async version as this function will be
called many times by the treeview. */
-#ifdef HAVE_WEBKIT2
/* TODO: Favicons */
-#else
- WebKitFaviconDatabase *database = webkit_get_favicon_database ();
- pixbuf = webkit_favicon_database_get_favicon_pixbuf (database, page_location,
- FAVICON_SIZE, FAVICON_SIZE);
-#endif
}
g_value_init (value, GDK_TYPE_PIXBUF);
diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c
index 92be4ce..46742f2 100644
--- a/src/ephy-navigation-history-action.c
+++ b/src/ephy-navigation-history-action.c
@@ -41,11 +41,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define EPHY_NAVIGATION_HISTORY_ACTION_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
@@ -106,13 +102,13 @@ action_activate (GtkAction *action)
if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) {
if (ephy_gui_is_middle_click () ||
ephy_link_action_get_button (EPHY_LINK_ACTION (history_action)) == 2) {
- /* FIXME: in WebKit2 the back/forward list is immutable, so we are not able to
- * copy it. Ideally the webkit1 code path should also work for webkit2. */
-#ifdef HAVE_WEBKIT2
const char *back_uri;
WebKitBackForwardList *history;
WebKitBackForwardListItem *back_item;
+ /* FIXME: in WebKit2 the back/forward list is immutable, so we are not able to
+ * copy it. Ideally the webkit1 code path should also work for webkit2. */
+
history = webkit_web_view_get_back_forward_list (web_view);
back_item = webkit_back_forward_list_get_back_item (history);
back_uri = webkit_back_forward_list_item_get_original_uri (back_item);
@@ -128,15 +124,6 @@ action_activate (GtkAction *action)
gtk_widget_grab_focus (GTK_WIDGET (embed));
return;
}
-#else
- embed = ephy_shell_new_tab (ephy_shell_get_default (),
- EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
- embed,
- NULL,
- EPHY_NEW_TAB_IN_EXISTING_WINDOW);
- web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
- }
-#endif
webkit_web_view_go_back (web_view);
gtk_widget_grab_focus (GTK_WIDGET (embed));
@@ -144,25 +131,15 @@ action_activate (GtkAction *action)
if (ephy_gui_is_middle_click () ||
ephy_link_action_get_button (EPHY_LINK_ACTION (history_action)) == 2) {
const char *forward_uri;
-#ifdef HAVE_WEBKIT2
WebKitBackForwardList *history;
WebKitBackForwardListItem *forward_item;
-#else
- WebKitWebHistoryItem *forward_item;
- WebKitWebBackForwardList *history;
-#endif
/* Forward history is not copied when opening
a new tab, so get the forward URI manually
and load it */
history = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-#ifdef HAVE_WEBKIT2
forward_item = webkit_back_forward_list_get_forward_item (history);
forward_uri = webkit_back_forward_list_item_get_original_uri (forward_item);
-#else
- forward_item = webkit_web_back_forward_list_get_forward_item (history);
- forward_uri = webkit_web_history_item_get_original_uri (forward_item);
-#endif
embed = ephy_shell_new_tab (ephy_shell_get_default (),
EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
@@ -273,16 +250,12 @@ icon_loaded_cb (GObject *source,
{
WebKitFaviconDatabase *database = WEBKIT_FAVICON_DATABASE (source);
GdkPixbuf *favicon = NULL;
-
-#ifdef HAVE_WEBKIT2
cairo_surface_t *icon_surface = webkit_favicon_database_get_favicon_finish (database, result, NULL);
+
if (icon_surface) {
favicon = ephy_pixbuf_get_from_surface_scaled (icon_surface, FAVICON_SIZE, FAVICON_SIZE);
cairo_surface_destroy (icon_surface);
}
-#else
- favicon = webkit_favicon_database_get_favicon_pixbuf_finish (database, result, NULL);
-#endif
if (favicon) {
GtkWidget *image;
@@ -305,9 +278,6 @@ new_history_menu_item (EphyWebView *view,
GtkWidget *item;
GtkLabel *label;
WebKitFaviconDatabase* database;
-#ifndef HAVE_WEBKIT2
- GdkPixbuf *favicon;
-#endif
g_return_val_if_fail (address != NULL && origtext != NULL, NULL);
@@ -317,32 +287,11 @@ new_history_menu_item (EphyWebView *view,
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH);
-#ifdef HAVE_WEBKIT2
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default ());
webkit_favicon_database_get_favicon (database, address,
NULL,
(GAsyncReadyCallback)icon_loaded_cb,
g_object_ref (item));
-#else
- database = webkit_get_favicon_database ();
- favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, address,
- FAVICON_SIZE, FAVICON_SIZE);
-
- if (favicon) {
- GtkWidget *image;
-
- image = gtk_image_new_from_pixbuf (favicon);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
-
- g_object_unref (favicon);
- } else {
- webkit_favicon_database_get_favicon_pixbuf (database, address,
- FAVICON_SIZE, FAVICON_SIZE, NULL,
- (GAsyncReadyCallback) icon_loaded_cb,
- GTK_IMAGE_MENU_ITEM (g_object_ref (item)));
- }
-#endif
g_object_set_data_full (G_OBJECT (item), "link-message", g_strdup (address), (GDestroyNotify) g_free);
@@ -361,87 +310,20 @@ set_new_back_history (EphyEmbed *source,
EphyEmbed *dest,
gint offset)
{
-#ifdef HAVE_WEBKIT2
/* TODO: WebKitBackForwardList: In WebKit2 WebKitBackForwardList can't be modified */
-#else
- WebKitWebView *source_view, *dest_view;
- WebKitWebBackForwardList* source_list, *dest_list;
- WebKitWebHistoryItem *item;
- GList *items;
- guint limit;
- guint i;
-
- source_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (source);
- dest_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (dest);
-
- source_list = webkit_web_view_get_back_forward_list (source_view);
- dest_list = webkit_web_view_get_back_forward_list (dest_view);
-
- if (offset >= 0) {
- /* Copy the whole back history in this case (positive offset) */
- ephy_web_view_copy_back_history (ephy_embed_get_web_view (source),
- ephy_embed_get_web_view (dest));
-
- items = webkit_web_back_forward_list_get_forward_list_with_limit (source_list,
- EPHY_WEBKIT_BACK_FORWARD_LIMIT);
- limit = offset - 1;
- } else {
- items = webkit_web_back_forward_list_get_back_list_with_limit (source_list,
- EPHY_WEBKIT_BACK_FORWARD_LIMIT);
- limit = g_list_length (items) + offset;
- }
-
- /* Add the remaining items to the BackForward list */
- items = g_list_reverse (items);
- for (i = 0; i < limit; i++) {
- item = webkit_web_history_item_copy ((WebKitWebHistoryItem *) items->data);
- webkit_web_back_forward_list_add_item (dest_list, item);
- g_object_unref (item);
-
- items = items->next;
- }
- g_list_free (items);
-#endif
}
static void
middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action,
EphyEmbed *embed,
-#ifdef HAVE_WEBKIT2
WebKitBackForwardListItem *item)
-#else
- WebKitWebHistoryItem *item)
-#endif
{
EphyEmbed *new_embed = NULL;
-#ifndef HAVE_WEBKIT2
- WebKitWebView *web_view;
- WebKitWebBackForwardList *history;
- GList *list;
- guint current;
-#endif
const gchar *url;
gint offset;
-#ifdef HAVE_WEBKIT2
/* TODO: WebKitBackForwardList is read-only in WebKit2 */
offset = 0;
-#else
- web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-
- /* Save old history and item's offset from current */
- history = webkit_web_view_get_back_forward_list (web_view);
- if (action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) {
- list = webkit_web_back_forward_list_get_back_list_with_limit (history,
- EPHY_WEBKIT_BACK_FORWARD_LIMIT);
- current = -1;
- } else {
- list = webkit_web_back_forward_list_get_forward_list_with_limit (history,
- EPHY_WEBKIT_BACK_FORWARD_LIMIT);
- current = g_list_length (list);
- }
- offset = current - g_list_index (list, item);
-#endif
new_embed = ephy_shell_new_tab (ephy_shell_get_default (),
EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
@@ -457,11 +339,7 @@ middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action,
set_new_back_history (embed, new_embed, offset);
/* Load the new URL */
-#ifdef HAVE_WEBKIT2
url = webkit_back_forward_list_item_get_original_uri (item);
-#else
- url = webkit_web_history_item_get_original_uri (item);
-#endif
ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), url);
}
@@ -469,11 +347,7 @@ static void
activate_menu_item_cb (GtkWidget *menuitem,
EphyNavigationHistoryAction *action)
{
-#ifdef HAVE_WEBKIT2
WebKitBackForwardListItem *item;
-#else
- WebKitWebHistoryItem *item;
-#endif
EphyWindow *window;
EphyEmbed *embed;
@@ -481,11 +355,7 @@ activate_menu_item_cb (GtkWidget *menuitem,
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
-#ifdef HAVE_WEBKIT2
item = (WebKitBackForwardListItem *) g_object_get_data (G_OBJECT (menuitem), HISTORY_ITEM_DATA_KEY);
-#else
- item = (WebKitWebHistoryItem *) g_object_get_data (G_OBJECT (menuitem), HISTORY_ITEM_DATA_KEY);
-#endif
g_return_if_fail (item != NULL);
if (ephy_gui_is_middle_click ())
@@ -494,11 +364,7 @@ activate_menu_item_cb (GtkWidget *menuitem,
WebKitWebView *web_view;
web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
webkit_web_view_go_to_back_forward_list_item (web_view, item);
-#else
- webkit_web_view_go_to_back_forward_item (web_view, item);
-#endif
}
}
@@ -507,28 +373,12 @@ construct_webkit_history_list (WebKitWebView *web_view,
WebKitHistoryType hist_type,
int limit)
{
-#ifdef HAVE_WEBKIT2
WebKitBackForwardList *back_forward_list;
back_forward_list = webkit_web_view_get_back_forward_list (web_view);
return hist_type == WEBKIT_HISTORY_FORWARD ?
g_list_reverse (webkit_back_forward_list_get_forward_list_with_limit (back_forward_list, limit)) :
webkit_back_forward_list_get_back_list_with_limit (back_forward_list, limit);
-#else
- WebKitWebBackForwardList *web_back_forward_list;
- GList *webkit_items;
-
- web_back_forward_list = webkit_web_view_get_back_forward_list (web_view);
-
- if (hist_type == WEBKIT_HISTORY_FORWARD)
- webkit_items = g_list_reverse (webkit_web_back_forward_list_get_forward_list_with_limit
(web_back_forward_list,
- limit));
- else
- webkit_items = webkit_web_back_forward_list_get_back_list_with_limit (web_back_forward_list,
- limit);
-
- return webkit_items;
-#endif
}
static GtkWidget *
@@ -557,25 +407,14 @@ build_dropdown_menu (EphyNavigationHistoryAction *action)
for (l = list; l != NULL; l = l->next) {
GtkWidget *item;
-#ifdef HAVE_WEBKIT2
WebKitBackForwardListItem *hitem;
-#else
- WebKitWebHistoryItem *hitem;
-#endif
const char *uri;
char *title;
-#ifdef HAVE_WEBKIT2
hitem = (WebKitBackForwardListItem *) l->data;
- uri = webkit_back_forward_list_item_get_uri (hitem);
-
+ uri = webkit_back_forward_list_item_get_uri (hitem);
title = g_strdup (webkit_back_forward_list_item_get_title (hitem));
-#else
- hitem = (WebKitWebHistoryItem *) l->data;
- uri = webkit_web_history_item_get_uri (hitem);
- title = g_strdup (webkit_web_history_item_get_title (hitem));
-#endif
/* The overview is not actually a webpage, so we need to hardcode
* this here. */
if (g_strcmp0 (uri, "ephy-about:overview") == 0)
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index b09ff55..ff88ffa 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -488,13 +488,11 @@ sync_load_status (EphyWebView *view, GParamSpec *pspec, GtkWidget *proxy)
}
}
-#ifdef HAVE_WEBKIT2
static void
load_changed_cb (EphyWebView *view, WebKitLoadEvent load_event, GtkWidget *proxy)
{
sync_load_status (view, NULL, proxy);
}
-#endif
static void
sync_icon (EphyWebView *view,
@@ -633,14 +631,8 @@ build_tab_label (EphyNotebook *nb, EphyEmbed *embed)
G_CALLBACK (sync_icon), icon, 0);
g_signal_connect_object (view, "notify::embed-title",
G_CALLBACK (sync_label), label, 0);
-#ifdef HAVE_WEBKIT2
g_signal_connect_object (view, "load-changed",
G_CALLBACK (load_changed_cb), hbox, 0);
-#else
- g_signal_connect_object (view, "notify::load-status",
- G_CALLBACK (sync_load_status), hbox, 0);
-#endif
-
return hbox;
}
diff --git a/src/ephy-session.c b/src/ephy-session.c
index ba77068..3efbc22 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -113,7 +113,6 @@ session_delete (EphySession *session,
g_object_unref (file);
}
-#ifdef HAVE_WEBKIT2
static void
load_changed_cb (WebKitWebView *view,
WebKitLoadEvent load_event,
@@ -122,22 +121,6 @@ load_changed_cb (WebKitWebView *view,
if (!ephy_web_view_load_failed (EPHY_WEB_VIEW (view)))
ephy_session_save (session, SESSION_STATE);
}
-#else
-static void
-load_status_notify_cb (EphyWebView *view,
- GParamSpec *pspec,
- EphySession *session)
-{
- WebKitLoadStatus status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view));
-
- /* We won't know the URL we are loading in PROVISIONAL because
- of bug #593149, but save session anyway */
- if (status == WEBKIT_LOAD_PROVISIONAL ||
- status == WEBKIT_LOAD_COMMITTED ||
- status == WEBKIT_LOAD_FINISHED)
- ephy_session_save (session, SESSION_STATE);
-}
-#endif
static gpointer *
parent_location_new (EphyNotebook *notebook)
@@ -205,9 +188,6 @@ closed_tab_new (GQueue *closed_tabs,
ClosedTab *sibling_tab;
tab->url = g_strdup (address);
-#ifndef HAVE_WEBKIT2
- tab->bflist = g_list_copy_deep (bflist, (GCopyFunc)webkit_web_history_item_copy, NULL);
-#endif
tab->position = position;
sibling_tab = find_tab_with_notebook (closed_tabs, parent_notebook);
@@ -251,10 +231,6 @@ ephy_session_undo_close_tab (EphySession *session)
EphySessionPrivate *priv;
EphyEmbed *embed, *new_tab;
ClosedTab *tab;
-#ifndef HAVE_WEBKIT2
- WebKitWebBackForwardList *dest;
- GList *i;
-#endif
EphyNewTabFlags flags = EPHY_NEW_TAB_OPEN_PAGE
| EPHY_NEW_TAB_PRESENT_WINDOW
| EPHY_NEW_TAB_JUMP
@@ -309,18 +285,6 @@ ephy_session_undo_close_tab (EphySession *session)
post_restore_cleanup (priv->closed_tabs, tab, TRUE);
}
- /* This is deficient: we need to recreate the whole
- * BackForward list. Also, WebKit2 doesn't have this API. */
-#ifndef HAVE_WEBKIT2
- dest = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_tab));
- for (i = tab->bflist; i; i = i->next)
- {
- LOG ("ADDING TO BF: %s",
- webkit_web_history_item_get_title ((WebKitWebHistoryItem*) i->data));
- webkit_web_back_forward_list_add_item (dest,
- webkit_web_history_item_copy ((WebKitWebHistoryItem*)
i->data));
- }
-#endif
closed_tab_free (tab);
if (g_queue_is_empty (priv->closed_tabs))
@@ -336,11 +300,7 @@ ephy_session_tab_closed (EphySession *session,
EphySessionPrivate *priv = session->priv;
EphyWebView *view;
const char *address;
-#ifdef HAVE_WEBKIT2
WebKitBackForwardList *source;
-#else
- WebKitWebBackForwardList *source;
-#endif
ClosedTab *tab;
GList *items = NULL;
@@ -348,11 +308,7 @@ ephy_session_tab_closed (EphySession *session,
address = ephy_web_view_get_address (view);
source = webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view));
-#ifdef HAVE_WEBKIT2
items = webkit_back_forward_list_get_back_list_with_limit (source, EPHY_WEBKIT_BACK_FORWARD_LIMIT);
-#else
- items = webkit_web_back_forward_list_get_back_list_with_limit (source,
EPHY_WEBKIT_BACK_FORWARD_LIMIT);
-#endif
if (items == NULL && g_strcmp0 (address, "ephy-about:overview") == 0)
return;
@@ -395,13 +351,8 @@ notebook_page_added_cb (GtkWidget *notebook,
guint position,
EphySession *session)
{
-#ifdef HAVE_WEBKIT2
g_signal_connect (ephy_embed_get_web_view (embed), "load-changed",
G_CALLBACK (load_changed_cb), session);
-#else
- g_signal_connect (ephy_embed_get_web_view (embed), "notify::load-status",
- G_CALLBACK (load_status_notify_cb), session);
-#endif
}
static void
@@ -412,15 +363,10 @@ notebook_page_removed_cb (GtkWidget *notebook,
{
ephy_session_save (session, SESSION_STATE);
-#ifdef HAVE_WEBKIT2
g_signal_handlers_disconnect_by_func
(ephy_embed_get_web_view (embed), G_CALLBACK (load_changed_cb),
session);
-#else
- g_signal_handlers_disconnect_by_func
- (ephy_embed_get_web_view (embed), G_CALLBACK (load_status_notify_cb),
- session);
-#endif
+
ephy_session_tab_closed (session, EPHY_NOTEBOOK (notebook), embed, position);
}
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 3b2fc3f..c56b977 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -581,7 +581,6 @@ ephy_shell_class_init (EphyShellClass *klass)
g_type_class_add_private (object_class, sizeof(EphyShellPrivate));
}
-#ifdef HAVE_WEBKIT2
static void
download_started_cb (WebKitWebContext *web_context,
WebKitDownload *download,
@@ -621,18 +620,14 @@ download_started_cb (WebKitWebContext *web_context,
ephy_download_new_for_download (download, window);
}
-#endif
static void
ephy_shell_init (EphyShell *shell)
{
EphyShell **ptr = &ephy_shell;
-
-#ifdef HAVE_WEBKIT2
WebKitWebContext *web_context;
EphyEmbedShellMode mode;
char *favicon_db_path;
-#endif
shell->priv = EPHY_SHELL_GET_PRIVATE (shell);
@@ -642,7 +637,6 @@ ephy_shell_init (EphyShell *shell)
g_object_add_weak_pointer (G_OBJECT (ephy_shell),
(gpointer *)ptr);
-#ifdef HAVE_WEBKIT2
web_context = webkit_web_context_get_default ();
g_signal_connect (web_context, "download-started",
G_CALLBACK (download_started_cb),
@@ -657,7 +651,6 @@ ephy_shell_init (EphyShell *shell)
webkit_web_context_set_favicon_database_directory (web_context, favicon_db_path);
g_free (favicon_db_path);
-#endif
shell->priv->search_provider = ephy_search_provider_new ();
@@ -734,11 +727,7 @@ EphyEmbed *
ephy_shell_new_tab_full (EphyShell *shell,
EphyWindow *parent_window,
EphyEmbed *previous_embed,
-#ifdef HAVE_WEBKIT2
WebKitURIRequest *request,
-#else
- WebKitNetworkRequest *request,
-#endif
EphyNewTabFlags flags,
EphyWebViewChrome chrome,
gboolean is_popup,
@@ -760,11 +749,7 @@ ephy_shell_new_tab_full (EphyShell *shell,
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
g_return_val_if_fail (EPHY_IS_WINDOW (parent_window) || !parent_window, NULL);
g_return_val_if_fail (EPHY_IS_EMBED (previous_embed) || !previous_embed, NULL);
-#ifdef HAVE_WEBKIT2
g_return_val_if_fail (WEBKIT_IS_URI_REQUEST (request) || !request, NULL);
-#else
- g_return_val_if_fail (WEBKIT_IS_NETWORK_REQUEST (request) || !request, NULL);
-#endif
embed_shell = EPHY_EMBED_SHELL (shell);
@@ -848,11 +833,7 @@ ephy_shell_new_tab_full (EphyShell *shell,
ephy_web_view_load_request (ephy_embed_get_web_view (embed),
request);
-#ifdef HAVE_WEBKIT2
is_empty = ephy_embed_utils_url_is_empty (webkit_uri_request_get_uri (request));
-#else
- is_empty = ephy_embed_utils_url_is_empty (webkit_network_request_get_uri (request));
-#endif
} else if (delayed_open_page)
ephy_embed_set_delayed_load_request (embed, request);
@@ -900,11 +881,7 @@ ephy_shell_new_tab (EphyShell *shell,
EphyNewTabFlags flags)
{
EphyEmbed *embed;
-#ifdef HAVE_WEBKIT2
WebKitURIRequest *request = url ? webkit_uri_request_new (url) : NULL;
-#else
- WebKitNetworkRequest *request = url ? webkit_network_request_new (url) : NULL;
-#endif
embed = ephy_shell_new_tab_full (shell, parent_window,
previous_embed, request, flags,
@@ -1223,11 +1200,7 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
EphyEmbed *embed;
EphyNewTabFlags page_flags;
const char *url;
-#ifdef HAVE_WEBKIT2
WebKitURIRequest *request = NULL;
-#else
- WebKitNetworkRequest *request = NULL;
-#endif
if (!data->window && !data->flags)
return FALSE;
@@ -1237,11 +1210,7 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
page_flags = EPHY_NEW_TAB_HOME_PAGE;
} else {
page_flags = EPHY_NEW_TAB_OPEN_PAGE;
-#ifdef HAVE_WEBKIT2
request = webkit_uri_request_new (url);
-#else
- request = webkit_network_request_new (url);
-#endif
}
embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 0390be3..2011fd4 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -33,11 +33,7 @@
#include "ephy-session.h"
#include "ephy-window.h"
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#include <glib-object.h>
#include <glib.h>
@@ -155,11 +151,7 @@ EphyEmbed *ephy_shell_new_tab (EphyShell *shell,
EphyEmbed *ephy_shell_new_tab_full (EphyShell *shell,
EphyWindow *parent_window,
EphyEmbed *previous_embed,
-#ifdef HAVE_WEBKIT2
WebKitURIRequest *request,
-#else
- WebKitNetworkRequest *request,
-#endif
EphyNewTabFlags flags,
EphyWebViewChrome chrome,
gboolean is_popup,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index e67d388..5be0923 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -70,11 +70,7 @@
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
#include <libwnck/libwnck.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#ifdef HAVE_X11_XF86KEYSYM_H
#include <X11/XF86keysym.h>
@@ -254,22 +250,6 @@ static const GtkActionEntry ephy_popups_entries [] = {
NULL, NULL },
{ "StopImageAnimation", NULL, N_("St_op Animation"), NULL,
NULL, NULL },
-
- /* Spelling. */
-
- { "ReplaceWithSpellingSuggestion0", NULL, NULL, NULL,
- NULL, G_CALLBACK (popup_replace_spelling), },
- { "ReplaceWithSpellingSuggestion1", NULL, NULL, NULL,
- NULL, G_CALLBACK (popup_replace_spelling), },
- { "ReplaceWithSpellingSuggestion2", NULL, NULL, NULL,
- NULL, G_CALLBACK (popup_replace_spelling), },
- { "ReplaceWithSpellingSuggestion3", NULL, NULL, NULL,
- NULL, G_CALLBACK (popup_replace_spelling), },
-
-
- /* Inspector. */
- { "InspectElement", NULL, N_("Inspect _Element"), NULL,
- NULL, G_CALLBACK (popup_cmd_inspect_element) },
};
static const struct
@@ -736,15 +716,9 @@ set_toolbar_visibility (EphyWindow *window, gboolean show_toolbar)
}
static void
-#ifdef HAVE_WEBKIT2
sync_tab_load_status (EphyWebView *view,
WebKitLoadEvent load_event,
EphyWindow *window)
-#else
-sync_tab_load_status (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-#endif
{
EphyWindowPrivate *priv = window->priv;
GtkActionGroup *action_group = priv->action_group;
@@ -838,11 +812,7 @@ ephy_window_fullscreen (EphyWindow *window)
/* sync status */
embed = window->priv->active_embed;
-#ifdef HAVE_WEBKIT2
sync_tab_load_status (ephy_embed_get_web_view (embed), WEBKIT_LOAD_STARTED, window);
-#else
- sync_tab_load_status (ephy_embed_get_web_view (embed), NULL, window);
-#endif
sync_tab_security (ephy_embed_get_web_view (embed), NULL, window);
sync_chromes_visibility (window);
@@ -1001,95 +971,6 @@ update_link_actions_sensitivity (EphyWindow *window,
ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !link_has_web_scheme);
}
-#ifndef HAVE_WEBKIT2
-static void
-update_popup_actions_visibility (EphyWindow *window,
- WebKitWebView *view,
- guint context)
-{
- GtkAction *action;
- GtkActionGroup *action_group;
- gboolean is_image = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE;
- gboolean is_editable = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE;
- GtkWidget *separator;
- char **guesses = NULL;
- int i;
-
- action_group = window->priv->popups_action_group;
-
- if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION)
- {
- action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab");
- gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow");
- gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (action_group, "ContextBookmarkPage");
- gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (action_group, "BookmarkLink");
- gtk_action_set_visible (action, FALSE);
- }
-
- action = gtk_action_group_get_action (action_group, "OpenImage");
- gtk_action_set_visible (action, is_image);
- action = gtk_action_group_get_action (action_group, "SaveImageAs");
- gtk_action_set_visible (action, is_image);
- action = gtk_action_group_get_action (action_group, "SetImageAsBackground");
- gtk_action_set_visible (action, is_image);
- action = gtk_action_group_get_action (action_group, "CopyImageLocation");
- gtk_action_set_visible (action, is_image);
-
- if (is_editable)
- {
- char *text = NULL;
- WebKitWebFrame *frame;
- WebKitDOMRange *range;
-
- frame = webkit_web_view_get_focused_frame (view);
- range = webkit_web_frame_get_range_for_word_around_caret (frame);
- text = webkit_dom_range_get_text (range);
-
- if (text && *text != '\0')
- {
- int location, length;
- WebKitSpellChecker *checker = (WebKitSpellChecker*)webkit_get_text_checker();
- webkit_spell_checker_check_spelling_of_string (checker, text, &location, &length);
- if (length)
- guesses = webkit_spell_checker_get_guesses_for_word (checker, text, NULL);
-
- }
-
- g_free (text);
- }
-
- for (i = 0; i < MAX_SPELL_CHECK_GUESSES; i++)
- {
- char *action_name;
-
- action_name = g_strdup_printf("ReplaceWithSpellingSuggestion%d", i);
- action = gtk_action_group_get_action (action_group, action_name);
-
- if (guesses && i <= g_strv_length (guesses)) {
- gtk_action_set_visible (action, TRUE);
- gtk_action_set_label (action, guesses[i]);
- } else
- gtk_action_set_visible (action, FALSE);
-
- g_free (action_name);
- }
-
- /* The separator! There must be a better way to do this? */
- separator = gtk_ui_manager_get_widget (window->priv->manager,
- "/EphyInputPopup/SpellingSeparator");
- if (guesses)
- gtk_widget_show (separator);
- else
- gtk_widget_hide (separator);
-
- if (guesses)
- g_strfreev (guesses);
-}
-#endif
-
static void
update_edit_action_sensitivity (EphyWindow *window, const gchar *action_name, gboolean sensitive, gboolean
hide)
{
@@ -1100,7 +981,6 @@ update_edit_action_sensitivity (EphyWindow *window, const gchar *action_name, gb
gtk_action_set_visible (action, !hide || sensitive);
}
-#ifdef HAVE_WEBKIT2
typedef struct
{
EphyWindow *window;
@@ -1150,7 +1030,6 @@ can_edit_command_callback (GObject *object, GAsyncResult *result, CanEditCommand
can_edit_command_async_data_free (data);
}
-#endif
static void
update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
@@ -1178,16 +1057,13 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
{
EphyEmbed *embed;
WebKitWebView *view;
-#ifdef HAVE_WEBKIT2
CanEditCommandAsyncData *data;
-#endif
embed = window->priv->active_embed;
g_return_if_fail (embed != NULL);
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
data = can_edit_command_async_data_new (window, "EditCopy", hide);
webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_COPY, NULL,
(GAsyncReadyCallback)can_edit_command_callback,
@@ -1209,13 +1085,6 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
(GAsyncReadyCallback)can_edit_command_callback,
data);
return;
-#else
- can_copy = webkit_web_view_can_copy_clipboard (view);
- can_cut = webkit_web_view_can_cut_clipboard (view);
- can_paste = webkit_web_view_can_paste_clipboard (view);
- can_undo = webkit_web_view_can_undo (view);
- can_redo = webkit_web_view_can_redo (view);
-#endif
}
update_edit_action_sensitivity (window, "EditCopy", can_copy, hide);
@@ -1616,11 +1485,6 @@ _ephy_window_set_default_actions_sensitive (EphyWindow *window,
ephy_action_change_sensitivity_flags (action,
flags, set);
- action = gtk_action_group_get_action (priv->popups_action_group,
- "InspectElement");
- ephy_action_change_sensitivity_flags (action,
- flags, set);
-
/* Toolbar */
action = gtk_action_group_get_action (priv->toolbar_action_group,
"ViewCombinedStopReload");
@@ -1691,27 +1555,6 @@ sync_tab_title (EphyWebView *view,
ephy_web_view_get_title_composite (view));
}
-#ifndef HAVE_WEBKIT2
-static void
-popup_menu_at_coords (GtkMenu *menu, gint *x, gint *y, gboolean *push_in,
- gpointer user_data)
-{
- EphyWindow *window = EPHY_WINDOW (user_data);
- EphyWindowPrivate *priv = window->priv;
- guint ux, uy;
-
- g_return_if_fail (priv->context_event != NULL);
-
- ephy_embed_event_get_coords (priv->context_event, &ux, &uy);
- *x = ux; *y = uy;
-
- /* FIXME: better position the popup within the window bounds? */
- ephy_gui_sanitise_popup_position (menu, GTK_WIDGET (window), x, y);
-
- *push_in = TRUE;
-}
-#endif
-
static gboolean
idle_unref_context_event (EphyWindow *window)
{
@@ -1764,7 +1607,6 @@ _ephy_window_unset_context_event (EphyWindow *window)
}
}
-#ifdef HAVE_WEBKIT2
static void
context_menu_dismissed_cb (WebKitWebView *webView,
EphyWindow *window)
@@ -1778,23 +1620,7 @@ context_menu_dismissed_cb (WebKitWebView *webView,
_ephy_window_unset_context_event (window);
}
-#else
-static void
-embed_popup_deactivate_cb (GtkWidget *popup,
- EphyWindow *window)
-{
- LOG ("Deactivating popup menu");
-
- enable_edit_actions_sensitivity (window);
-
- g_signal_handlers_disconnect_by_func
- (popup, G_CALLBACK (embed_popup_deactivate_cb), window);
-
- _ephy_window_unset_context_event (window);
-}
-#endif
-#ifdef HAVE_WEBKIT2
static void
add_action_to_context_menu (WebKitContextMenu *context_menu,
GtkActionGroup *action_group,
@@ -2044,87 +1870,6 @@ populate_context_menu (WebKitWebView *web_view,
return FALSE;
}
-#else
-static void
-show_embed_popup (EphyWindow *window,
- WebKitWebView *view,
- GdkEventButton *event,
- WebKitHitTestResult *hit_test_result)
-{
- EphyWindowPrivate *priv = window->priv;
- guint context;
- const char *popup;
- gboolean can_open_in_new;
- gboolean mailto;
- GtkWidget *widget;
- guint button;
- char *uri;
- EphyEmbedEvent *embed_event;
-
- g_object_get (hit_test_result, "link-uri", &uri, NULL);
- can_open_in_new = uri && ephy_embed_utils_address_has_web_scheme (uri);
- mailto = g_str_has_prefix (uri, "mailto:");
- g_free (uri);
-
- g_object_get (hit_test_result, "context", &context, NULL);
-
- LOG ("show_embed_popup context %x", context);
-
- if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
- {
- GtkAction *action;
-
- action = gtk_action_group_get_action (priv->popups_action_group, "CopyEmailAddress");
- gtk_action_set_visible (action, mailto);
- action = gtk_action_group_get_action (priv->popups_action_group, "CopyLinkAddress");
- gtk_action_set_visible (action, !mailto);
-
- popup = "/EphyLinkPopup";
- update_edit_actions_sensitivity (window, TRUE);
- }
- else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE)
- {
- popup = "/EphyInputPopup";
- update_edit_actions_sensitivity (window, FALSE);
- }
- else
- {
- popup = "/EphyDocumentPopup";
- update_edit_actions_sensitivity (window, TRUE);
- }
-
- widget = gtk_ui_manager_get_widget (priv->manager, popup);
- g_return_if_fail (widget != NULL);
-
- update_link_actions_sensitivity (window, can_open_in_new);
- update_popup_actions_visibility (window,
- view,
- context);
-
- embed_event = ephy_embed_event_new (event, hit_test_result);
- _ephy_window_set_context_event (window, embed_event);
- g_object_unref (embed_event);
-
- g_signal_connect (widget, "deactivate",
- G_CALLBACK (embed_popup_deactivate_cb), window);
-
- button = event->button;
-
- if (button == 0)
- {
- gtk_menu_popup (GTK_MENU (widget), NULL, NULL,
- popup_menu_at_coords, window, 0,
- gtk_get_current_event_time ());
- gtk_menu_shell_select_first (GTK_MENU_SHELL (widget), FALSE);
- }
- else
- {
- gtk_menu_popup (GTK_MENU (widget), NULL, NULL,
- NULL, NULL, button,
- gtk_get_current_event_time ());
- }
-}
-#endif
static gboolean
save_target_uri (EphyWindow *window,
@@ -2185,23 +1930,13 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
WebKitHitTestResult *hit_test_result;
gboolean handled = FALSE;
-#ifdef HAVE_WEBKIT2
hit_test_result = g_object_ref (window->priv->hit_test_result);
-#else
- hit_test_result = webkit_web_view_get_hit_test_result (view, event);
-#endif
switch (event->button)
{
case GDK_BUTTON_PRIMARY:
handled = save_target_uri (window, view, event, hit_test_result);
break;
-#ifndef HAVE_WEBKIT2
- case GDK_BUTTON_SECONDARY:
- show_embed_popup (window, view, event, hit_test_result);
- handled = TRUE;
- break;
-#endif
default:
break;
}
@@ -2211,7 +1946,6 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
return handled;
}
-#ifdef HAVE_WEBKIT2
static void
ephy_window_mouse_target_changed_cb (WebKitWebView *web_view,
WebKitHitTestResult *hit_test_result,
@@ -2224,7 +1958,6 @@ ephy_window_mouse_target_changed_cb (WebKitWebView *web_view,
g_object_unref (priv->hit_test_result);
priv->hit_test_result = g_object_ref (hit_test_result);
}
-#endif
static void
sync_embed_is_overview (EphyEmbed *embed, GParamSpec *pspec, EphyWindow *window)
@@ -2255,7 +1988,6 @@ ephy_window_set_is_popup (EphyWindow *window,
g_object_notify (G_OBJECT (window), "is-popup");
}
-#ifdef HAVE_WEBKIT2
static void
ephy_window_configure_for_view (EphyWindow *window,
WebKitWebView *web_view)
@@ -2285,41 +2017,6 @@ ephy_window_configure_for_view (EphyWindow *window,
sync_chromes_visibility (window);
}
}
-#else
-static void
-ephy_window_configure_for_view (EphyWindow *window,
- WebKitWebView *web_view)
-{
- int width, height;
- gboolean toolbar_visible;
- EphyWebViewChrome chrome_mask;
- WebKitWebWindowFeatures *features;
-
- toolbar_visible = TRUE;
- features = webkit_web_view_get_window_features (web_view);
-
- chrome_mask = window->priv->chrome;
-
- g_object_get (features,
- "width", &width,
- "height", &height,
- "toolbar-visible", &toolbar_visible,
- NULL);
-
- if (!toolbar_visible)
- chrome_mask &= ~EPHY_WEB_VIEW_CHROME_TOOLBAR;
-
- /* We will consider windows with different chrome settings popups. */
- if (chrome_mask != window->priv->chrome) {
- gtk_window_set_default_size (GTK_WINDOW (window), width, height);
-
- window->priv->is_popup = TRUE;
- window->priv->chrome = chrome_mask;
-
- sync_chromes_visibility (window);
- }
-}
-#endif
static gboolean
web_view_ready_cb (WebKitWebView *web_view,
@@ -2344,16 +2041,9 @@ web_view_ready_cb (WebKitWebView *web_view,
return TRUE;
}
-#ifdef HAVE_WEBKIT2
-static WebKitWebView *
-create_web_view_cb (WebKitWebView *web_view,
- EphyWindow *window)
-#else
static WebKitWebView *
create_web_view_cb (WebKitWebView *web_view,
- WebKitWebFrame *frame,
EphyWindow *window)
-#endif
{
EphyEmbed *embed;
WebKitWebView *new_web_view;
@@ -2385,15 +2075,9 @@ create_web_view_cb (WebKitWebView *web_view,
0);
new_web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-#ifdef HAVE_WEBKIT2
g_signal_connect (new_web_view, "ready-to-show",
G_CALLBACK (web_view_ready_cb),
web_view);
-#else
- g_signal_connect (new_web_view, "web-view-ready",
- G_CALLBACK (web_view_ready_cb),
- web_view);
-#endif
return new_web_view;
}
@@ -2420,7 +2104,6 @@ delete_web_app (const char *request_uri)
soup_uri_free (uri);
}
-#ifdef HAVE_WEBKIT2
static gboolean
decide_policy_cb (WebKitWebView *web_view,
WebKitPolicyDecision *decision,
@@ -2572,148 +2255,6 @@ decide_policy_cb (WebKitWebView *web_view,
return FALSE;
}
-#else
-static gboolean
-policy_decision_required_cb (WebKitWebView *web_view,
- WebKitWebFrame *web_frame,
- WebKitNetworkRequest *request,
- WebKitWebNavigationAction *action,
- WebKitWebPolicyDecision *decision,
- EphyWindow *window)
-{
- WebKitWebNavigationReason reason;
- gint button;
- gint state;
- const char *uri;
-
- reason = webkit_web_navigation_action_get_reason (action);
- button = webkit_web_navigation_action_get_button (action);
- state = webkit_web_navigation_action_get_modifier_state (action);
- uri = webkit_network_request_get_uri (request);
-
- if (!ephy_embed_utils_address_has_web_scheme (uri))
- {
- GError *error = NULL;
- GdkScreen *screen;
-
- screen = gtk_widget_get_screen (GTK_WIDGET (web_view));
- gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error);
-
- if (error)
- {
- LOG ("failed to handle non web scheme: %s", error->message);
- g_error_free (error);
-
- return FALSE;
- }
-
- webkit_web_policy_decision_ignore (decision);
-
- return TRUE;
- }
-
- if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED &&
- ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION)
- {
- /* The only thing we allow here is to either navigate
- * in the same window and tab to the current domain,
- * or launch a new (non app mode) epiphany instance
- * for all the other cases. */
- gboolean return_value;
- SoupURI *soup_uri = soup_uri_new (uri);
- SoupURI *current_soup_uri = soup_uri_new (webkit_web_view_get_uri (web_view));
-
- if (g_str_equal (soup_uri->host, current_soup_uri->host))
- {
- return_value = FALSE;
- }
- else
- {
- char *command_line;
- GError *error = NULL;
-
- return_value = TRUE;
-
- command_line = g_strdup_printf ("gvfs-open %s", uri);
- g_spawn_command_line_async (command_line, &error);
-
- if (error)
- {
- g_debug ("Error opening %s: %s", uri, error->message);
- g_error_free (error);
- }
-
- g_free (command_line);
- }
-
- soup_uri_free (soup_uri);
- soup_uri_free (current_soup_uri);
-
- return return_value;
- }
-
- if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
- EphyEmbed *embed;
- EphyNewTabFlags flags;
-
- flags = EPHY_NEW_TAB_OPEN_PAGE;
-
- ephy_web_view_set_visit_type (EPHY_WEB_VIEW (web_view),
- EPHY_PAGE_VISIT_LINK);
-
- /* New tab in new window for control+shift+click */
- if (button == 1 &&
- state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
- {
- flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
- }
- /* New tab in existing window for middle click and
- * control+click */
- else if (button == 2 ||
- (button == 1 && state == GDK_CONTROL_MASK))
- {
- flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_APPEND_AFTER;
- }
- /* Because we connect to button-press-event *after*
- * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to
- * a link when you shift+click it. Otherwise when you
- * shift+click a link to download it you would also be taken to
- * the link destination. */
- else if (button == 1 && state == GDK_SHIFT_MASK)
- {
- return TRUE;
- }
- /* Those were our special cases, we won't handle this */
- else
- {
- return FALSE;
- }
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
-
- ephy_shell_new_tab_full (ephy_shell_get_default (),
- window,
- embed,
- request,
- flags,
- EPHY_WEB_VIEW_CHROME_ALL, FALSE, 0);
-
- return TRUE;
- }
-
- if (reason == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED && uri &&
- g_str_has_prefix (uri, "ephy-about:applications"))
- {
- delete_web_app (uri);
- webkit_web_policy_decision_use (decision);
-
- return TRUE;
- }
-
- return FALSE;
-}
-#endif
static void
ephy_window_connect_active_embed (EphyWindow *window)
@@ -2732,11 +2273,7 @@ ephy_window_connect_active_embed (EphyWindow *window)
sync_tab_security (view, NULL, window);
sync_tab_document_type (view, NULL, window);
-#ifdef HAVE_WEBKIT2
sync_tab_load_status (view, WEBKIT_LOAD_STARTED, window);
-#else
- sync_tab_load_status (view, NULL, window);
-#endif
sync_tab_is_blank (view, NULL, window);
sync_tab_navigation (view, NULL, window);
sync_tab_title (view, NULL, window);
@@ -2752,28 +2289,12 @@ ephy_window_connect_active_embed (EphyWindow *window)
G_CALLBACK (sync_tab_zoom),
window, 0);
-#ifdef HAVE_WEBKIT2
g_signal_connect_object (web_view, "create",
G_CALLBACK (create_web_view_cb),
window, 0);
-#else
- g_signal_connect_object (web_view, "create-web-view",
- G_CALLBACK (create_web_view_cb),
- window, 0);
-#endif
-#ifdef HAVE_WEBKIT2
g_signal_connect_object (web_view, "decide-policy",
G_CALLBACK (decide_policy_cb),
window, 0);
-#else
- g_signal_connect_object (web_view, "navigation-policy-decision-requested",
- G_CALLBACK (policy_decision_required_cb),
- window, 0);
- g_signal_connect_object (web_view, "new-window-policy-decision-requested",
- G_CALLBACK (policy_decision_required_cb),
- window, 0);
-#endif
-
g_signal_connect_object (view, "notify::hidden-popup-count",
G_CALLBACK (sync_tab_popup_windows),
window, 0);
@@ -2795,22 +2316,15 @@ ephy_window_connect_active_embed (EphyWindow *window)
g_signal_connect_object (view, "notify::document-type",
G_CALLBACK (sync_tab_document_type),
window, 0);
-#ifndef HAVE_WEBKIT2
- g_signal_connect_object (view, "notify::load-status",
- G_CALLBACK (sync_tab_load_status),
- window, 0);
-#else
g_signal_connect_object (view, "load-changed",
G_CALLBACK (sync_tab_load_status),
window, 0);
-#endif
g_signal_connect_object (view, "notify::navigation",
G_CALLBACK (sync_tab_navigation),
window, 0);
g_signal_connect_object (view, "notify::is-blank",
G_CALLBACK (sync_tab_is_blank),
window, 0);
-#ifdef HAVE_WEBKIT2
g_signal_connect_object (view, "button-press-event",
G_CALLBACK (ephy_window_dom_mouse_click_cb),
window, 0);
@@ -2820,16 +2334,6 @@ ephy_window_connect_active_embed (EphyWindow *window)
g_signal_connect_object (view, "mouse-target-changed",
G_CALLBACK (ephy_window_mouse_target_changed_cb),
window, 0);
-#else
- /* We run our button-press-event after the default
- * handler to make sure pages have a chance to perform
- * their own handling - for instance, have their own
- * context menus, or provide specific functionality
- * for the right mouse button */
- g_signal_connect_object (view, "button-press-event",
- G_CALLBACK (ephy_window_dom_mouse_click_cb),
- window, G_CONNECT_AFTER);
-#endif
g_signal_connect_object (embed, "notify::overview-mode",
G_CALLBACK (sync_embed_is_overview),
window, 0);
@@ -2852,9 +2356,6 @@ ephy_window_disconnect_active_embed (EphyWindow *window)
WebKitWebView *web_view;
EphyWebView *view;
EphyOverview *overview;
-#ifndef HAVE_WEBKIT2
- guint sid;
-#endif
EphyEmbedShellMode shell_mode;
g_return_if_fail (window->priv->active_embed != NULL);
@@ -2869,31 +2370,9 @@ ephy_window_disconnect_active_embed (EphyWindow *window)
g_signal_handlers_disconnect_by_func (web_view,
G_CALLBACK (create_web_view_cb),
window);
-#ifdef HAVE_WEBKIT2
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (decide_policy_cb),
window);
-#else
- sid = g_signal_lookup ("navigation-policy-decision-requested",
- WEBKIT_TYPE_WEB_VIEW);
- g_signal_handlers_disconnect_matched (web_view,
- G_SIGNAL_MATCH_ID |
- G_SIGNAL_MATCH_FUNC,
- sid,
- 0, NULL,
- G_CALLBACK (policy_decision_required_cb),
- NULL);
- sid = g_signal_lookup ("new-window-policy-decision-requested",
- WEBKIT_TYPE_WEB_VIEW);
- g_signal_handlers_disconnect_matched (web_view,
- G_SIGNAL_MATCH_ID |
- G_SIGNAL_MATCH_FUNC,
- sid,
- 0, NULL,
- G_CALLBACK (policy_decision_required_cb),
- NULL);
-#endif
-
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (sync_tab_popup_windows),
window);
@@ -2939,14 +2418,12 @@ ephy_window_disconnect_active_embed (EphyWindow *window)
g_signal_handlers_disconnect_by_func
(view, G_CALLBACK (ephy_window_dom_mouse_click_cb), window);
-#ifdef HAVE_WEBKIT2
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (populate_context_menu),
window);
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (ephy_window_mouse_target_changed_cb),
window);
-#endif
}
static void
@@ -3987,10 +3464,6 @@ ephy_window_constructor (GType type,
ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (priv->popups_action_group, "InspectElement");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
- gtk_action_set_visible (action, FALSE);
-
for (i = 0; i < G_N_ELEMENTS (disabled_actions_for_app_mode); i++)
{
action = gtk_action_group_get_action (priv->action_group,
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 46d20ca..9c2a606 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -39,11 +39,7 @@
#define SECRET_API_SUBJECT_TO_CHANGE
#include <libsecret/secret.h>
#include <libsoup/soup.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#include <string.h>
#include <time.h>
@@ -167,7 +163,6 @@ typedef struct
guint num_checked;
} PdmClearAllDialogButtons;
-#ifdef HAVE_WEBKIT2
static WebKitCookieManager *
get_cookie_manager (void)
{
@@ -176,16 +171,6 @@ get_cookie_manager (void)
web_context = webkit_web_context_get_default ();
return webkit_web_context_get_cookie_manager (web_context);
}
-#else
-static SoupCookieJar*
-get_cookie_jar (void)
-{
- SoupSession* session;
-
- session = webkit_get_default_session ();
- return (SoupCookieJar*)soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
-}
-#endif
static void
clear_all_dialog_release_cb (PdmClearAllDialogButtons *data)
@@ -193,20 +178,6 @@ clear_all_dialog_release_cb (PdmClearAllDialogButtons *data)
g_slice_free (PdmClearAllDialogButtons, data);
}
-#ifndef HAVE_WEBKIT2
-static void
-clear_all_cookies (SoupCookieJar *jar)
-{
- GSList *l, *p;
-
- l = soup_cookie_jar_all_cookies (jar);
- for (p = l; p; p = p->next)
- soup_cookie_jar_delete_cookie (jar, (SoupCookie*)p->data);
-
- soup_cookies_free (l);
-}
-#endif
-
static void
_ephy_pdm_delete_all_passwords (void)
{
@@ -247,17 +218,10 @@ clear_all_dialog_response_cb (GtkDialog *dialog,
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (checkbuttons->checkbutton_cookies)))
{
-#ifdef HAVE_WEBKIT2
WebKitCookieManager *cookie_manager;
cookie_manager = get_cookie_manager ();
webkit_cookie_manager_delete_all_cookies (cookie_manager);
-#else
- SoupCookieJar *jar;
-
- jar = get_cookie_jar ();
- clear_all_cookies (jar);
-#endif
}
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (checkbuttons->checkbutton_passwords)))
@@ -282,11 +246,7 @@ clear_all_dialog_response_cb (GtkDialog *dialog,
ephy_embed_shell_clear_cache (shell);
-#ifdef HAVE_WEBKIT2
database = webkit_web_context_get_favicon_database (webkit_web_context_get_default
());
-#else
- database = webkit_get_favicon_database ();
-#endif
webkit_favicon_database_clear (database);
}
}
@@ -514,11 +474,7 @@ pdm_cmd_delete_selection (PdmActionInfo *action)
path = gtk_tree_row_reference_get_path ((GtkTreeRowReference *)r->data);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get_value (model, &iter, action->data_col, &val);
-#ifdef HAVE_WEBKIT2
action->remove (action, (gpointer)g_value_get_string (&val));
-#else
- action->remove (action, G_VALUE_HOLDS_OBJECT (&val) ? g_value_get_object (&val) :
g_value_get_boxed (&val));
-#endif
g_value_unset (&val);
/* for cookies we delete from callback, for passwords right here */
@@ -691,22 +647,6 @@ cookies_properties_clicked_cb (GtkWidget *button,
g_list_free (l);
}
-#ifndef HAVE_WEBKIT2
-static void
-cookies_treeview_selection_changed_cb (GtkTreeSelection *selection,
- PdmDialog *dialog)
-{
- GtkWidget *widget;
- EphyDialog *d = EPHY_DIALOG(dialog);
- gboolean has_selection;
-
- has_selection = gtk_tree_selection_count_selected_rows (selection) == 1;
-
- widget = ephy_dialog_get_control (d, "cookies_properties_button");
- gtk_widget_set_sensitive (widget, has_selection);
-}
-#endif
-
static gboolean
cookie_search_equal (GtkTreeModel *model,
int column,
@@ -760,13 +700,6 @@ pdm_dialog_cookies_construct (PdmActionInfo *info)
info->model = GTK_TREE_MODEL (liststore);
g_object_unref (liststore);
-#ifdef HAVE_WEBKIT2
- /* Cookies properties are not available in WebKit2 */
-#else
- g_signal_connect (selection, "changed",
- G_CALLBACK(cookies_treeview_selection_changed_cb),
- dialog);
-#endif
renderer = gtk_cell_renderer_text_new ();
@@ -806,7 +739,6 @@ pdm_dialog_cookies_construct (PdmActionInfo *info)
setup_action (info);
}
-#ifdef HAVE_WEBKIT2
static void
cookie_changed_cb (WebKitCookieManager *cookie_manager,
PdmDialog *dialog)
@@ -820,75 +752,6 @@ cookie_changed_cb (WebKitCookieManager *cookie_manager,
info->filled = FALSE;
info->fill (info);
}
-#else
-static gboolean
-cookie_to_iter (GtkTreeModel *model,
- const SoupCookie *cookie,
- GtkTreeIter *iter)
-{
- gboolean valid;
- gboolean found = FALSE;
-
- valid = gtk_tree_model_get_iter_first (model, iter);
-
- while (valid)
- {
- SoupCookie *data;
-
- gtk_tree_model_get (model, iter,
- COL_COOKIES_DATA, &data,
- -1);
-
- found = soup_cookie_equal ((SoupCookie*)cookie, data);
-
- soup_cookie_free (data);
-
- if (found) break;
-
- valid = gtk_tree_model_iter_next (model, iter);
- }
-
- return found;
-}
-
-static void
-cookie_changed_cb (SoupCookieJar *jar,
- const SoupCookie *old_cookie,
- const SoupCookie *new_cookie,
- PdmDialog *dialog)
-{
- PdmActionInfo *info;
- GtkTreeIter iter;
-
- g_return_if_fail (EPHY_IS_PDM_DIALOG (dialog));
- info = dialog->priv->cookies;
-
- LOG ("cookie_changed_cb");
-
- g_return_if_fail (info);
-
- if (old_cookie)
- {
- /* Cookie changed or deleted, let's get rid of the old one
- in any case */
- if (cookie_to_iter (info->model, old_cookie, &iter))
- {
- gtk_list_store_remove (GTK_LIST_STORE (info->model), &iter);
- }
- else
- {
- g_warning ("Unable to find changed cookie in list!\n");
- }
- }
-
- if (new_cookie)
- {
- /* Cookie changed or added, let's add the new cookie in
- any case */
- info->add (info, (gpointer) soup_cookie_copy ((SoupCookie*)new_cookie));
- }
-}
-#endif
static gboolean
cookie_host_to_iter (GtkTreeModel *model,
@@ -978,7 +841,6 @@ compare_cookie_host_keys (GtkTreeModel *model,
return retval;
}
-#ifdef HAVE_WEBKIT2
static void
get_domains_with_cookies_cb (WebKitCookieManager *cookie_manager,
GAsyncResult *result,
@@ -1014,12 +876,10 @@ get_domains_with_cookies_cb (WebKitCookieManager *cookie_manager,
info->filled = TRUE;
info->scroll_to (info);
}
-#endif
static void
pdm_dialog_fill_cookies_list (PdmActionInfo *info)
{
-#ifdef HAVE_WEBKIT2
WebKitCookieManager *cookie_manager;
g_assert (info->filled == FALSE);
@@ -1028,39 +888,6 @@ pdm_dialog_fill_cookies_list (PdmActionInfo *info)
webkit_cookie_manager_get_domains_with_cookies (cookie_manager, NULL,
(GAsyncReadyCallback) get_domains_with_cookies_cb,
info);
-#else
- SoupCookieJar *jar;
- GSList *list, *l;
-
- g_assert (info->filled == FALSE);
-
- jar = get_cookie_jar ();
- list = soup_cookie_jar_all_cookies (jar);
-
- for (l = list; l != NULL; l = l->next)
- {
- info->add (info, l->data);
- }
-
- /* the element data has been consumed, so we need only to free the list */
- g_slist_free (list);
-
- /* Now turn on sorting */
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (info->model),
- COL_COOKIES_HOST_KEY,
- (GtkTreeIterCompareFunc) compare_cookie_host_keys,
- NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (info->model),
- COL_COOKIES_HOST_KEY,
- GTK_SORT_ASCENDING);
-
- info->filled = TRUE;
-
- g_signal_connect (jar, "changed",
- G_CALLBACK (cookie_changed_cb), info->dialog);
-
- info->scroll_to (info);
-#endif
}
static void
@@ -1074,11 +901,7 @@ static void
pdm_dialog_cookie_add (PdmActionInfo *info,
gpointer data)
{
-#ifdef HAVE_WEBKIT2
char *domain = (char *) data;
-#else
- SoupCookie *cookie = (SoupCookie *) data;
-#endif
GtkListStore *store;
GtkTreeIter iter;
int column[4] = { COL_COOKIES_HOST, COL_COOKIES_HOST_KEY, COL_COOKIES_NAME, COL_COOKIES_DATA };
@@ -1097,15 +920,8 @@ pdm_dialog_cookie_add (PdmActionInfo *info,
g_value_init (&value[2], G_TYPE_STRING);
g_value_init (&value[3], SOUP_TYPE_COOKIE);
-#ifdef HAVE_WEBKIT2
g_value_set_static_string (&value[0], domain);
g_value_take_string (&value[1], ephy_string_collate_key_for_domain (domain, -1));
-#else
- g_value_set_static_string (&value[0], cookie->domain);
- g_value_take_string (&value[1], ephy_string_collate_key_for_domain (cookie->domain, -1));
- g_value_set_static_string (&value[2], cookie->name);
- g_value_take_boxed (&value[3], cookie);
-#endif
gtk_list_store_insert_with_valuesv (store, &iter, -1,
column, value,
@@ -1121,17 +937,10 @@ static void
pdm_dialog_cookie_remove (PdmActionInfo *info,
gpointer data)
{
-#ifdef HAVE_WEBKIT2
const char *domain = (const char *) data;
webkit_cookie_manager_delete_cookies_for_domain (get_cookie_manager (),
domain);
-
-#else
- SoupCookie *cookie = (SoupCookie *) data;
-
- soup_cookie_jar_delete_cookie (get_cookie_jar(), cookie);
-#endif
}
static void
@@ -1554,11 +1363,7 @@ pdm_dialog_init (PdmDialog *dialog)
cookies->scroll_to = pdm_dialog_cookie_scroll_to;
cookies->dialog = dialog;
cookies->remove_id = "cookies_remove_button";
-#ifdef HAVE_WEBKIT2
cookies->data_col = COL_COOKIES_HOST;
-#else
- cookies->data_col = COL_COOKIES_DATA;
-#endif
cookies->scroll_to_host = NULL;
cookies->filled = FALSE;
cookies->delete_row_on_remove = FALSE;
@@ -1593,11 +1398,7 @@ pdm_dialog_finalize (GObject *object)
{
PdmDialog *dialog = EPHY_PDM_DIALOG (object);
-#ifdef HAVE_WEBKIT2
g_signal_handlers_disconnect_by_func (get_cookie_manager (), cookie_changed_cb, object);
-#else
- g_signal_handlers_disconnect_by_func (get_cookie_jar (), cookie_changed_cb, object);
-#endif
dialog->priv->cookies->destruct (dialog->priv->cookies);
dialog->priv->passwords->destruct (dialog->priv->passwords);
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 2896fb2..102fe5e 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -36,11 +36,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
void
popup_cmd_link_in_new_window (GtkAction *action,
@@ -95,7 +91,6 @@ void
popup_cmd_bookmark_link (GtkAction *action,
EphyWindow *window)
{
-#ifdef HAVE_WEBKIT2
EphyEmbedEvent *event;
WebKitHitTestResult *result;
const char *title;
@@ -117,64 +112,6 @@ popup_cmd_bookmark_link (GtkAction *action,
}
ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (window), location, title);
-#else
- EphyEmbedEvent *event;
- char *title;
- char *location = NULL;
- guint context;
- WebKitHitTestResult *result;
- WebKitDOMNode *node, *first_child;
-
- event = ephy_window_get_context_event (window);
- g_return_if_fail (event != NULL);
-
- result = ephy_embed_event_get_hit_test_result (event);
- g_object_get (result, "context", &context, NULL);
- g_object_get (result, "inner-node", &node, NULL);
-
- if (context != WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
- {
- node = WEBKIT_DOM_NODE (webkit_dom_node_get_parent_element (WEBKIT_DOM_NODE (node)));
- if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (node))
- location = webkit_dom_html_anchor_element_get_href (WEBKIT_DOM_HTML_ANCHOR_ELEMENT
(node));
- }
- else
- {
- g_object_get (result, "link-uri", &location, NULL);
- }
-
- if (!node || !location)
- return;
-
- title = webkit_dom_html_element_get_title (WEBKIT_DOM_HTML_ELEMENT (node));
-
- if (title == NULL || title[0] == '\0')
- {
- title = webkit_dom_html_anchor_element_get_text (WEBKIT_DOM_HTML_ANCHOR_ELEMENT (node));
- }
-
- /* Sometimes boorkmaklets are presented as images inside a
- * link, try that. */
- if (title == NULL || title[0] == '\0')
- {
- first_child = webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (node));
- if (first_child && WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT (first_child))
- {
- title = webkit_dom_html_image_element_get_alt (WEBKIT_DOM_HTML_IMAGE_ELEMENT
(first_child));
- if (title == NULL || title[0] == '\0')
- title = webkit_dom_html_image_element_get_name (WEBKIT_DOM_HTML_IMAGE_ELEMENT
(first_child));
- }
- }
-
- if (title == NULL || title[0] == '\0')
- {
- title = location;
- }
-
- ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (window), location, title);
- g_free (title);
- g_free (location);
-#endif
}
static void
@@ -488,35 +425,6 @@ save_temp_source (const char *address)
}
void
-popup_replace_spelling (GtkAction *action,
- EphyWindow *window)
-{
-#ifndef HAVE_WEBKIT2
- EphyEmbed *embed;
- WebKitWebView *view;
- WebKitWebFrame *frame;
- WebKitDOMDOMSelection *selection;
- WebKitDOMDocument *document;
- WebKitDOMDOMWindow *default_view;
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
- g_return_if_fail (embed != NULL);
-
- view = WEBKIT_WEB_VIEW (ephy_embed_get_web_view (embed));
- g_return_if_fail (view != NULL);
-
- document = webkit_web_view_get_dom_document (view);
- default_view = webkit_dom_document_get_default_view (document);
- selection = webkit_dom_dom_window_get_selection (default_view);
- webkit_dom_dom_selection_modify (selection, "move", "backward", "word");
- webkit_dom_dom_selection_modify (selection, "extend", "forward", "word");
- frame = webkit_web_view_get_focused_frame (view);
- webkit_web_frame_replace_selection (frame, gtk_action_get_label (action));
-#endif
-}
-
-void
popup_cmd_open_image (GtkAction *action,
EphyWindow *window)
{
@@ -558,25 +466,3 @@ popup_cmd_open_image (GtkAction *action,
g_free (scheme);
}
-void
-popup_cmd_inspect_element (GtkAction *action, EphyWindow *window)
-{
-#ifndef HAVE_WEBKIT2
- EphyEmbedEvent *event;
- EphyEmbed *embed;
- WebKitWebInspector *inspector;
- guint x, y;
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
-
- event = ephy_window_get_context_event (window);
- g_return_if_fail (event != NULL);
-
- inspector = webkit_web_view_get_inspector
- (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-
- ephy_embed_event_get_coords (event, &x, &y);
- webkit_web_inspector_inspect_coordinates (inspector, (gdouble)x, (gdouble)y);
-#endif
-}
diff --git a/src/popup-commands.h b/src/popup-commands.h
index cabecdf..4301ef3 100644
--- a/src/popup-commands.h
+++ b/src/popup-commands.h
@@ -63,9 +63,3 @@ void popup_cmd_download_link (GtkAction *action,
void popup_cmd_save_image_as (GtkAction *action,
EphyWindow *window);
-void popup_cmd_inspect_element (GtkAction *action,
- EphyWindow *window);
-
-void popup_replace_spelling (GtkAction *action,
- EphyWindow *window);
-
diff --git a/src/resources/epiphany-ui.xml b/src/resources/epiphany-ui.xml
index 2faa796..c4854ec 100644
--- a/src/resources/epiphany-ui.xml
+++ b/src/resources/epiphany-ui.xml
@@ -1,10 +1,5 @@
<ui>
<popup name="EphyInputPopup" action="PopupAction">
- <menuitem name="SpellingSuggestion0" action="ReplaceWithSpellingSuggestion0"/>
- <menuitem name="SpellingSuggestion1" action="ReplaceWithSpellingSuggestion1"/>
- <menuitem name="SpellingSuggestion2" action="ReplaceWithSpellingSuggestion2"/>
- <menuitem name="SpellingSuggestion3" action="ReplaceWithSpellingSuggestion3"/>
- <separator name="SpellingSeparator"/>
<menuitem name="EditCutIP" action="EditCut"/>
<menuitem name="EditCopyIP" action="EditCopy"/>
<menuitem name="EditPasteIP" action="EditPaste"/>
@@ -15,8 +10,6 @@
<menuitem name="SaveImageAsIP" action="SaveImageAs"/>
<menuitem name="SetImageAsBackgroundIP" action="SetImageAsBackground"/>
<menuitem name="CopyImageLocationIP" action="CopyImageLocation"/>
- <separator />
- <menuitem name="InspectElementIP" action="InspectElement"/>
</popup>
<popup name="EphyDocumentPopup" action="PopupAction">
@@ -34,8 +27,6 @@
<menuitem name="CopyImageLocationDP" action="CopyImageLocation"/>
<separator />
<menuitem name="FileSendToDP" action="FileSendTo"/>
- <separator />
- <menuitem name="InspectElementDP" action="InspectElement"/>
</popup>
<popup name="EphyLinkPopup" action="PopupAction">
@@ -55,8 +46,6 @@
<menuitem name="SaveImageAsLP" action="SaveImageAs"/>
<menuitem name="SetImageAsBackgroundLP" action="SetImageAsBackground"/>
<menuitem name="CopyImageLocationLP" action="CopyImageLocation"/>
- <separator />
- <menuitem name="InspectElementLP" action="InspectElement"/>
</popup>
<popup name="EphyNotebookPopup" action="NotebookPopupAction">
diff --git a/src/window-commands.c b/src/window-commands.c
index 7a3db84..45dd141 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -60,11 +60,7 @@
#include <libnotify/notify.h>
#include <libsoup/soup.h>
#include <string.h>
-#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
-#else
-#include <webkit/webkit.h>
-#endif
#define DEFAULT_ICON_SIZE 144
#define FAVICON_SIZE 16
@@ -293,45 +289,21 @@ get_suggested_filename (EphyWebView *view)
{
char *suggested_filename = NULL;
const char *mimetype;
-#ifdef HAVE_WEBKIT2
WebKitURIResponse *response;
-#else
- WebKitWebFrame *frame;
- WebKitWebDataSource *data_source;
-#endif
WebKitWebResource *web_resource;
-#ifdef HAVE_WEBKIT2
web_resource = webkit_web_view_get_main_resource (WEBKIT_WEB_VIEW (view));
response = webkit_web_resource_get_response (web_resource);
mimetype = webkit_uri_response_get_mime_type (response);
-#else
- frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
- data_source = webkit_web_frame_get_data_source (frame);
- web_resource = webkit_web_data_source_get_main_resource (data_source);
- mimetype = webkit_web_resource_get_mime_type (web_resource);
-#endif
if ((g_ascii_strncasecmp (mimetype, "text/html", 9)) == 0)
{
/* Web Title will be used as suggested filename */
-#ifdef HAVE_WEBKIT2
suggested_filename = g_strconcat (ephy_web_view_get_title (view), ".mhtml", NULL);
-#else
- suggested_filename = g_strconcat (ephy_web_view_get_title (view), ".html", NULL);
-#endif
}
else
{
-#ifdef HAVE_WEBKIT2
suggested_filename = g_strdup (webkit_uri_response_get_suggested_filename (response));
-#else
- WebKitNetworkResponse *response;
-
- response = webkit_web_frame_get_network_response (frame);
- suggested_filename = g_strdup (webkit_network_response_get_suggested_filename (response));
-#endif
-
if (!suggested_filename)
{
SoupURI *soup_uri = soup_uri_new (webkit_web_resource_get_uri (web_resource));
@@ -513,22 +485,10 @@ static void
set_image_from_favicon (EphyApplicationDialogData *data)
{
GdkPixbuf *icon = NULL;
+ cairo_surface_t *icon_surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (data->view));
-#ifdef HAVE_WEBKIT2
- {
- cairo_surface_t *icon_surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (data->view));
- if (icon_surface)
- icon = ephy_pixbuf_get_from_surface_scaled (icon_surface, 0, 0);
- }
-#else
- {
- const char *page_uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (data->view));
- if (page_uri)
- icon = webkit_favicon_database_try_get_favicon_pixbuf (webkit_get_favicon_database (),
- page_uri,
- FAVICON_SIZE, FAVICON_SIZE);
- }
-#endif
+ if (icon_surface)
+ icon = ephy_pixbuf_get_from_surface_scaled (icon_surface, 0, 0);
if (icon != NULL) {
GdkPixbuf *framed;
@@ -557,7 +517,6 @@ set_app_icon_from_filename (EphyApplicationDialogData *data,
g_object_unref (framed);
}
-#ifdef HAVE_WEBKIT2
static void
download_finished_cb (WebKitDownload *download,
EphyApplicationDialogData *data)
@@ -582,46 +541,13 @@ download_failed_cb (WebKitDownload *download,
/* Something happened, default to a page snapshot. */
set_image_from_favicon (data);
}
-#else
-static void
-download_status_changed_cb (WebKitDownload *download,
- GParamSpec *spec,
- EphyApplicationDialogData *data)
-{
- WebKitDownloadStatus status = webkit_download_get_status (download);
- char *filename;
-
- gtk_widget_show (data->image);
-
- switch (status)
- {
- case WEBKIT_DOWNLOAD_STATUS_FINISHED:
- filename = g_filename_from_uri (webkit_download_get_destination_uri (download),
- NULL, NULL);
- set_app_icon_from_filename (data, filename);
- g_free (filename);
- break;
- case WEBKIT_DOWNLOAD_STATUS_ERROR:
- case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
- /* Something happened, default to a page snapshot. */
- set_image_from_favicon (data);
- break;
- default:
- break;
- }
-}
-#endif
static void
download_icon_and_set_image (EphyApplicationDialogData *data)
{
-#ifndef HAVE_WEBKIT2
- WebKitNetworkRequest *request;
-#endif
WebKitDownload *download;
char *destination, *destination_uri, *tmp_filename;
-#ifdef HAVE_WEBKIT2
download = webkit_web_context_download_uri (webkit_web_context_get_default (),
data->icon_href);
/* We do not want this download to show up in the UI, so let's
@@ -630,35 +556,19 @@ download_icon_and_set_image (EphyApplicationDialogData *data)
/* FIXME: it's probably better to just do this in a clean way
* instead of using this workaround. */
g_object_set_data (G_OBJECT (download), "ephy-download-set", GINT_TO_POINTER (TRUE));
-#else
- request = webkit_network_request_new (data->icon_href);
- download = webkit_download_new (request);
- g_object_unref (request);
-#endif
tmp_filename = ephy_file_tmp_filename ("ephy-download-XXXXXX", NULL);
destination = g_build_filename (ephy_file_tmp_dir (), tmp_filename, NULL);
destination_uri = g_filename_to_uri (destination, NULL, NULL);
-#ifdef HAVE_WEBKIT2
webkit_download_set_destination (download, destination_uri);
-#else
- webkit_download_set_destination_uri (download, destination_uri);
-#endif
g_free (destination);
g_free (destination_uri);
g_free (tmp_filename);
-#ifdef HAVE_WEBKIT2
g_signal_connect (download, "finished",
G_CALLBACK (download_finished_cb), data);
g_signal_connect (download, "failed",
G_CALLBACK (download_failed_cb), data);
-#else
- g_signal_connect (download, "notify::status",
- G_CALLBACK (download_status_changed_cb), data);
-
- webkit_download_start (download);
-#endif
}
static void
@@ -693,7 +603,6 @@ download_icon_or_take_snapshot (EphyApplicationDialogData *data,
}
}
-#ifdef HAVE_WEBKIT2
static void
fill_default_application_image_cb (GObject *source,
GAsyncResult *async_result,
@@ -717,23 +626,15 @@ fill_default_application_image_cb (GObject *source,
download_icon_or_take_snapshot (data, res, uri, color);
}
-#endif
static void
fill_default_application_image (EphyApplicationDialogData *data)
{
const char *base_uri;
-#ifdef HAVE_WEBKIT2
GDBusProxy *web_extension;
-#else
- char *uri = NULL;
- char *color = NULL;
- gboolean res;
-#endif
base_uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (data->view));
-#ifdef HAVE_WEBKIT2
web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ());
if (web_extension)
g_dbus_proxy_call (web_extension,
@@ -746,14 +647,6 @@ fill_default_application_image (EphyApplicationDialogData *data)
data);
else
download_icon_or_take_snapshot (data, FALSE, NULL, NULL);
-#else
- res = ephy_web_dom_utils_get_best_icon (webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW
(data->view)),
- base_uri,
- &uri,
- &color);
-
- download_icon_or_take_snapshot (data, res, uri, color);
-#endif
}
typedef struct {
@@ -822,7 +715,6 @@ set_default_application_title (EphyApplicationDialogData *data,
g_free (title);
}
-#ifdef HAVE_WEBKIT2
static void
fill_default_application_title_cb (GObject *source,
GAsyncResult *async_result,
@@ -844,13 +736,12 @@ fill_default_application_title_cb (GObject *source,
set_default_application_title (data, title);
}
-#endif
static void
fill_default_application_title (EphyApplicationDialogData *data)
{
-#ifdef HAVE_WEBKIT2
GDBusProxy *web_extension;
+
web_extension = ephy_embed_shell_get_web_extension_proxy (ephy_embed_shell_get_default ());
if (web_extension)
g_dbus_proxy_call (web_extension,
@@ -863,11 +754,6 @@ fill_default_application_title (EphyApplicationDialogData *data)
data);
else
set_default_application_title (data, NULL);
-#else
- WebKitDOMDocument *document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (data->view));
- char *title = ephy_web_dom_utils_get_application_title (document);
- set_default_application_title (data, title);
-#endif
}
static void
@@ -1126,11 +1012,7 @@ window_cmd_edit_undo (GtkAction *action,
if (embed)
{
-#ifdef HAVE_WEBKIT2
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED
(EPHY_EMBED (embed)), "Undo");
-#else
- webkit_web_view_undo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (EPHY_EMBED (embed)));
-#endif
}
}
}
@@ -1155,11 +1037,7 @@ window_cmd_edit_redo (GtkAction *action,
embed = gtk_widget_get_ancestor (widget, EPHY_TYPE_EMBED);
if (embed)
{
-#ifdef HAVE_WEBKIT2
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED
(EPHY_EMBED (embed)), "Redo");
-#else
- webkit_web_view_redo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (EPHY_EMBED (embed)));
-#endif
}
}
}
@@ -1179,11 +1057,7 @@ window_cmd_edit_cut (GtkAction *action,
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
-#ifdef HAVE_WEBKIT2
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed),
WEBKIT_EDITING_COMMAND_CUT);
-#else
- webkit_web_view_cut_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-#endif
}
}
@@ -1203,11 +1077,8 @@ window_cmd_edit_copy (GtkAction *action,
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
-#ifdef HAVE_WEBKIT2
+
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed),
WEBKIT_EDITING_COMMAND_COPY);
-#else
- webkit_web_view_copy_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-#endif
}
}
@@ -1228,11 +1099,7 @@ window_cmd_edit_paste (GtkAction *action,
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
-#ifdef HAVE_WEBKIT2
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed),
WEBKIT_EDITING_COMMAND_PASTE);
-#else
- webkit_web_view_paste_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-#endif
}
}
@@ -1279,11 +1146,7 @@ window_cmd_edit_select_all (GtkAction *action,
(EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
-#ifdef HAVE_WEBKIT2
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed),
"SelectAll");
-#else
- webkit_web_view_select_all (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-#endif
}
}
@@ -1405,13 +1268,9 @@ view_source_embedded (const char *uri, EphyEmbed *embed)
embed,
NULL,
EPHY_NEW_TAB_JUMP | EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_APPEND_AFTER);
-#ifdef HAVE_WEBKIT2
+
webkit_web_view_set_view_mode
(EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), WEBKIT_VIEW_MODE_SOURCE);
-#else
- webkit_web_view_set_view_source_mode
- (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), TRUE);
-#endif
webkit_web_view_load_uri
(EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), uri);
}
@@ -1494,7 +1353,6 @@ save_temp_source_write_cb (GOutputStream *ostream, GAsyncResult *result, GString
data);
}
-#ifdef HAVE_WEBKIT2
static void
get_main_resource_data_cb (WebKitWebResource *resource, GAsyncResult *result, GOutputStream *ostream)
{
@@ -1521,20 +1379,12 @@ get_main_resource_data_cb (WebKitWebResource *resource, GAsyncResult *result, GO
(GAsyncReadyCallback)save_temp_source_write_cb,
data_str);
}
-#endif
static void
save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed)
{
EphyWebView *view;
-#ifdef HAVE_WEBKIT2
WebKitWebResource *resource;
-#else
- WebKitWebFrame *frame;
- WebKitWebDataSource *data_source;
- GString *const_data;
- GString *data;
-#endif
GFileOutputStream *ostream;
GError *error = NULL;
@@ -1563,29 +1413,10 @@ save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed
g_object_ref (embed),
g_object_unref);
-#ifdef HAVE_WEBKIT2
resource = webkit_web_view_get_main_resource (WEBKIT_WEB_VIEW (view));
webkit_web_resource_get_data (resource, NULL,
(GAsyncReadyCallback)get_main_resource_data_cb,
ostream);
-#else
- frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
- data_source = webkit_web_frame_get_data_source (frame);
- const_data = webkit_web_data_source_get_data (data_source);
-
- /* We create a new GString here because we need to make sure
- * we keep writing in case of partial writes */
- if (const_data)
- data = g_string_new_len (const_data->str, const_data->len);
- else
- data = g_string_new_len ("", 0);
-
- g_output_stream_write_async (G_OUTPUT_STREAM (ostream),
- data->str, data->len,
- G_PRIORITY_DEFAULT, NULL,
- (GAsyncReadyCallback)save_temp_source_write_cb,
- data);
-#endif
}
static void
@@ -1763,19 +1594,11 @@ window_cmd_help_about (GtkAction *action,
g_key_file_free (key_file);
-#ifdef HAVE_WEBKIT2
comments = g_strdup_printf (_("A simple, clean, beautiful view of the web.\n"
"Powered by WebKit %d.%d.%d"),
webkit_get_major_version (),
webkit_get_minor_version (),
webkit_get_micro_version ());
-#else
- comments = g_strdup_printf (_("A simple, clean, beautiful view of the web.\n"
- "Powered by WebKit %d.%d.%d"),
- webkit_major_version (),
- webkit_minor_version (),
- webkit_micro_version ());
-#endif
licence = g_strjoin ("\n\n",
_(licence_part[0]),
diff --git a/tests/ephy-session-test.c b/tests/ephy-session-test.c
index 7cde202..685fa13 100644
--- a/tests/ephy-session-test.c
+++ b/tests/ephy-session-test.c
@@ -127,8 +127,6 @@ test_ephy_session_load (void)
enable_delayed_loading ();
}
-/* FIXME: This #ifdef should be removed once bug #695437 is fixed. */
-#ifdef HAVE_WEBKIT2
const char *session_data_many_windows =
"<?xml version=\"1.0\"?>"
"<session>"
@@ -139,18 +137,6 @@ const char *session_data_many_windows =
"<embed url=\"about:config\" title=\"Epiphany\"/>"
"</window>"
"</session>";
-#else
-const char *session_data_many_windows =
-"<?xml version=\"1.0\"?>"
-"<session>"
- "<window x=\"100\" y=\"26\" width=\"1067\" height=\"740\" active-tab=\"0\"
role=\"epiphany-window-7da420dd\">"
- "<embed url=\"about:epiphany\" title=\"Epiphany\"/>"
- "</window>"
- "<window x=\"73\" y=\"26\" width=\"1067\" height=\"740\" active-tab=\"0\"
role=\"epiphany-window-1261c786\">"
- "<embed url=\"about:epiphany\" title=\"Epiphany\"/>"
- "</window>"
-"</session>";
-#endif
static void
test_ephy_session_clear (void)
@@ -256,10 +242,6 @@ test_ephy_session_load_many_windows (void)
g_assert (embed);
view = ephy_embed_get_web_view (embed);
g_assert (view);
-#ifndef HAVE_WEBKIT2
- /* FIXME: This #ifndef should be removed once bug #695437 is fixed. */
- ephy_test_utils_check_ephy_web_view_address (view, "ephy-about:epiphany");
-#endif
}
enable_delayed_loading ();
@@ -303,10 +285,6 @@ open_uris_after_loading_session (const char** uris, int final_num_windows)
g_assert (embed);
view = ephy_embed_get_web_view (embed);
g_assert (view);
-#ifndef HAVE_WEBKIT2
- /* FIXME: This #ifndef should be removed once bug #695437 is fixed. */
- ephy_test_utils_check_ephy_web_view_address (view, "ephy-about:epiphany");
-#endif
}
/* Causing a session load here should not create new windows, since we
@@ -360,76 +338,6 @@ test_ephy_session_open_empty_uri_forces_new_window (void)
open_uris_after_loading_session (uris, 3);
}
-#ifndef HAVE_WEBKIT2
-static void
-test_ephy_session_restore_tabs (void)
-{
- EphySession *session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
- const char* uris[] = { "ephy-about:epiphany", "ephy-about:config", NULL };
- guint32 user_time = gdk_x11_display_get_user_time (gdk_display_get_default ());
- gboolean ret;
- GList *l;
- gchar *url;
- int n_windows;
- EphyEmbed *embed;
-
- disable_delayed_loading ();
-
- /* Nothing to restore. */
- g_assert (ephy_session_get_can_undo_tab_closed (session) == FALSE);
-
- ephy_shell_open_uris (ephy_shell_get_default(), uris, 0, user_time);
- while (gtk_events_pending ())
- gtk_main_iteration_do (FALSE);
-
- /* Nothing to restore, again. */
- g_assert (ephy_session_get_can_undo_tab_closed (session) == FALSE);
-
- l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ()));
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (l->data));
- url = g_strdup (ephy_web_view_get_address (ephy_embed_get_web_view (embed)));
- gtk_widget_destroy (GTK_WIDGET (embed));
-
- /* There should be now at least one tab that can be restored. */
- g_assert (ephy_session_get_can_undo_tab_closed (session) == TRUE);
-
- ephy_session_undo_close_tab (session);
- while (gtk_events_pending ())
- gtk_main_iteration_do (FALSE);
-
- /* Nothing to restore, again. */
- g_assert (ephy_session_get_can_undo_tab_closed (session) == FALSE);
-
- /* The active child should now be pointing to the restored tab,
- whose address is the one we copied previously. */
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (l->data));
- ephy_test_utils_check_ephy_web_view_address (ephy_embed_get_web_view (embed), url);
- g_free (url);
-
- ephy_session_clear (session);
-
- ret = load_session_from_string (session, session_data_many_windows);
- g_assert (ret);
-
- l = gtk_application_get_windows (GTK_APPLICATION (ephy_shell_get_default ()));
- n_windows = g_list_length (l);
- /* We need more than one window for the next test to make sense. */
- g_assert_cmpint (n_windows, >, 1);
- gtk_widget_destroy (GTK_WIDGET (l->data));
- /* One window is gone. */
- g_assert_cmpint (n_windows, ==, g_list_length (gtk_application_get_windows (GTK_APPLICATION
(ephy_shell_get_default()))) + 1);
- g_assert (ephy_session_get_can_undo_tab_closed (session) == TRUE);
- ephy_session_undo_close_tab (session);
- while (gtk_events_pending ())
- gtk_main_iteration_do (FALSE);
- /* We have the same amount of windows than before destroying one. */
- g_assert_cmpint (n_windows, ==, g_list_length (gtk_application_get_windows (GTK_APPLICATION
(ephy_shell_get_default()))));
-
- enable_delayed_loading ();
- ephy_session_clear (session);
-}
-#endif
-
int
main (int argc, char *argv[])
{
@@ -474,11 +382,6 @@ main (int argc, char *argv[])
g_test_add_func ("/src/ephy-session/open-empty-uri-forces-new-window",
test_ephy_session_open_empty_uri_forces_new_window);
-#ifndef HAVE_WEBKIT2
- g_test_add_func("/src/ephy-session/restore-tabs",
- test_ephy_session_restore_tabs);
-#endif
-
ret = g_test_run ();
g_object_unref (ephy_shell_get_default ());
diff --git a/tests/ephy-shell-test.c b/tests/ephy-shell-test.c
index 8b9bac6..857c030 100644
--- a/tests/ephy-shell-test.c
+++ b/tests/ephy-shell-test.c
@@ -319,45 +319,7 @@ test_ephy_shell_tab_from_external (void)
static void
test_ephy_shell_tab_no_history (void)
{
-#ifdef HAVE_WEBKIT2
/* TODO: BackForwardList */
-#else
- EphyShell *ephy_shell;
- GtkWidget *window;
- EphyEmbed *embed;
- EphyEmbed *embed2;
- EphyEmbed *embed3;
-
- WebKitWebBackForwardList *bflist;
- WebKitWebHistoryItem *item;
-
- ephy_shell = ephy_shell_get_default ();
- embed = ephy_shell_new_tab (ephy_shell, NULL, NULL, NULL,
- EPHY_NEW_TAB_DONT_SHOW_WINDOW);
- window = gtk_widget_get_toplevel (GTK_WIDGET (embed));
-
- /* Because we are not using a mainloop, we have to produce our own
- * back/fwd data. */
- bflist = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
- item = webkit_web_history_item_new_with_data ("http://www.gnome.org/", "GNOME");
- webkit_web_back_forward_list_add_item (bflist, item);
- g_object_unref (item);
- item = webkit_web_history_item_new_with_data ("http://planet.gnome.org/", "Planet GNOME");
- webkit_web_back_forward_list_add_item (bflist, item);
- g_object_unref (item);
-
- embed2 = ephy_shell_new_tab (ephy_shell, EPHY_WINDOW (window), embed, NULL,
- EPHY_NEW_TAB_DONT_SHOW_WINDOW | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
- bflist = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed2));
- g_assert_cmpint (webkit_web_back_forward_list_get_back_length (bflist), ==, 1);
-
- embed3 = ephy_shell_new_tab (ephy_shell, EPHY_WINDOW (window), embed2, NULL,
- EPHY_NEW_TAB_DONT_SHOW_WINDOW | EPHY_NEW_TAB_IN_EXISTING_WINDOW |
EPHY_NEW_TAB_DONT_COPY_HISTORY);
- bflist = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed3));
- g_assert_cmpint (webkit_web_back_forward_list_get_back_length (bflist), ==, 0);
-
- gtk_widget_destroy (window);
-#endif
}
int
diff --git a/tests/ephy-test-utils.c b/tests/ephy-test-utils.c
index 83272de..ec9c7a8 100644
--- a/tests/ephy-test-utils.c
+++ b/tests/ephy-test-utils.c
@@ -50,17 +50,9 @@ ephy_test_utils_check_ephy_embed_address (EphyEmbed *embed,
static void
load_changed_cb (WebKitWebView *web_view,
-#ifdef HAVE_WEBKIT2
WebKitLoadEvent status,
-#else
- GParamSpec *pspec,
-#endif
GMainLoop *loop)
{
-#ifndef HAVE_WEBKIT2
- WebKitLoadStatus status = webkit_web_view_get_load_status (web_view);
-#endif
-
if (status == WEBKIT_LOAD_COMMITTED) {
web_view_ready_counter--;
g_signal_handlers_disconnect_by_func (web_view, load_changed_cb, loop);
@@ -74,11 +66,7 @@ load_changed_cb (WebKitWebView *web_view,
static void
wait_until_load_is_committed (WebKitWebView *web_view, GMainLoop *loop)
{
-#ifdef HAVE_WEBKIT2
g_signal_connect (web_view, "load-changed", G_CALLBACK (load_changed_cb), loop);
-#else
- g_signal_connect (web_view, "notify::load-status", G_CALLBACK (load_changed_cb), loop);
-#endif
}
static void
diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c
index 139a811..a01990b 100644
--- a/tests/ephy-web-view-test.c
+++ b/tests/ephy-web-view-test.c
@@ -64,7 +64,6 @@ server_callback (SoupServer *server,
soup_message_body_complete (msg->response_body);
}
-#ifdef HAVE_WEBKIT2
static void
load_changed_cb (WebKitWebView *view, WebKitLoadEvent load_event, GMainLoop *loop)
{
@@ -85,31 +84,6 @@ load_changed_cb (WebKitWebView *view, WebKitLoadEvent load_event, GMainLoop *loo
g_free (expected_url);
g_main_loop_quit (loop);
}
-#else
-static void
-notify_load_status_cb (WebKitWebView *view, GParamSpec *spec, GMainLoop *loop)
-{
- WebKitLoadStatus status;
- char *expected_url;
- const char *loaded_url;
-
- status = webkit_web_view_get_load_status (view);
-
- if (status != WEBKIT_LOAD_FINISHED)
- return;
-
- expected_url = g_object_get_data (G_OBJECT (view), "test.expected_url");
- g_assert (expected_url != NULL);
-
- loaded_url = webkit_web_view_get_uri (view);
- g_assert_cmpstr (loaded_url, ==, expected_url);
-
- g_signal_handlers_disconnect_by_func (view, notify_load_status_cb, loop);
-
- g_free (expected_url);
- g_main_loop_quit (loop);
-}
-#endif
typedef struct {
const char *url;
@@ -181,13 +155,8 @@ test_ephy_web_view_load_url (void)
g_test_message ("[%s] \t-> %s", test.url, test.expected_url);
-#ifdef HAVE_WEBKIT2
g_signal_connect (view, "load-changed",
G_CALLBACK (load_changed_cb), loop);
-#else
- g_signal_connect (view, "notify::load-status",
- G_CALLBACK (notify_load_status_cb), loop);
-#endif
g_main_loop_run (loop);
g_main_loop_unref (loop);
@@ -318,7 +287,6 @@ test_ephy_web_view_normalize_or_autosearch (void)
g_object_unref (g_object_ref_sink (view));
}
-#ifdef HAVE_WEBKIT2
static void
quit_main_loop_when_load_finished (WebKitWebView *view, WebKitLoadEvent load_event, GMainLoop *loop)
{
@@ -328,24 +296,7 @@ quit_main_loop_when_load_finished (WebKitWebView *view, WebKitLoadEvent load_eve
g_main_loop_quit (loop);
g_signal_handlers_disconnect_by_func (view, quit_main_loop_when_load_finished, NULL);
}
-#else
-static void
-quit_main_loop_when_load_finished (WebKitWebView *view, GParamSpec *spec, GMainLoop *loop)
-{
- WebKitLoadStatus status;
-
- status = webkit_web_view_get_load_status (view);
-
- if (status != WEBKIT_LOAD_FINISHED)
- return;
-
- g_main_loop_quit (loop);
- g_signal_handlers_disconnect_by_func (view, quit_main_loop_when_load_finished, loop);
-
-}
-#endif
-#ifdef HAVE_WEBKIT2
static guint back_forward_list_counter = 0;
static void
@@ -390,7 +341,6 @@ ensure_back_forward_list_changes (GMainLoop *loop)
g_assert_cmpint (back_forward_list_counter, ==, 0);
g_main_loop_unref (loop);
}
-#endif
static void
test_ephy_web_view_provisional_load_failure_updates_back_forward_list (void)
@@ -400,40 +350,20 @@ test_ephy_web_view_provisional_load_failure_updates_back_forward_list (void)
const char *bad_url;
view = EPHY_WEB_VIEW (ephy_web_view_new ());
-#ifdef HAVE_WEBKIT2
+
loop = setup_ensure_back_forward_list_changes (view);
-#else
- loop = g_main_loop_new (NULL, FALSE);
-#endif
bad_url = "http://localhost:2984375932/";
ephy_web_view_load_url (view, bad_url);
-#ifdef HAVE_WEBKIT2
ensure_back_forward_list_changes (loop);
-#else
- g_signal_connect (view, "notify::load-status",
- G_CALLBACK (quit_main_loop_when_load_finished), loop);
- g_main_loop_run (loop);
- g_main_loop_unref (loop);
-#endif
-
-#ifdef HAVE_WEBKIT2
g_assert (webkit_back_forward_list_get_current_item (
webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view))));
g_assert_cmpstr (bad_url, ==, webkit_back_forward_list_item_get_uri (
webkit_back_forward_list_get_current_item (
webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)))));
-#else
- g_assert (webkit_web_back_forward_list_get_current_item (
- webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view))));
-
- g_assert_cmpstr (bad_url, ==, webkit_web_history_item_get_uri (
- webkit_web_back_forward_list_get_current_item (
- webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)))));
-#endif
g_object_unref (g_object_ref_sink (view));
}
@@ -471,13 +401,9 @@ test_ephy_web_view_error_pages_not_stored_in_history (void)
ephy_web_view_load_url (view, bad_url);
-#ifdef HAVE_WEBKIT2
g_signal_connect (view, "load-changed",
G_CALLBACK (quit_main_loop_when_load_finished), loop);
-#else
- g_signal_connect (view, "notify::load-status",
- G_CALLBACK (quit_main_loop_when_load_finished), loop);
-#endif
+
g_main_loop_run (loop);
g_main_loop_unref (loop);
g_signal_handlers_disconnect_by_func (history_service, G_CALLBACK (visit_url_cb), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]