From ec9466a67a56a55ab344273e6e993a33c139262c Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Tue, 6 Mar 2012 13:00:04 +0100 Subject: 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 file changed, 9 insertions(+) (limited to 'lib/history/ephy-history-service.c') diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c index fb02c80f6..13ed3b3ca 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); -- cgit v1.2.3