aboutsummaryrefslogtreecommitdiffstats
path: root/lib/history/ephy-history-service.c
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-03-08 06:16:23 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2012-03-08 06:16:23 +0800
commit6ebe03244f6bcc983e4ad3d06ab0dd09634a5937 (patch)
tree03e26ea9dbf5b2efe4a80a30ec1bc38d3342a440 /lib/history/ephy-history-service.c
parenta1ad3f932f94d52b496d5e717884918f03dcfd16 (diff)
downloadgsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.tar
gsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.tar.gz
gsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.tar.bz2
gsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.tar.lz
gsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.tar.xz
gsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.tar.zst
gsoc2013-epiphany-6ebe03244f6bcc983e4ad3d06ab0dd09634a5937.zip
ephy-history-service: add API to query for hosts
By now, the public API only supports filtering by time range, but filtering by string matching is also possible.
Diffstat (limited to 'lib/history/ephy-history-service.c')
-rw-r--r--lib/history/ephy-history-service.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index ca656c793..436aa1c18 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -41,7 +41,8 @@ typedef enum {
GET_HOST_FOR_URL,
QUERY_URLS,
QUERY_VISITS,
- GET_HOSTS
+ GET_HOSTS,
+ QUERY_HOSTS
} EphyHistoryServiceMessageType;
enum {
@@ -532,6 +533,18 @@ ephy_history_service_execute_get_hosts (EphyHistoryService *self,
return TRUE;
}
+static gboolean
+ephy_history_service_execute_query_hosts (EphyHistoryService *self,
+ EphyHistoryQuery *query, gpointer *results)
+{
+ GList *hosts;
+
+ hosts = ephy_history_service_find_host_rows (self, query);
+ *results = hosts;
+
+ return TRUE;
+}
+
void
ephy_history_service_add_visit (EphyHistoryService *self, EphyHistoryPageVisit *visit, EphyHistoryJobCallback callback, gpointer user_data)
{
@@ -628,6 +641,23 @@ ephy_history_service_get_hosts (EphyHistoryService *self,
ephy_history_service_send_message (self, message);
}
+void
+ephy_history_service_query_hosts (EphyHistoryService *self,
+ EphyHistoryQuery *query,
+ EphyHistoryJobCallback callback,
+ gpointer user_data)
+{
+ EphyHistoryServiceMessage *message;
+
+ g_return_if_fail (EPHY_IS_HISTORY_SERVICE (self));
+
+ message = ephy_history_service_message_new (self, QUERY_HOSTS,
+ ephy_history_query_copy (query),
+ (GDestroyNotify) ephy_history_query_free,
+ callback, user_data);
+ ephy_history_service_send_message (self, message);
+}
+
static gboolean
ephy_history_service_execute_set_url_title (EphyHistoryService *self,
EphyHistoryURL *url,
@@ -888,7 +918,8 @@ static EphyHistoryServiceMethod methods[] = {
(EphyHistoryServiceMethod)ephy_history_service_execute_get_host_for_url,
(EphyHistoryServiceMethod)ephy_history_service_execute_query_urls,
(EphyHistoryServiceMethod)ephy_history_service_execute_find_visits,
- (EphyHistoryServiceMethod)ephy_history_service_execute_get_hosts
+ (EphyHistoryServiceMethod)ephy_history_service_execute_get_hosts,
+ (EphyHistoryServiceMethod)ephy_history_service_execute_query_hosts
};
static void
@@ -950,3 +981,22 @@ ephy_history_service_visit_url (EphyHistoryService *self,
g_signal_emit (self, signals[VISIT_URL], 0, url, &result);
}
+
+void
+ephy_history_service_find_hosts (EphyHistoryService *self,
+ gint64 from, gint64 to,
+ EphyHistoryJobCallback callback,
+ gpointer user_data)
+{
+ EphyHistoryQuery *query;
+
+ g_return_if_fail (EPHY_IS_HISTORY_SERVICE (self));
+
+ query = ephy_history_query_new ();
+
+ query->from = from;
+ query->to = to;
+
+ ephy_history_service_query_hosts (self,
+ query, callback, user_data);
+}