diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-05-06 22:47:19 +0800 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2012-06-21 19:54:16 +0800 |
commit | 97c91b2fc2059b1e358bb19896203afaa44bfd33 (patch) | |
tree | 6aa01250a99fa884d177ce3202d8ff41e8e96d74 /src | |
parent | a8767266443074689200fff9ca43531d88d65aed (diff) | |
download | gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.gz gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.bz2 gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.lz gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.xz gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.zst gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.zip |
Initial WebKit2 port
It builds and basic functionality works.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 12 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 17 | ||||
-rw-r--r-- | src/ephy-completion-model.c | 12 | ||||
-rw-r--r-- | src/ephy-encoding-dialog.c | 17 | ||||
-rw-r--r-- | src/ephy-encoding-menu.c | 17 | ||||
-rw-r--r-- | src/ephy-find-toolbar.c | 26 | ||||
-rw-r--r-- | src/ephy-history-window.c | 4 | ||||
-rw-r--r-- | src/ephy-navigation-history-action.c | 43 | ||||
-rw-r--r-- | src/ephy-session.c | 20 | ||||
-rw-r--r-- | src/ephy-shell.c | 12 | ||||
-rw-r--r-- | src/ephy-shell.h | 8 | ||||
-rw-r--r-- | src/ephy-window.c | 53 | ||||
-rw-r--r-- | src/pdm-dialog.c | 13 | ||||
-rw-r--r-- | src/popup-commands.c | 16 | ||||
-rw-r--r-- | src/window-commands.c | 66 |
17 files changed, 344 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 41f13c940..3750c19ec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -101,6 +101,10 @@ libephymain_la_CPPFLAGS = \ -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ $(AM_CPPFLAGS) +if WITH_WEBKIT2 +libephymain_la_CPPFLAGS += -DHAVE_WEBKIT2 +endif + libephymain_la_CFLAGS = \ $(DEPENDENCIES_CFLAGS) \ $(WEBKIT_CFLAGS) \ @@ -179,10 +183,12 @@ epiphany_LDADD = \ $(DEPENDENCIES_LIBS) \ $(LIBINTL) +if !WITH_WEBKIT2 if HAVE_INTROSPECTION epiphany_CFLAGS += $(INTROSPECTION_CFLAGS) epiphany_LDADD += $(INTROSPECTION_LIBS) endif +endif if ENABLE_SEED epiphany_LDADD += $(SEED_LIBS) @@ -242,6 +248,7 @@ CLEANFILES = $(stamp_files) $(BUILT_SOURCES) DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES) MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES) +if !WITH_WEBKIT2 if HAVE_INTROSPECTION EPHY_GIR_H_FILES = \ $(top_srcdir)/embed/ephy-download.h \ @@ -336,3 +343,4 @@ Epiphany-$(EPIPHANY_API_VERSION).typelib: Epiphany-$(EPIPHANY_API_VERSION).gir $ CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # HAVE_INTROSPECTION +endif # !WITH_WEBKIT2 diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index fe65d37ff..c8be7cd6d 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -66,6 +66,9 @@ typedef struct G_DEFINE_TYPE (EphyBookmarkAction, ephy_bookmark_action, EPHY_TYPE_LINK_ACTION) +#ifdef HAVE_WEBKIT2 +/* TODO: Favicons */ +#else static void favicon_loaded_cb (WebKitFaviconDatabase *database, const char *page_address, @@ -90,12 +93,16 @@ favicon_loaded_cb (WebKitFaviconDatabase *database, g_free (icon_address); } +#endif static void ephy_bookmark_action_sync_icon (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy) { +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else EphyBookmarkAction *bma = EPHY_BOOKMARK_ACTION (action); const char *page_location; WebKitFaviconDatabase *database; @@ -139,6 +146,7 @@ ephy_bookmark_action_sync_icon (GtkAction *action, { g_object_unref (pixbuf); } +#endif } void @@ -376,9 +384,13 @@ ephy_bookmark_action_dispose (GObject *object) if (priv->cache_handler != 0) { +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else WebKitFaviconDatabase *database = webkit_get_favicon_database (); g_signal_handler_disconnect (database, priv->cache_handler); priv->cache_handler = 0; +#endif } G_OBJECT_CLASS (ephy_bookmark_action_parent_class)->dispose (object); diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index fbc6ee239..2dcee58b4 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -1458,6 +1458,9 @@ node_dropped_cb (EphyNodeView *view, } } +#ifdef HAVE_WEBKIT2 +/* TODO: Favicons */ +#else static gboolean webkit_favicon_database_has_favicon (WebKitFaviconDatabase *database, const char *page_uri) { @@ -1480,10 +1483,14 @@ icon_loaded_cb (WebKitFaviconDatabase *database, GAsyncResult *result, GValue *v g_value_take_object (value, favicon); } +#endif static void provide_favicon (EphyNode *node, GValue *value, gpointer user_data) { +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else const char *page_location; GdkPixbuf *favicon = NULL; @@ -1508,6 +1515,7 @@ provide_favicon (EphyNode *node, GValue *value, gpointer user_data) g_value_init (value, GDK_TYPE_PIXBUF); g_value_take_object (value, favicon); +#endif } static void diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index f2a5ea677..764032b1a 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -247,6 +247,9 @@ ephy_bookmarks_save_delayed (EphyBookmarks *bookmarks, int delay) } } +#ifdef HAVE_WEBKIT2 +/* TODO: Favicons */ +#else static void icon_updated_cb (WebKitFaviconDatabase *favicon_database, const char *address, @@ -258,15 +261,20 @@ icon_updated_cb (WebKitFaviconDatabase *favicon_database, ephy_bookmarks_set_icon (eb, address, icon); g_free (icon); } +#endif static void ephy_setup_history_notifiers (EphyBookmarks *eb) { +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else WebKitFaviconDatabase *favicon_database; favicon_database = webkit_get_favicon_database (); g_signal_connect (favicon_database, "icon-loaded", G_CALLBACK (icon_updated_cb), eb); +#endif } static void @@ -1166,7 +1174,11 @@ ephy_bookmarks_add (EphyBookmarks *eb, const char *url) { EphyNode *bm; +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else WebKitFaviconDatabase *favicon_database; +#endif bm = ephy_node_new (eb->priv->db); @@ -1181,7 +1193,9 @@ ephy_bookmarks_add (EphyBookmarks *eb, } ephy_node_set_property_string (bm, EPHY_NODE_BMK_PROP_TITLE, title); - +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else favicon_database = webkit_get_favicon_database (); if (favicon_database != NULL) { @@ -1193,6 +1207,7 @@ ephy_bookmarks_add (EphyBookmarks *eb, g_free (icon); } } +#endif update_has_smart_address (eb, bm, url); update_bookmark_keywords (eb, bm); diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c index aa68bf7ea..373fd0c42 100644 --- a/src/ephy-completion-model.c +++ b/src/ephy-completion-model.c @@ -166,6 +166,9 @@ typedef struct { gboolean is_bookmark; } PotentialRow; +#ifdef HAVE_WEBKIT2 +/* TODO: Favicons */ +#else typedef struct { GtkListStore *model; GtkTreeRowReference *row_reference; @@ -195,6 +198,7 @@ icon_loaded_cb (GObject *source, GAsyncResult *result, gpointer user_data) gtk_tree_row_reference_free (data->row_reference); g_slice_free (IconLoadData, data); } +#endif static void set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row) @@ -202,8 +206,12 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row) GtkTreeIter iter; GdkPixbuf *favicon; GtkTreePath *path; +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else IconLoadData *data; WebKitFaviconDatabase* database = webkit_get_favicon_database (); +#endif gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, position, EPHY_COMPLETION_TEXT_COL, row->title ? row->title : "", @@ -214,6 +222,9 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row) EPHY_COMPLETION_RELEVANCE_COL, row->relevance, -1); +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else /* 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, @@ -233,6 +244,7 @@ set_row_in_model (EphyCompletionModel *model, int position, PotentialRow *row) 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 0579f4505..95a0b070c 100644 --- a/src/ephy-encoding-dialog.c +++ b/src/ephy-encoding-dialog.c @@ -36,7 +36,11 @@ #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)) @@ -75,6 +79,10 @@ 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) return; +#else encoding = webkit_web_view_get_custom_encoding (view); if (encoding == NULL) { @@ -82,6 +90,7 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog) if (encoding == NULL) return; is_automatic = TRUE; } +#endif node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE); g_assert (EPHY_IS_NODE (node)); @@ -195,7 +204,11 @@ 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_node != NULL) { @@ -204,7 +217,11 @@ activate_choice (EphyEncodingDialog *dialog) code = ephy_node_get_property_string (dialog->priv->selected_node, EPHY_NODE_ENCODING_PROP_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 b55e39876..86fe2c293 100644 --- a/src/ephy-encoding-menu.c +++ b/src/ephy-encoding-menu.c @@ -35,7 +35,11 @@ #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)) @@ -134,6 +138,10 @@ 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) { @@ -141,6 +149,7 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu) if (encoding == NULL) goto build_menu; is_automatic = TRUE; } +#endif enc_node = ephy_encodings_get_node (p->encodings, encoding, TRUE); g_assert (EPHY_IS_NODE (enc_node)); @@ -249,7 +258,11 @@ 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); } @@ -322,7 +335,11 @@ 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 9a6d7ab96..d8ce10eab 100644 --- a/src/ephy-find-toolbar.c +++ b/src/ephy-find-toolbar.c @@ -29,7 +29,11 @@ #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)) @@ -92,6 +96,9 @@ static void scroll_lines (WebKitWebView *web_view, int num_lines) { +#ifdef HAVE_WEBKIT2 + /* TODO: Scroll API? */ +#else GtkScrolledWindow *scrolled_window; GtkAdjustment *vadj; gdouble value; @@ -101,12 +108,16 @@ scroll_lines (WebKitWebView *web_view, 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; @@ -116,6 +127,7 @@ scroll_pages (WebKitWebView *web_view, value = gtk_adjustment_get_value (vadj) + (num_pages * gtk_adjustment_get_page_increment (vadj)); gtk_adjustment_set_value (vadj, value); +#endif } static gboolean @@ -230,6 +242,9 @@ find_prev_cb (EphyFindToolbar *toolbar) static void ephy_find_toolbar_mark_matches (EphyFindToolbar *toolbar) { +#ifdef HAVE_WEBKIT2 + /* TODO: Find */ +#else EphyFindToolbarPrivate *priv = toolbar->priv; WebKitWebView *web_view = priv->web_view; gboolean case_sensitive; @@ -243,6 +258,7 @@ ephy_find_toolbar_mark_matches (EphyFindToolbar *toolbar) case_sensitive, 0); webkit_web_view_set_highlight_text_matches (web_view, TRUE); +#endif } static EphyFindResult @@ -256,6 +272,10 @@ real_find (EphyFindToolbarPrivate *priv, if (!priv->find_string || !g_strcmp0 (priv->find_string, "")) return EPHY_FIND_RESULT_NOTFOUND; +#ifdef HAVE_WEBKIT2 + /* TODO: Find */ + return EPHY_FIND_RESULT_NOTFOUND; +#else if (!webkit_web_view_search_text (web_view, priv->find_string, case_sensitive, forward, FALSE)) { /* not found, try to wrap */ @@ -270,6 +290,7 @@ real_find (EphyFindToolbarPrivate *priv, } return EPHY_FIND_RESULT_FOUND; +#endif } static gboolean @@ -887,8 +908,11 @@ ephy_find_toolbar_close (EphyFindToolbar *toolbar) gtk_widget_hide (GTK_WIDGET (toolbar)); if (priv->web_view == NULL) return; - +#ifdef HAVE_WEBKIT2 + /* TODO: Find */ +#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 101b287d5..7e42f7688 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -882,9 +882,13 @@ 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 bbf6c72b3..b03dad11f 100644 --- a/src/ephy-navigation-history-action.c +++ b/src/ephy-navigation-history-action.c @@ -38,7 +38,11 @@ #include "ephy-window.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), \ @@ -112,6 +116,9 @@ 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 + /* TODO: History */ +#else WebKitWebHistoryItem *forward_item; WebKitWebBackForwardList *history; @@ -130,6 +137,7 @@ action_activate (GtkAction *action) web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); webkit_web_view_load_uri (web_view, forward_uri); +#endif } else { webkit_web_view_go_forward (web_view); gtk_widget_grab_focus (GTK_WIDGET (embed)); @@ -225,6 +233,9 @@ item_leave_notify_event_cb (GtkWidget *widget, return FALSE; } +#ifdef HAVE_WEBKIT2 +/* TODO: favicons */ +#else static void icon_loaded_cb (GObject *source, GAsyncResult *result, @@ -246,6 +257,7 @@ icon_loaded_cb (GObject *source, g_object_unref (favicon); } } +#endif static GtkWidget * new_history_menu_item (EphyWebView *view, @@ -254,8 +266,12 @@ new_history_menu_item (EphyWebView *view, { GtkWidget *item; GtkLabel *label; +#ifdef HAVE_WEBKIT2 + /* TODO: favicons */ +#else WebKitFaviconDatabase* database; GdkPixbuf *favicon; +#endif g_return_val_if_fail (address != NULL && origtext != NULL, NULL); @@ -264,7 +280,9 @@ new_history_menu_item (EphyWebView *view, label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))); gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH); - +#ifdef HAVE_WEBKIT2 + /* TODO: favicons */ +#else database = webkit_get_favicon_database (); favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, address, FAVICON_SIZE, FAVICON_SIZE); @@ -283,6 +301,7 @@ new_history_menu_item (EphyWebView *view, (GAsyncReadyCallback) icon_loaded_cb, GTK_IMAGE_MENU_ITEM (item)); } +#endif g_object_set_data (G_OBJECT (item), "link-message", g_strdup (address)); @@ -301,6 +320,9 @@ set_new_back_history (EphyEmbed *source, EphyEmbed *dest, gint offset) { +#ifdef HAVE_WEBKIT2 + /* TODO: WebKitBackForwardList */ +#else WebKitWebView *source_view, *dest_view; WebKitWebBackForwardList* source_list, *dest_list; WebKitWebHistoryItem *item; @@ -338,8 +360,12 @@ set_new_back_history (EphyEmbed *source, items = items->next; } g_list_free (items); +#endif } +#ifdef HAVE_WEBKIT2 +/* TODO: WebKitBackForwardList */ +#else static void middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action, EphyEmbed *embed, @@ -385,11 +411,15 @@ middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action, url = webkit_web_history_item_get_original_uri (item); ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), url); } +#endif static void activate_menu_item_cb (GtkWidget *menuitem, EphyNavigationHistoryAction *action) { +#ifdef HAVE_WEBKIT2 + /* TODO: WebKitBackForwardList */ +#else WebKitWebHistoryItem *item; EphyWindow *window; EphyEmbed *embed; @@ -409,12 +439,17 @@ activate_menu_item_cb (GtkWidget *menuitem, web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); webkit_web_view_go_to_back_forward_item (web_view, item); } +#endif } static GList* webkit_construct_history_list (WebKitWebView *web_view, WebKitHistoryType hist_type, int limit) { +#ifdef HAVE_WEBKIT2 + /* TODO: WebKitBackForwardList */ + return NULL; +#else WebKitWebBackForwardList *web_back_forward_list; GList *webkit_items; @@ -428,6 +463,7 @@ webkit_construct_history_list (WebKitWebView *web_view, limit); return webkit_items; +#endif } static GtkWidget * @@ -453,7 +489,9 @@ build_dropdown_menu (EphyNavigationHistoryAction *action) else list = webkit_construct_history_list (web_view, WEBKIT_HISTORY_FORWARD, 10); - +#ifdef HAVE_WEBKIT2 + /* TODO: WebKitBackForwardList */ +#else for (l = list; l != NULL; l = l->next) { GtkWidget *item; WebKitWebHistoryItem *hitem; @@ -481,6 +519,7 @@ build_dropdown_menu (EphyNavigationHistoryAction *action) gtk_menu_shell_append (menu, item); gtk_widget_show_all (item); } +#endif g_list_free (list); diff --git a/src/ephy-session.c b/src/ephy-session.c index 70af83ca7..82db6f17d 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -128,6 +128,9 @@ session_delete (EphySession *session, g_object_unref (file); } +#ifdef HAVE_WEBKIT2 +/* TODO: Loader */ +#else static void load_status_notify_cb (EphyWebView *view, GParamSpec *pspec, @@ -142,6 +145,7 @@ load_status_notify_cb (EphyWebView *view, status == WEBKIT_LOAD_FINISHED) ephy_session_save (session, SESSION_STATE); } +#endif static void notebook_page_added_cb (GtkWidget *notebook, @@ -149,8 +153,12 @@ notebook_page_added_cb (GtkWidget *notebook, guint position, EphySession *session) { +#ifdef HAVE_WEBKIT2 + /* TODO: Loader */ +#else g_signal_connect (ephy_embed_get_web_view (embed), "notify::load-status", G_CALLBACK (load_status_notify_cb), session); +#endif } static void @@ -161,9 +169,13 @@ notebook_page_removed_cb (GtkWidget *notebook, { ephy_session_save (session, SESSION_STATE); +#ifdef HAVE_WEBKIT2 + /* TODO: Loader */ +#else g_signal_handlers_disconnect_by_func (ephy_embed_get_web_view (embed), G_CALLBACK (load_status_notify_cb), session); +#endif } static void @@ -325,7 +337,11 @@ session_command_open_uris (EphySession *session, { const char *url = uris[i]; EphyNewTabFlags page_flags; +#ifdef HAVE_WEBKIT2 + WebKitURIRequest *request = NULL; +#else WebKitNetworkRequest *request = NULL; +#endif if (url[0] == '\0') { @@ -334,7 +350,11 @@ session_command_open_uris (EphySession *session, 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 } /* For the first URI, if we have a valid recovery diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 8e5b98c12..07a646eb3 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -669,7 +669,11 @@ 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, @@ -761,7 +765,11 @@ 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 } /* Make sure the initial focus is somewhere sensible and not, for @@ -804,7 +812,11 @@ 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, diff --git a/src/ephy-shell.h b/src/ephy-shell.h index 513605bb1..e7dc5efa1 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -32,7 +32,11 @@ #include "ephy-window.h" #include "ephy-embed.h" +#ifdef HAVE_WEBKIT2 +#include <webkit2/webkit2.h> +#else #include <webkit/webkit.h> +#endif #include <glib-object.h> #include <glib.h> @@ -145,7 +149,11 @@ 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 544ff5960..5050452ac 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -65,7 +65,11 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> #include <libsoup/soup.h> +#ifdef HAVE_WEBKIT2 +#include <webkit2/webkit2.h> +#else #include <webkit/webkit.h> +#endif #ifdef HAVE_X11_XF86KEYSYM_H #include <X11/XF86keysym.h> @@ -944,6 +948,9 @@ window_has_ongoing_downloads (EphyWindow *window) for (l = downloads; l != NULL; l = l->next) { +#ifdef HAVE_WEBKIT2 + /* TODO: Downloads */ +#else EphyDownload *download; WebKitDownloadStatus status; @@ -958,6 +965,7 @@ window_has_ongoing_downloads (EphyWindow *window) downloading = TRUE; break; } +#endif } g_list_free (downloads); @@ -1046,6 +1054,9 @@ update_popup_actions_visibility (EphyWindow *window, WebKitWebView *view, guint context) { +#ifdef HAVE_WEBKIT2 + /* TODO: ContextMenu */ +#else GtkAction *action; GtkActionGroup *action_group; gboolean is_image = context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE; @@ -1126,6 +1137,7 @@ update_popup_actions_visibility (EphyWindow *window, if (guesses) g_strfreev (guesses); +#endif } static void @@ -1154,6 +1166,9 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide) } else { +#ifdef HAVE_WEBKIT2 + /* TODO: Editor */ +#else EphyEmbed *embed; WebKitWebView *view; @@ -1167,6 +1182,7 @@ update_edit_actions_sensitivity (EphyWindow *window, gboolean hide) 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 } action_group = window->priv->action_group; @@ -1742,6 +1758,9 @@ embed_popup_deactivate_cb (GtkWidget *popup, _ephy_window_unset_context_event (window); } +#ifdef HAVE_WEBKIT2 +/* TODO: Context Menu */ +#else static void show_embed_popup (EphyWindow *window, WebKitWebView *view, @@ -1821,6 +1840,7 @@ show_embed_popup (EphyWindow *window, gtk_get_current_event_time ()); } } +#endif static gboolean save_property_url (EphyEmbed *embed, @@ -1879,6 +1899,10 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view, GdkEventButton *event, EphyWindow *window) { +#ifdef HAVE_WEBKIT2 + /* TODO: Context Menu */ + return FALSE; +#else guint button, modifier, context; gboolean handled = FALSE; gboolean with_control, with_shift; @@ -1974,6 +1998,7 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view, g_object_unref (hit_test_result); return handled; +#endif } static void @@ -2000,6 +2025,9 @@ ephy_window_set_is_popup (EphyWindow *window, g_object_notify (G_OBJECT (window), "is-popup"); } +#ifdef HAVE_WEBKIT2 +/* TODO: New WebView */ +#else static gboolean web_view_ready_cb (WebKitWebView *web_view, WebKitWebView *parent_web_view) @@ -2092,7 +2120,11 @@ create_web_view_cb (WebKitWebView *web_view, return new_web_view; } +#endif +#ifdef HAVE_WEBKIT2 +/* TODO: Policy client */ +#else static gboolean policy_decision_required_cb (WebKitWebView *web_view, WebKitWebFrame *web_frame, @@ -2227,6 +2259,7 @@ policy_decision_required_cb (WebKitWebView *web_view, return FALSE; } +#endif static void ephy_window_connect_active_embed (EphyWindow *window) @@ -2266,15 +2299,23 @@ ephy_window_connect_active_embed (EphyWindow *window) g_signal_connect_object (web_view, "scroll-event", G_CALLBACK (scroll_event_cb), window, 0); +#ifdef HAVE_WEBKIT2 + /* TODO: New WebView */ +#else g_signal_connect_object (web_view, "create-web-view", G_CALLBACK (create_web_view_cb), window, 0); +#endif +#ifdef HAVE_WEBKIT2 + /* TODO: Policy Client */ +#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), @@ -2341,9 +2382,16 @@ ephy_window_disconnect_active_embed (EphyWindow *window) g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (scroll_event_cb), window); +#ifdef HAVE_WEBKIT2 + /* TODO: New WebView */ +#else g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (create_web_view_cb), window); +#endif +#ifdef HAVE_WEBKIT2 + /* TODO: Policy client */ +#else sid = g_signal_lookup ("navigation-policy-decision-requested", WEBKIT_TYPE_WEB_VIEW); g_signal_handlers_disconnect_matched (web_view, @@ -2362,6 +2410,7 @@ ephy_window_disconnect_active_embed (EphyWindow *window) 0, NULL, G_CALLBACK (policy_decision_required_cb), NULL); +#endif g_signal_handlers_disconnect_by_func (view, G_CALLBACK (sync_tab_popup_windows), @@ -2847,6 +2896,9 @@ downloads_close_cb (GtkButton *button, EphyWindow *window) for (l = downloads; l != NULL; l = l->next) { EphyDownload *download; +#ifdef HAVE_WEBKIT2 + /* TODO: Downloads */ +#else WebKitDownloadStatus status; if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE) @@ -2859,6 +2911,7 @@ downloads_close_cb (GtkButton *button, EphyWindow *window) { gtk_widget_destroy (GTK_WIDGET (l->data)); } +#endif } g_list_free (downloads); diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index b8cb4802a..928d52227 100644 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -39,7 +39,11 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <libsoup/soup.h> +#ifdef HAVE_WEBKIT2 +#include <webkit2/webkit2.h> +#else #include <webkit/webkit.h> +#endif #include <gnome-keyring.h> #include <gnome-keyring-memory.h> @@ -168,10 +172,15 @@ typedef struct static SoupCookieJar* get_cookie_jar () { +#ifdef HAVE_WEBKIT2 + /* TODO: Cookies */ + return soup_cookie_jar_new (); +#else SoupSession* session; session = webkit_get_default_session (); return (SoupCookieJar*)soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR); +#endif } static void @@ -290,7 +299,11 @@ clear_all_dialog_response_cb (GtkDialog *dialog, ephy_embed_single_clear_cache (single); +#ifdef HAVE_WEBKIT2 + /* TODO: Favicons */ +#else webkit_favicon_database_clear (webkit_get_favicon_database ()); +#endif } } gtk_widget_destroy (GTK_WIDGET (dialog)); diff --git a/src/popup-commands.c b/src/popup-commands.c index ff6ee1ffe..e403e967a 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -36,7 +36,11 @@ #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, @@ -89,6 +93,9 @@ void popup_cmd_bookmark_link (GtkAction *action, EphyWindow *window) { +#ifdef HAVE_WEBKIT2 + /* TODO: Context Menu */ +#else EphyEmbedEvent *event; char *title; char *location = NULL; @@ -145,6 +152,7 @@ popup_cmd_bookmark_link (GtkAction *action, ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (window), location, title); g_free (title); g_free (location); +#endif } static void @@ -448,6 +456,9 @@ void popup_replace_spelling (GtkAction *action, EphyWindow *window) { +#ifdef HAVE_WEBKIT2 + /* TODO: Context Menu, Spellchecker */ +#else EphyEmbed *embed; WebKitWebView *view; WebKitWebFrame *frame; @@ -469,6 +480,7 @@ popup_replace_spelling (GtkAction *action, 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 @@ -516,6 +528,9 @@ popup_cmd_open_image (GtkAction *action, void popup_cmd_inspect_element (GtkAction *action, EphyWindow *window) { +#ifdef HAVE_WEBKIT2 + /* TODO: Context Menu, Inspector */ +#else EphyEmbedEvent *event; EphyEmbed *embed; WebKitWebInspector *inspector; @@ -532,4 +547,5 @@ popup_cmd_inspect_element (GtkAction *action, EphyWindow *window) ephy_embed_event_get_coords (event, &x, &y); webkit_web_inspector_inspect_coordinates (inspector, (gdouble)x, (gdouble)y); +#endif } diff --git a/src/window-commands.c b/src/window-commands.c index 98364d712..5fc4dfd17 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -57,7 +57,11 @@ #include <gtk/gtk.h> #include <libnotify/notify.h> #include <string.h> +#ifdef HAVE_WEBKIT2 +#include <webkit2/webkit2.h> +#else #include <webkit/webkit.h> +#endif void window_cmd_file_print (GtkAction *action, @@ -275,6 +279,10 @@ window_cmd_file_open (GtkAction *action, static char * get_suggested_filename (EphyWebView *view) { +#ifdef HAVE_WEBKIT2 + /* TODO: Resources */ + return g_strdup ("WebPage"); +#else char *suggested_filename; const char *mimetype; WebKitWebFrame *frame; @@ -299,6 +307,7 @@ get_suggested_filename (EphyWebView *view) } return suggested_filename; +#endif } void @@ -364,6 +373,9 @@ take_page_snapshot_and_set_image (EphyApplicationDialogData *data) g_object_unref (snapshot); } +#ifdef HAVE_WEBKIT2 +/* TODO: Downloads */ +#else static void download_status_changed_cb (WebKitDownload *download, GParamSpec *spec, @@ -389,10 +401,14 @@ download_status_changed_cb (WebKitDownload *download, break; } } +#endif static void download_icon_and_set_image (EphyApplicationDialogData *data) { +#ifdef HAVE_WEBKIT2 + /* TODO: Downloads */ +#else WebKitNetworkRequest *request; WebKitDownload *download; char *destination, *destination_uri, *tmp_filename; @@ -412,12 +428,16 @@ download_icon_and_set_image (EphyApplicationDialogData *data) g_signal_connect (download, "notify::status", G_CALLBACK (download_status_changed_cb), data); - webkit_download_start (download); + webkit_download_start (download); +#endif } static void fill_default_application_image (EphyApplicationDialogData *data) { +#ifdef HAVE_WEBKIT2 + /* TODO: DOM Bindindgs */ +#else WebKitDOMDocument *document; WebKitDOMNodeList *links; gulong length, i; @@ -441,7 +461,7 @@ fill_default_application_image (EphyApplicationDialogData *data) return; } } - +#endif /* If we make it here, no "apple-touch-icon" link was * found. Take a snapshot of the page. */ take_page_snapshot_and_set_image (data); @@ -665,7 +685,11 @@ window_cmd_edit_undo (GtkAction *action, if (embed) { +#ifdef HAVE_WEBKIT2 + /* TODO: Editor */ +#else webkit_web_view_undo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (EPHY_EMBED (embed))); +#endif } } } @@ -690,7 +714,11 @@ window_cmd_edit_redo (GtkAction *action, embed = gtk_widget_get_ancestor (widget, EPHY_TYPE_EMBED); if (embed) { +#ifdef HAVE_WEBKIT2 + /* TODO: Editor */ +#else webkit_web_view_redo (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (EPHY_EMBED (embed))); +#endif } } } @@ -710,7 +738,11 @@ 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 + /* TODO: Editor */ +#else webkit_web_view_cut_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)); +#endif } } @@ -730,8 +762,11 @@ 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 + /* TODO: Editor */ +#else webkit_web_view_copy_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)); +#endif } } @@ -752,7 +787,11 @@ 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 + /* TODO: Editor */ +#else webkit_web_view_paste_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)); +#endif } } @@ -799,7 +838,11 @@ window_cmd_edit_select_all (GtkAction *action, (EPHY_EMBED_CONTAINER (window)); g_return_if_fail (embed != NULL); +#ifdef HAVE_WEBKIT2 + /* TODO: Editor */ +#else webkit_web_view_select_all (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)); +#endif } } @@ -875,11 +918,14 @@ 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 + /* TODO: View Source */ +#else webkit_web_view_set_view_source_mode (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), TRUE); webkit_web_view_load_uri (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (new_embed), uri); +#endif } @@ -960,6 +1006,9 @@ save_temp_source_write_cb (GOutputStream *ostream, GAsyncResult *result, GString data); } +#ifdef HAVE_WEBKIT2 +/* TODO: Resources */ +#else static void save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed) { @@ -1013,6 +1062,7 @@ save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed (GAsyncReadyCallback)save_temp_source_write_cb, data); } +#endif static void save_temp_source (EphyEmbed *embed, @@ -1037,11 +1087,15 @@ save_temp_source (EphyEmbed *embed, } file = g_file_new_for_path (tmp); +#ifdef HAVE_WEBKIT2 + /* TODO: Resources */ +#else g_file_replace_async (file, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION|G_FILE_CREATE_PRIVATE, G_PRIORITY_DEFAULT, NULL, (GAsyncReadyCallback)save_temp_source_replace_cb, embed); +#endif g_object_unref (file); g_free (tmp); @@ -1182,11 +1236,15 @@ window_cmd_help_about (GtkAction *action, g_key_file_free (key_file); +#ifdef HAVE_WEBKIT2 + /* TODO: WebKit Version */ +#else comments = g_strdup_printf (_("Lets you view web pages and find information on the internet.\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]), |