aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-05-06 22:47:19 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-06-21 19:54:16 +0800
commit97c91b2fc2059b1e358bb19896203afaa44bfd33 (patch)
tree6aa01250a99fa884d177ce3202d8ff41e8e96d74 /lib
parenta8767266443074689200fff9ca43531d88d65aed (diff)
downloadgsoc2013-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 'lib')
-rw-r--r--lib/ephy-web-app-utils.c8
-rw-r--r--lib/widgets/ephy-download-widget.c34
-rw-r--r--lib/widgets/ephy-hosts-store.c32
-rw-r--r--lib/widgets/ephy-location-entry.c4
4 files changed, 78 insertions, 0 deletions
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 51f3599f7..bd4717199 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -27,7 +27,11 @@
#include <glib/gstdio.h>
#include <libsoup/soup-gnome.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
#define EPHY_WEB_APP_DESKTOP_FILE_PREFIX "epiphany-"
@@ -256,6 +260,9 @@ out:
static void
create_cookie_jar_for_domain (const char *address, const char *directory)
{
+#ifdef HAVE_WEBKIT2
+ /* TODO: Cookies */
+#else
SoupSession *session;
GSList *cookies, *p;
SoupCookieJar *current_jar, *new_jar;
@@ -295,6 +302,7 @@ create_cookie_jar_for_domain (const char *address, const char *directory)
soup_uri_free (uri);
g_slist_free (cookies);
+#endif
}
/**
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c
index f2013ac97..936c93083 100644
--- a/lib/widgets/ephy-download-widget.c
+++ b/lib/widgets/ephy-download-widget.c
@@ -31,7 +31,11 @@
#include "totem-glow-button.h"
#include <glib/gi18n.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
G_DEFINE_TYPE (EphyDownloadWidget, ephy_download_widget, GTK_TYPE_BOX)
@@ -99,6 +103,10 @@ format_interval (gdouble interval)
static gdouble
get_remaining_time (WebKitDownload *download)
{
+#ifdef HAVE_WEBKIT2
+ /* TODO: Downloads */
+ return -1.0;
+#else
gint64 total, cur;
gdouble elapsed_time;
gdouble remaining_time;
@@ -115,12 +123,16 @@ get_remaining_time (WebKitDownload *download)
remaining_time = per_byte_time * (total - cur);
return remaining_time;
+#endif
}
static void
download_clicked_cb (GtkButton *button,
EphyDownloadWidget *widget)
{
+#ifdef HAVE_WEBKIT2
+ /* TODO: Downloads */
+#else
WebKitDownloadStatus status;
EphyDownload *download;
@@ -132,8 +144,12 @@ download_clicked_cb (GtkButton *button,
if (ephy_download_do_download_action (download, EPHY_DOWNLOAD_ACTION_AUTO))
gtk_widget_destroy (GTK_WIDGET (widget));
+#endif
}
+#ifdef HAVE_WEBKIT2
+/* TODO: Downloads */
+#else
static void
update_download_icon (EphyDownloadWidget *widget)
{
@@ -257,6 +273,7 @@ widget_error_cb (WebKitDownload *download,
return FALSE;
}
+#endif
static void
open_activate_cb (GtkMenuItem *item, EphyDownloadWidget *widget)
@@ -284,6 +301,9 @@ download_menu_clicked_cb (GtkWidget *button,
GdkEventButton *event,
EphyDownloadWidget *widget)
{
+#ifdef HAVE_WEBKIT2
+ /* TODO: Downloads */
+#else
WebKitDownloadStatus status;
gboolean finished;
GtkWidget *item;
@@ -340,6 +360,7 @@ download_menu_clicked_cb (GtkWidget *button,
gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
event->button, event->time);
+#endif
}
static void
@@ -394,9 +415,13 @@ ephy_download_widget_dispose (GObject *object)
if (widget->priv->download != NULL) {
download = ephy_download_get_webkit_download (widget->priv->download);
+#ifdef HAVE_WEBKIT2
+ /* TODO: Downloads */
+#else
g_signal_handlers_disconnect_by_func (download, widget_progress_cb, widget);
g_signal_handlers_disconnect_by_func (download, widget_status_cb, widget);
g_signal_handlers_disconnect_by_func (download, widget_error_cb, widget);
+#endif
g_object_unref (widget->priv->download);
widget->priv->download = NULL;
@@ -492,7 +517,12 @@ ephy_download_widget_new (EphyDownload *ephy_download)
"download", ephy_download, NULL);
download = ephy_download_get_webkit_download (ephy_download);
+#ifdef HAVE_WEBKIT2
+ /* TODO: Downloads */
+ basename = g_strdup ("");
+#else
basename = g_filename_display_basename (webkit_download_get_destination_uri (download));
+#endif
dest = g_uri_unescape_string (basename, NULL);
grid = gtk_grid_new ();
@@ -526,12 +556,16 @@ ephy_download_widget_new (EphyDownload *ephy_download)
widget->priv->remaining = remain;
widget->priv->menu = menu;
+#ifdef HAVE_WEBKIT2
+ /* TODO: Downloads */
+#else
g_signal_connect (download, "notify::progress",
G_CALLBACK (widget_progress_cb), widget);
g_signal_connect (download, "notify::status",
G_CALLBACK (widget_status_cb), widget);
g_signal_connect (download, "error",
G_CALLBACK (widget_error_cb), widget);
+#endif
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_HALF);
gtk_button_set_relief (GTK_BUTTON (menu), GTK_RELIEF_NORMAL);
diff --git a/lib/widgets/ephy-hosts-store.c b/lib/widgets/ephy-hosts-store.c
index 4343dff0f..126d31387 100644
--- a/lib/widgets/ephy-hosts-store.c
+++ b/lib/widgets/ephy-hosts-store.c
@@ -28,6 +28,9 @@
G_DEFINE_TYPE (EphyHostsStore, ephy_hosts_store, GTK_TYPE_LIST_STORE)
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
static void
icon_loaded_cb (WebKitFaviconDatabase *database,
const char *address,
@@ -74,14 +77,19 @@ icon_loaded_cb (WebKitFaviconDatabase *database,
done = cmp >= 0;
}
}
+#endif
static void
ephy_hosts_store_finalize (GObject *object)
{
EphyHostsStore *store = EPHY_HOSTS_STORE (object);
+#ifdef HAVE_WEBKIT2
+ /* TODO: Favicons */
+#else
g_signal_handlers_disconnect_by_func (webkit_get_favicon_database (),
icon_loaded_cb, store);
+#endif
G_OBJECT_CLASS (ephy_hosts_store_parent_class)->finalize (object);
}
@@ -112,8 +120,12 @@ ephy_hosts_store_init (EphyHostsStore *self)
EPHY_HOSTS_STORE_COLUMN_ADDRESS,
GTK_SORT_ASCENDING);
+#ifdef HAVE_WEBKIT2
+ /* TODO: Favicons */
+#else
g_signal_connect (webkit_get_favicon_database (), "icon-loaded",
G_CALLBACK (icon_loaded_cb), self);
+#endif
}
EphyHostsStore *
@@ -123,6 +135,9 @@ ephy_hosts_store_new (void)
NULL);
}
+#ifdef HAVE_WEBKIT2
+/* TODO: Favicons */
+#else
typedef struct {
GtkListStore *model;
GtkTreeRowReference *row_reference;
@@ -153,6 +168,7 @@ async_get_favicon_cb (GObject *source, GAsyncResult *result, gpointer user_data)
gtk_tree_row_reference_free (data->row_reference);
g_slice_free (IconLoadData, data);
}
+#endif
void
ephy_hosts_store_add_hosts (EphyHostsStore *store,
@@ -162,22 +178,37 @@ ephy_hosts_store_add_hosts (EphyHostsStore *store,
GtkTreeIter treeiter;
GtkTreePath *path;
GList *iter;
+#ifdef HAVE_WEBKIT2
+ /* TODO: Favicons */
+#else
GdkPixbuf *favicon;
IconLoadData *data;
WebKitFaviconDatabase *database = webkit_get_favicon_database ();
+#endif
for (iter = hosts; iter != NULL; iter = iter->next) {
host = (EphyHistoryHost *)iter->data;
+#ifdef HAVE_WEBKIT2
+ /* TODO: Favicons */
+#else
favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, host->url,
FAVICON_SIZE, FAVICON_SIZE);
+#endif
gtk_list_store_insert_with_values (GTK_LIST_STORE (store),
&treeiter, G_MAXINT,
EPHY_HOSTS_STORE_COLUMN_ID, host->id,
EPHY_HOSTS_STORE_COLUMN_TITLE, host->title,
EPHY_HOSTS_STORE_COLUMN_ADDRESS, host->url,
EPHY_HOSTS_STORE_COLUMN_VISIT_COUNT, host->visit_count,
+#ifdef HAVE_WEBKIT2
+ /* TODO: Favicons */
+#else
EPHY_HOSTS_STORE_COLUMN_FAVICON, favicon,
+#endif
-1);
+#ifdef HAVE_WEBKIT2
+ /* TODO: Favicons */
+#else
if (favicon)
g_object_unref (favicon);
else {
@@ -191,6 +222,7 @@ ephy_hosts_store_add_hosts (EphyHostsStore *store,
FAVICON_SIZE, FAVICON_SIZE, NULL,
async_get_favicon_cb, data);
}
+#endif
}
}
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index fa2a97f89..ef57c5529 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -940,9 +940,13 @@ free_prefetch_helper (PrefetchHelper *helper)
static gboolean
do_dns_prefetch (PrefetchHelper *helper)
{
+#ifdef HAVE_WEBKIT2
+ /* TODO: Network Features */
+#else
SoupSession *session = webkit_get_default_session ();
soup_session_prepare_for_uri (session, helper->uri);
+#endif
helper->entry->priv->dns_prefetch_handler = 0;