static gboolean ephy_history_service_execute_clear (EphyHistoryService *self, gpointer pointer, gpointer *result) { ephy_history_service_clear_all (self); ephy_history_service_schedule_commit (self); return TRUE; }
static gboolean ephy_history_service_execute_delete_host (EphyHistoryService *self, EphyHistoryHost *host, EphyHistoryJobCallback callback, gpointer user_data) { ephy_history_service_delete_host_row (self, host); ephy_history_service_schedule_commit (self); return TRUE; }
static gboolean ephy_history_service_execute_add_visits (EphyHistoryService *self, GList *visits, gpointer *result) { gboolean success = TRUE; g_assert (self->priv->history_thread == g_thread_self ()); while (visits) { success = success && ephy_history_service_execute_add_visit_helper (self, (EphyHistoryPageVisit *) visits->data); visits = visits->next; } ephy_history_service_schedule_commit (self); return success; }
static gboolean ephy_history_service_execute_delete_urls (EphyHistoryService *self, GList *urls, gpointer *result) { GList *l; EphyHistoryURL *url; for (l = urls; l != NULL; l = l->next) { url = l->data; ephy_history_service_delete_url (self, url); } ephy_history_service_delete_orphan_hosts (self); ephy_history_service_schedule_commit (self); return TRUE; }
static gboolean ephy_history_service_execute_set_url_title (EphyHistoryService *self, EphyHistoryURL *url, gpointer *result) { char *title = g_strdup (url->title); if (NULL == ephy_history_service_get_url_row (self, NULL, url)) { /* The URL is not yet in the database, so we can't update it.. */ g_free (title); return FALSE; } else { g_free (url->title); url->title = title; ephy_history_service_update_url_row (self, url); ephy_history_service_schedule_commit (self); return TRUE; } }
static gboolean ephy_history_service_execute_set_url_zoom_level (EphyHistoryService *self, GVariant *variant, gpointer *result) { char *url_string; double zoom_level; EphyHistoryHost *host; g_variant_get (variant, "(sd)", &url_string, &zoom_level); host = ephy_history_service_get_host_row_from_url (self, url_string); g_free (url_string); g_return_val_if_fail (host != NULL, FALSE); host->zoom_level = zoom_level; ephy_history_service_update_host_row (self, host); ephy_history_service_schedule_commit (self); return TRUE; }
void ephy_history_service_add_visit_row (EphyHistoryService *self, EphyHistoryPageVisit *visit) { EphySQLiteStatement *statement; GError *error = NULL; g_assert (self->history_thread == g_thread_self ()); g_assert (self->history_database != NULL); statement = ephy_sqlite_connection_create_statement ( self->history_database, "INSERT INTO visits (url, visit_time, visit_type) " " VALUES (?, ?, ?) ", &error); if (error) { g_warning ("Could not build visits table addition statement: %s", error->message); g_error_free (error); return; } if (ephy_sqlite_statement_bind_int (statement, 0, visit->url->id, &error) == FALSE || ephy_sqlite_statement_bind_int (statement, 1, visit->visit_time, &error) == FALSE || ephy_sqlite_statement_bind_int (statement, 2, visit->visit_type, &error) == FALSE) { g_warning ("Could not build visits table addition statement: %s", error->message); g_error_free (error); g_object_unref (statement); return; } ephy_sqlite_statement_step (statement, &error); if (error) { g_warning ("Could not insert URL into visits table: %s", error->message); g_error_free (error); } else { visit->id = ephy_sqlite_connection_get_last_insert_id (self->history_database); } ephy_history_service_schedule_commit (self); g_object_unref (statement); }
gboolean ephy_history_service_initialize_visits_table (EphyHistoryService *self) { GError *error = NULL; if (ephy_sqlite_connection_table_exists (self->history_database, "visits")) return TRUE; ephy_sqlite_connection_execute (self->history_database, "CREATE TABLE visits (" "id INTEGER PRIMARY KEY," "url INTEGER NOT NULL REFERENCES urls(id) ON DELETE CASCADE," "visit_time INTEGER NOT NULL," "visit_type INTEGER NOT NULL," "referring_visit INTEGER)", &error); if (error) { g_warning ("Could not create visits table: %s", error->message); g_error_free (error); return FALSE; } ephy_history_service_schedule_commit (self); return TRUE; }