aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-03-14 01:57:56 +0800
committerXan Lopez <xan@igalia.com>2012-03-14 19:45:03 +0800
commitd42586bb4a2fb45cad1fcc2cf7f6b49a423770cd (patch)
treed20150e82405b42d4a78c9fc44eb42d9f38edca4 /embed
parentc07e7d034b4cfdaad4fc35ef5e82bee9718a1bd9 (diff)
downloadgsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.tar
gsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.tar.gz
gsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.tar.bz2
gsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.tar.lz
gsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.tar.xz
gsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.tar.zst
gsoc2013-epiphany-d42586bb4a2fb45cad1fcc2cf7f6b49a423770cd.zip
history: remember visit types
Instead of hardcoding all visits as 'TYPED' properly distinguish between bookmarks, following links and typing URIs in the entry. We'll use this to compute the frecency of history items.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-private.h11
-rw-r--r--embed/ephy-embed.c20
-rw-r--r--embed/ephy-web-view.c37
3 files changed, 62 insertions, 6 deletions
diff --git a/embed/ephy-embed-private.h b/embed/ephy-embed-private.h
index 17c6ad857..34ba6bcb1 100644
--- a/embed/ephy-embed-private.h
+++ b/embed/ephy-embed-private.h
@@ -22,9 +22,14 @@
#error "Only <epiphany/epiphany.h> can be included directly."
#endif
+#include "ephy-history-types.h"
+#include "ephy-web-view.h"
+
#ifndef EPHY_EMBED_PRIVATE_H
#define EPHY_EMBED_PRIVATE_H
+G_BEGIN_DECLS
+
/* EphyWebView */
#define EPHY_WEB_VIEW_NON_SEARCH_REGEX "(" \
@@ -39,6 +44,12 @@
"^file:.*$" \
")"
+void ephy_web_view_set_visit_type (EphyWebView *view,
+ EphyHistoryPageVisitType visit_type);
+
+EphyHistoryPageVisitType ephy_web_view_get_visit_type (EphyWebView *view);
+
+G_END_DECLS
#endif
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 205f2573b..f1c4c87d5 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -31,6 +31,7 @@
#include "ephy-download.h"
#include "ephy-embed-event.h"
#include "ephy-embed-prefs.h"
+#include "ephy-embed-private.h"
#include "ephy-embed-shell.h"
#include "ephy-embed-single.h"
#include "ephy-embed-utils.h"
@@ -316,32 +317,39 @@ remove_from_destroy_list_cb (GtkWidget *widget, EphyEmbed *embed)
}
static void
-load_status_changed_cb (WebKitWebView *view,
+load_status_changed_cb (WebKitWebView *web_view,
GParamSpec *spec,
EphyEmbed *embed)
{
- WebKitLoadStatus status = webkit_web_view_get_load_status (view);
+ WebKitLoadStatus status = webkit_web_view_get_load_status (web_view);
if (status == WEBKIT_LOAD_COMMITTED) {
const gchar* uri;
char *history_uri;
+ EphyHistoryPageVisitType visit_type;
+ EphyWebView *view = EPHY_WEB_VIEW (web_view);
- uri = webkit_web_view_get_uri (view);
+ uri = webkit_web_view_get_uri (web_view);
ephy_embed_destroy_top_widgets (embed);
restore_zoom_level (embed, uri);
- if (ephy_web_view_is_loading_homepage (EPHY_WEB_VIEW (view)))
+ if (ephy_web_view_is_loading_homepage (view))
return;
- /* TODO: move the normaliztion down to the history service? */
+ /* TODO: move the normalization down to the history service? */
if (g_str_has_prefix (uri, EPHY_ABOUT_SCHEME))
history_uri = g_strdup_printf ("about:%s", uri + EPHY_ABOUT_SCHEME_LEN + 1);
else
history_uri = g_strdup (uri);
- ephy_history_service_visit_url (embed->priv->history_service, history_uri);
+ visit_type = ephy_web_view_get_visit_type (view);
+
+ ephy_history_service_visit_url (embed->priv->history_service,
+ history_uri,
+ visit_type);
+
g_free (history_uri);
}
}
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index de26f42d6..3314e4271 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -104,6 +104,8 @@ struct _EphyWebViewPrivate {
GSList *shown_popups;
GtkWidget *password_info_bar;
+
+ EphyHistoryPageVisitType visit_type;
};
typedef struct {
@@ -1949,6 +1951,9 @@ load_status_cb (WebKitWebView *web_view,
if (uri)
soup_uri_free (uri);
+ /* Reset visit type. */
+ priv->visit_type = EPHY_PAGE_VISIT_NONE;
+
break;
}
case WEBKIT_LOAD_FAILED:
@@ -3694,6 +3699,8 @@ ephy_web_view_load_homepage (EphyWebView *view)
{
g_signal_emit_by_name (view, "loading-homepage");
+ ephy_web_view_set_visit_type (view,
+ EPHY_PAGE_VISIT_HOMEPAGE);
ephy_web_view_load_url (view, "about:blank");
}
@@ -3740,3 +3747,33 @@ ephy_web_view_is_loading_homepage (EphyWebView *view)
return view->priv->loading_homepage;
}
+
+/**
+ * ephy_web_view_get_visit_type:
+ * @view: an #EphyWebView
+ *
+ * Returns: the @view #EphyWebViewVisitType
+ **/
+EphyHistoryPageVisitType
+ephy_web_view_get_visit_type (EphyWebView *view)
+{
+ g_return_val_if_fail (EPHY_IS_WEB_VIEW (view), 0);
+
+ return view->priv->visit_type;
+}
+
+/**
+ * ephy_web_view_set_visit_type:
+ * @view: an #EphyWebView
+ * @visit_type: an #EphyHistoryPageVisitType
+ *
+ * Sets the @visit_type for @view, so that the URI can be
+ * properly weighted in the history backend.
+ **/
+void
+ephy_web_view_set_visit_type (EphyWebView *view, EphyHistoryPageVisitType visit_type)
+{
+ g_return_if_fail (EPHY_IS_WEB_VIEW (view));
+
+ view->priv->visit_type = visit_type;
+}