diff options
author | Xan Lopez <xan@igalia.com> | 2012-02-29 23:35:32 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-03-07 04:49:44 +0800 |
commit | 92dec4e47d68bfb77be9ff256fcf44d1407d4ef4 (patch) | |
tree | ce2d1e7a37a200d7ca714761c4a44685d11f594f /lib/ephy-profile-migrator.c | |
parent | 8ad6302a3f9e1a867f3dd61605196d22e9bd2f86 (diff) | |
download | gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.gz gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.bz2 gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.lz gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.xz gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.zst gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.zip |
Store zoom levels per host, not per URL
Zoom levels have always been stored per host in Epiphany, not per URL
(otherwise you'd have to re-apply the zoom level again and again when
visiting, say, every news entry in your favorite newspaper). Change
things to work like that.
Note: this changes the SQL table format for the history, so you'll
need to re-migrate your history.
Diffstat (limited to 'lib/ephy-profile-migrator.c')
-rw-r--r-- | lib/ephy-profile-migrator.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c index f660d9366..d4d4afbfd 100644 --- a/lib/ephy-profile-migrator.c +++ b/lib/ephy-profile-migrator.c @@ -467,21 +467,22 @@ history_parse_text (GMarkupParseContext *context, } else if (g_str_equal (parse_data->current, "4")) { /* Visit count */ GString *data = g_string_new_len (text, text_len); - sscanf(data->str, "%lld", &parse_data->visit_count); + sscanf (data->str, "%lld", &parse_data->visit_count); g_string_free (data, TRUE); } else if (g_str_equal (parse_data->current, "5")) { /* Last visit */ GString *data = g_string_new_len (text, text_len); - sscanf(data->str, "%lld", &parse_data->last_visit); + sscanf (data->str, "%lld", &parse_data->last_visit); g_string_free (data, TRUE); } else if (g_str_equal (parse_data->current, "6")) { /* First visit */ GString *data = g_string_new_len (text, text_len); - sscanf(data->str, "%lld", &parse_data->first_visit); + sscanf (data->str, "%lld", &parse_data->first_visit); g_string_free (data, TRUE); } else if (g_str_equal (parse_data->current, "10")) { + /* Zoom level. */ GString *data = g_string_new_len (text, text_len); - sscanf(data->str, "%lf", &parse_data->zoom_level); + sscanf (data->str, "%lf", &parse_data->zoom_level); g_string_free (data, TRUE); } @@ -505,10 +506,21 @@ history_parse_end_element (GMarkupParseContext *context, if (g_str_equal (element_name, "node") && parse_data) { /* Add one item to History */ - EphyHistoryPageVisit *visit = ephy_history_page_visit_new (parse_data->location ? parse_data->location : "", parse_data->last_visit, EPHY_PAGE_VISIT_TYPED); + EphyHistoryPageVisit *visit = ephy_history_page_visit_new (parse_data->location ? parse_data->location : "", + parse_data->last_visit, EPHY_PAGE_VISIT_TYPED); g_free (visit->url->title); visit->url->title = g_strdup (parse_data->title); - visit->url->zoom_level = parse_data->zoom_level; + + if (parse_data->zoom_level) { + /* Zoom levels are only stored per host in the old history, so + * creating a new host here is OK. */ + if (!visit->url->host) + visit->url->host = ephy_history_host_new (parse_data->location, parse_data->title, + parse_data->visit_count, parse_data->zoom_level); + else + visit->url->host->zoom_level = parse_data->zoom_level; + } + parse_data->visits = g_list_append (parse_data->visits, visit); } } |