[epiphany/history-rewrite] ephy-history-service: add the internal API to remove URLs from history
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/history-rewrite] ephy-history-service: add the internal API to remove URLs from history
- Date: Thu, 21 Jul 2011 09:38:51 +0000 (UTC)
commit e42b5443379083dd49c98b052ec4d0216d49a1e2
Author: Claudio Saavedra <csaavedra igalia com>
Date: Thu Jul 21 12:30:24 2011 +0300
ephy-history-service: add the internal API to remove URLs from history
lib/history/ephy-history-service-private.h | 1 +
lib/history/ephy-history-service-urls-table.c | 49 +++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-service-private.h b/lib/history/ephy-history-service-private.h
index c86b16b..94e8d8e 100644
--- a/lib/history/ephy-history-service-private.h
+++ b/lib/history/ephy-history-service-private.h
@@ -37,6 +37,7 @@ EphyHistoryURL * ephy_history_service_get_url_row (EphyHisto
void ephy_history_service_add_url_row (EphyHistoryService *self, EphyHistoryURL *url);
void ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *url);
GList* ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *query);
+void ephy_history_service_delete_url (EphyHistoryService *self, EphyHistoryURL *url);
gboolean ephy_history_service_initialize_visits_table (EphyHistoryService *self);
void ephy_history_service_add_visit_row (EphyHistoryService *self, EphyHistoryPageVisit *visit);
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 22d7d77..c67008e 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -317,3 +317,52 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *
g_object_unref (statement);
return urls;
}
+
+void
+ephy_history_service_delete_url (EphyHistoryService *self, EphyHistoryURL *url)
+{
+ EphyHistoryServicePrivate *priv = EPHY_HISTORY_SERVICE (self)->priv;
+ EphySQLiteStatement *statement = NULL;
+ gchar *sql_statement;
+ GError *error = NULL;
+
+ g_assert (priv->history_thread == g_thread_self ());
+ g_assert (priv->history_database != NULL);
+
+ g_assert (url->id != -1 || url->url);
+
+ if (url->id != -1)
+ sql_statement = g_strdup ("DELETE FROM urls WHERE id=?");
+ else
+ sql_statement = g_strdup ("DELETE FROM urls WHERE url=?");
+
+ statement = ephy_sqlite_connection_create_statement (priv->history_database,
+ sql_statement, &error);
+ g_free (sql_statement);
+
+ if (error) {
+ g_error ("Could not build urls table query statement: %s", error->message);
+ g_error_free (error);
+ g_object_unref (statement);
+ return;
+ }
+
+ if (url->id != -1) {
+ ephy_sqlite_statement_bind_int (statement, 0, url->id, &error);
+ } else {
+ ephy_sqlite_statement_bind_string (statement, 0, url->url, &error);
+ }
+ if (error) {
+ g_error ("Could not build urls table query statement: %s", error->message);
+ g_error_free (error);
+ g_object_unref (statement);
+ return;
+ }
+
+ ephy_sqlite_statement_step (statement, &error);
+ if (error) {
+ g_error ("Could not modify URL in urls table: %s", error->message);
+ g_error_free (error);
+ }
+ g_object_unref (statement);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]