[epiphany/in-tab-overview: 25/56] ephy-history-service: add API to store a url's thumbnail update time



commit 3915179264990e60577618352b285c14a299343b
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Aug 27 11:33:43 2012 +0300

    ephy-history-service: add API to store a url's thumbnail update time

 lib/history/ephy-history-service.c |   43 ++++++++++++++++++++++++++++++++++++
 lib/history/ephy-history-service.h |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index ef58fb3..596d888 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -31,6 +31,7 @@ typedef enum {
   SET_URL_TITLE,
   SET_URL_ZOOM_LEVEL,
   SET_URL_HIDDEN,
+  SET_URL_THUMBNAIL_TIME,
   ADD_VISIT,
   ADD_VISITS,
   DELETE_URLS,
@@ -838,6 +839,47 @@ ephy_history_service_set_url_hidden (EphyHistoryService *self,
 }
 
 static gboolean
+ephy_history_service_execute_set_url_thumbnail_time (EphyHistoryService *self,
+                                                     EphyHistoryURL *url,
+                                                     gpointer *result)
+{
+  int thumbnail_time;
+
+  thumbnail_time = url->thumbnail_time;
+
+  if (NULL == ephy_history_service_get_url_row (self, NULL, url))
+    return FALSE;
+  else {
+    url->thumbnail_time = thumbnail_time;
+    ephy_history_service_update_url_row (self, url);
+    ephy_history_service_schedule_commit (self);
+    return TRUE;
+  }
+}
+
+void
+ephy_history_service_set_url_thumbnail_time (EphyHistoryService *self,
+                                             const char *orig_url,
+                                             int thumbnail_time,
+                                             GCancellable *cancellable,
+                                             EphyHistoryJobCallback callback,
+                                             gpointer user_data)
+{
+  EphyHistoryURL *url;
+  EphyHistoryServiceMessage *message;
+
+  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->thumbnail_time = thumbnail_time;
+  message = ephy_history_service_message_new (self, SET_URL_THUMBNAIL_TIME,
+                                              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)
@@ -1011,6 +1053,7 @@ 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_set_url_thumbnail_time,
   (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 f8d64d8..d6db3a5 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -67,6 +67,7 @@ void                     ephy_history_service_query_visits            (EphyHisto
 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_thumbnail_time  (EphyHistoryService *self, const char *orig_url, int thumbnail_time, 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]