summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2013-12-08 12:40:12 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2013-12-08 12:42:00 +0100
commit3df6f8c4678f1a0068ed06576180c2e9a4c1629e (patch)
treedd7cce9e815f739b41ee0f78ab570a7c4615b2c0 /src
parent7213d38a3c024a0b189f053655e76a3c976c7dbc (diff)
downloadepiphany-3df6f8c4678f1a0068ed06576180c2e9a4c1629e.tar.gz
Remove all WebKit1 code
We are using WebKit2 unconditionally already.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/bookmarks/ephy-bookmark-action.c68
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c75
-rw-r--r--src/bookmarks/ephy-bookmarks.c24
-rw-r--r--src/ephy-completion-model.c29
-rw-r--r--src/ephy-encoding-dialog.c35
-rw-r--r--src/ephy-encoding-menu.c23
-rw-r--r--src/ephy-find-toolbar.c216
-rw-r--r--src/ephy-history-window.c6
-rw-r--r--src/ephy-navigation-history-action.c171
-rw-r--r--src/ephy-notebook.c8
-rw-r--r--src/ephy-session.c56
-rw-r--r--src/ephy-shell.c31
-rw-r--r--src/ephy-shell.h8
-rw-r--r--src/ephy-window.c527
-rw-r--r--src/pdm-dialog.c199
-rw-r--r--src/popup-commands.c114
-rw-r--r--src/popup-commands.h6
-rw-r--r--src/resources/epiphany-ui.xml11
-rw-r--r--src/window-commands.c189
20 files changed, 20 insertions, 1780 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 0046e6789..3afd7ebd1 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 639d780d0..fb8b55f1f 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 659fda7d3..889920f5e 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 ac41a64bd..066ede241 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 33d84bbc8..35bd43e68 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 411745ca1..609a83782 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 ff2330563..5f9581385 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 49c855dc7..d6aac374c 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 91133cc8e..34fe4ea87 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 92be4ce6f..46742f2bd 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 b09ff55c9..ff88ffa05 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 ba7706889..3efbc22b4 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 3b2fc3f8f..c56b977c1 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 0390be324..2011fd4e9 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 e67d388ce..5be0923de 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 46d20ca61..9c2a60677 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 2896fb22b..102fe5e2d 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 cabecdf31..4301ef3b5 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 2faa796ef..c4854ec4a 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 7a3db8436..45dd14126 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]),