aboutsummaryrefslogtreecommitdiffstats
path: root/lib/history/ephy-history-service-urls-table.c
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-01-24 05:19:09 +0800
committerXan Lopez <xan@igalia.com>2012-03-07 04:49:44 +0800
commitd29278efdc66cb974f7d52258c2c3469e02d7bd0 (patch)
treebca1e716032afd113fab211fbdf74e0a73054173 /lib/history/ephy-history-service-urls-table.c
parent54e7023ac883f7eb1f714eaacd28c5766eb25c66 (diff)
downloadgsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.tar
gsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.tar.gz
gsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.tar.bz2
gsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.tar.lz
gsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.tar.xz
gsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.tar.zst
gsoc2013-epiphany-d29278efdc66cb974f7d52258c2c3469e02d7bd0.zip
history-service: make sure we can update pages' titles and urls
When we retrieve a url from the backend from a user given EphyHistoryURL, it's possible for this to contain updated information for the page. In such case, don't overwrite this with the one stored in the backend. This makes possible to later update this information when saving a new visit.
Diffstat (limited to 'lib/history/ephy-history-service-urls-table.c')
-rw-r--r--lib/history/ephy-history-service-urls-table.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index de0d516ac..0b72875a6 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -102,16 +102,17 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
if (url == NULL) {
url = ephy_history_url_new (NULL, NULL, 0, 0, 0, 1.0);
- } else {
- if (url->url)
- g_free (url->url);
- if (url->title)
- g_free (url->title);
}
url->id = ephy_sqlite_statement_get_column_as_int (statement, 0);
- url->url = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 1)),
- url->title = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 2)),
+
+ /* Only get the URL and page title if we don't know it yet, as the version in the
+ history could be outdated. */
+ if (url->url == NULL)
+ url->url = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 1));
+ if (url->title == NULL)
+ url->title = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 2));
+
url->visit_count = ephy_sqlite_statement_get_column_as_int (statement, 3),
url->typed_count = ephy_sqlite_statement_get_column_as_int (statement, 4),
url->last_visit_time = ephy_sqlite_statement_get_column_as_int (statement, 5);