[epiphany] ephy-history-service: handle correctly zoom level migration



commit ec9466a67a56a55ab344273e6e993a33c139262c
Author: Xan Lopez <xan igalia com>
Date:   Tue Mar 6 13:00:04 2012 +0100

    ephy-history-service: handle correctly zoom level migration
    
    We need to consider the case of an "invalid" host with a non default
    zoom level, since the profile migrator will send us that kind of
    thing.

 lib/history/ephy-history-service.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index fb02c80..13ed3b3 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -432,6 +432,15 @@ ephy_history_service_execute_add_visit_helper (EphyHistoryService *self, EphyHis
 {
   if (visit->url->host == NULL)
     visit->url->host = ephy_history_service_get_host_row_from_url (self, visit->url->url);
+  else if (visit->url->host->id == -1 && visit->url->host->zoom_level != 1.0) {
+    /* This will happen when we migrate the old history to the new
+     * format. We need to store a zoom level for a not-yet-created
+     * host, so we'll end up here. Ugly, but it works. */
+    double zoom_level = visit->url->host->zoom_level;
+    ephy_history_host_free (visit->url->host);
+    visit->url->host = ephy_history_service_get_host_row_from_url (self, visit->url->url);
+    visit->url->host->zoom_level = zoom_level;
+  }
 
   visit->url->host->visit_count++;
   ephy_history_service_update_host_row (self, visit->url->host);



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