aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-08-13 00:41:21 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2012-09-01 02:34:00 +0800
commit8d260a1a0af94d01e5b90db70746a83bf5ea71de (patch)
tree9d2927d11c1ffe778a4f12fdcc69a16effabf4eb
parent7c07f1031fea5582d2068bcc813cfa54afef10b7 (diff)
downloadgsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.tar
gsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.tar.gz
gsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.tar.bz2
gsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.tar.lz
gsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.tar.xz
gsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.tar.zst
gsoc2013-epiphany-8d260a1a0af94d01e5b90db70746a83bf5ea71de.zip
ephy-history-service: add a method to set/unset a row hidden
-rw-r--r--lib/history/ephy-history-service.c45
-rw-r--r--lib/history/ephy-history-service.h1
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index e0f89df4f..8fa76ad7c 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -30,6 +30,7 @@ typedef enum {
/* WRITE */
SET_URL_TITLE,
SET_URL_ZOOM_LEVEL,
+ SET_URL_HIDDEN,
ADD_VISIT,
ADD_VISITS,
DELETE_URLS,
@@ -796,6 +797,49 @@ ephy_history_service_set_url_zoom_level (EphyHistoryService *self,
}
static gboolean
+ephy_history_service_execute_set_url_hidden (EphyHistoryService *self,
+ EphyHistoryURL *url,
+ gpointer *result)
+{
+ gboolean hidden;
+
+ hidden = url->hidden;
+
+ if (NULL == ephy_history_service_get_url_row (self, NULL, url)) {
+ /* The URL is not yet in the database, so we can't update it.. */
+ return FALSE;
+ } else {
+ url->hidden = hidden;
+ ephy_history_service_update_url_row (self, url);
+ ephy_history_service_schedule_commit (self);
+ return TRUE;
+ }
+}
+
+void
+ephy_history_service_set_url_hidden (EphyHistoryService *self,
+ const char *orig_url,
+ gboolean hidden,
+ GCancellable *cancellable,
+ EphyHistoryJobCallback callback,
+ gpointer user_data)
+{
+ EphyHistoryServiceMessage *message;
+ EphyHistoryURL *url;
+
+ g_return_if_fail (EPHY_IS_HISTORY_SERVICE (self));
+ g_return_if_fail (orig_url != NULL);
+
+ url = ephy_history_url_new (orig_url, NULL, 0, 0, 0);
+ url->hidden = hidden;
+
+ message = ephy_history_service_message_new (self, SET_URL_HIDDEN,
+ url, (GDestroyNotify)ephy_history_url_free,
+ cancellable, callback, user_data);
+ ephy_history_service_send_message (self, message);
+}
+
+static gboolean
ephy_history_service_execute_get_url (EphyHistoryService *self,
const gchar *orig_url,
gpointer *result)
@@ -968,6 +1012,7 @@ ephy_history_service_quit (EphyHistoryService *self,
static EphyHistoryServiceMethod methods[] = {
(EphyHistoryServiceMethod)ephy_history_service_execute_set_url_title,
(EphyHistoryServiceMethod)ephy_history_service_execute_set_url_zoom_level,
+ (EphyHistoryServiceMethod)ephy_history_service_execute_set_url_hidden,
(EphyHistoryServiceMethod)ephy_history_service_execute_add_visit,
(EphyHistoryServiceMethod)ephy_history_service_execute_add_visits,
(EphyHistoryServiceMethod)ephy_history_service_execute_delete_urls,
diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h
index 233f443bf..f8d64d852 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -66,6 +66,7 @@ void ephy_history_service_find_visits_in_time (EphyHisto
void ephy_history_service_query_visits (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_query_urls (EphyHistoryService *self, EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_set_url_title (EphyHistoryService *self, const char *url, const char *title, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
+void ephy_history_service_set_url_hidden (EphyHistoryService *self, const char *url, gboolean hidden, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_set_url_zoom_level (EphyHistoryService *self, const char *url, const double zoom_level, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_get_host_for_url (EphyHistoryService *self, const char *url, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
void ephy_history_service_get_hosts (EphyHistoryService *self, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);