[epiphany/history-rewrite: 26/28] EphyHistoryService: add API to store a URL zoom level



commit 1b57cc22eaeb30c22f31ca1261a4e918cc2f4760
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Jul 6 15:01:38 2011 +0300

    EphyHistoryService: add API to store a URL zoom level

 lib/history/ephy-history-service.c |   37 ++++++++++++++++++++++++++++++++++++
 lib/history/ephy-history-service.h |    1 +
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index 804aa12..5359cbb 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -550,6 +550,43 @@ ephy_history_service_set_url_title (EphyHistoryService *self,
 }
 
 static gboolean
+ephy_history_service_execute_set_url_zoom_level (EphyHistoryService *self,
+                                                 EphyHistoryURL *url,
+                                                 gpointer *result)
+{
+  double zoom_level = url->zoom_level;
+
+  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->zoom_level = zoom_level;
+    ephy_history_service_update_url_row (self, url);
+    ephy_history_service_schedule_commit (self);
+    return TRUE;
+  }
+}
+
+void
+ephy_history_service_set_url_zoom_level (EphyHistoryService *self,
+                                         const char *orig_url,
+                                         const double zoom_level,
+                                         EphyHistoryJobCallback callback,
+                                         gpointer user_data)
+{
+  EphyHistoryURL *url = ephy_history_url_new (orig_url, NULL, 0, 0, 0, zoom_level);
+
+  EphyHistoryThreadJobDetails *details =
+    ephy_history_thread_job_details_new (self,
+                                         (EphyHistoryJobMethod) ephy_history_service_execute_set_url_zoom_level,
+                                         url, (GDestroyNotify) ephy_history_url_free,
+                                         callback, user_data);
+  ephy_history_service_schedule_idle (self, G_PRIORITY_DEFAULT,
+                                      ephy_history_service_execute_job_on_history_thread,
+                                      details);
+}
+
+static gboolean
 ephy_history_service_execute_get_url (EphyHistoryService *self,
                                       const gchar *orig_url,
                                       gpointer *result)
diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h
index e742f91..8f0b7f1 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -58,6 +58,7 @@ void                     ephy_history_service_add_visit               (EphyHisto
 void                     ephy_history_service_add_visits              (EphyHistoryService *self, GList *visits, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_find_visits_in_time     (EphyHistoryService *self, gint64 from, gint64 to, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_set_url_title           (EphyHistoryService *self, const char *url, const char *title, EphyHistoryJobCallback callback, gpointer user_data);
+void                     ephy_history_service_set_url_zoom_level      (EphyHistoryService *self, const char *url, const double zoom_level, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_get_url                 (EphyHistoryService *self, const char *url, EphyHistoryJobCallback callback, gpointer user_data);
 
 G_END_DECLS



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