diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-08-13 00:40:07 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-09-01 02:34:00 +0800 |
commit | 7c07f1031fea5582d2068bcc813cfa54afef10b7 (patch) | |
tree | 1be97267384ec51a624874dd49dd7a4da5416e85 /lib | |
parent | 03c2cd35009afd4f572130c44ca4018f425a9def (diff) | |
download | gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.tar gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.tar.gz gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.tar.bz2 gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.tar.lz gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.tar.xz gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.tar.zst gsoc2013-epiphany-7c07f1031fea5582d2068bcc813cfa54afef10b7.zip |
ephy-history-service: add backend bits to support the new hidden column
Diffstat (limited to 'lib')
-rw-r--r-- | lib/history/ephy-history-service-urls-table.c | 17 | ||||
-rw-r--r-- | lib/history/ephy-history-types.c | 2 | ||||
-rw-r--r-- | lib/history/ephy-history-types.h | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c index 8f54dd386..ff8bcbdf3 100644 --- a/lib/history/ephy-history-service-urls-table.c +++ b/lib/history/ephy-history-service-urls-table.c @@ -70,11 +70,11 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri if (url != NULL && url->id != -1) { statement = ephy_sqlite_connection_create_statement (priv->history_database, - "SELECT id, url, title, visit_count, typed_count, last_visit_time FROM urls " + "SELECT id, url, title, visit_count, typed_count, last_visit_time, hidden_from_overview FROM urls " "WHERE id=?", &error); } else { statement = ephy_sqlite_connection_create_statement (priv->history_database, - "SELECT id, url, title, visit_count, typed_count, last_visit_time FROM urls " + "SELECT id, url, title, visit_count, typed_count, last_visit_time, hidden_from_overview FROM urls " "WHERE url=?", &error); } @@ -117,6 +117,7 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri 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); + url->hidden = ephy_sqlite_statement_get_column_as_int (statement, 6); g_object_unref (statement); return url; @@ -174,7 +175,7 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u g_assert (priv->history_database != NULL); statement = ephy_sqlite_connection_create_statement (priv->history_database, - "UPDATE urls SET title=?, visit_count=?, typed_count=?, last_visit_time=? " + "UPDATE urls SET title=?, visit_count=?, typed_count=?, last_visit_time=?, hidden_from_overview=? " "WHERE id=?", &error); if (error) { g_error ("Could not build urls table modification statement: %s", error->message); @@ -186,7 +187,8 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u ephy_sqlite_statement_bind_int (statement, 1, url->visit_count, &error) == FALSE || ephy_sqlite_statement_bind_int (statement, 2, url->typed_count, &error) == FALSE || ephy_sqlite_statement_bind_int (statement, 3, url->last_visit_time, &error) == FALSE || - ephy_sqlite_statement_bind_int (statement, 4, url->id, &error) == FALSE) { + ephy_sqlite_statement_bind_int (statement, 4, url->hidden, &error) == FALSE || + ephy_sqlite_statement_bind_int (statement, 5, url->id, &error) == FALSE) { g_error ("Could not modify URL in urls table: %s", error->message); g_error_free (error); return; @@ -211,7 +213,8 @@ create_url_from_statement (EphySQLiteStatement *statement) url->id = ephy_sqlite_statement_get_column_as_int (statement, 0); url->host = ephy_history_host_new (NULL, NULL, 0, 1.0); - url->host->id = ephy_sqlite_statement_get_column_as_int (statement, 6); + url->hidden = ephy_sqlite_statement_get_column_as_int (statement, 6); + url->host->id = ephy_sqlite_statement_get_column_as_int (statement, 7); return url; } @@ -233,6 +236,7 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery * "urls.visit_count, " "urls.typed_count, " "urls.last_visit_time, " + "urls.hidden_from_overview, " "urls.host " "FROM " "urls "; @@ -254,6 +258,9 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery * statement_str = g_string_append (statement_str, "WHERE "); } + if (query->ignore_hidden) + statement_str = g_string_append (statement_str, "urls.hidden_from_overview = 0 AND "); + if (query->host > 0) statement_str = g_string_append (statement_str, "urls.host = ? AND "); diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c index c003e04b2..a0a5ea8c7 100644 --- a/lib/history/ephy-history-types.c +++ b/lib/history/ephy-history-types.c @@ -147,6 +147,7 @@ ephy_history_url_copy (EphyHistoryURL *url) url->typed_count, url->last_visit_time); copy->id = url->id; + copy->hidden = url->hidden; copy->host = ephy_history_host_copy (url->host); return copy; } @@ -210,6 +211,7 @@ ephy_history_query_copy (EphyHistoryQuery *query) copy->to = query->to; copy->limit = query->limit; copy->sort_type = query->sort_type; + copy->ignore_hidden = query->ignore_hidden; copy->host = query->host; for (iter = query->substring_list; iter != NULL; iter = iter->next) { diff --git a/lib/history/ephy-history-types.h b/lib/history/ephy-history-types.h index 28e762d4e..fab221c3c 100644 --- a/lib/history/ephy-history-types.h +++ b/lib/history/ephy-history-types.h @@ -71,6 +71,7 @@ typedef struct _EphyHistoryURL int visit_count; int typed_count; int last_visit_time; + gboolean hidden; EphyHistoryHost *host; } EphyHistoryURL; @@ -88,6 +89,7 @@ typedef struct _EphyHistoryQuery gint64 to; guint limit; GList* substring_list; + gboolean ignore_hidden; gint host; EphyHistorySortType sort_type; } EphyHistoryQuery; |