summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-05-08 19:45:36 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-05-08 19:45:36 +0200
commit40aeea83c05bcaddbe4490f3fbea2a1f185162c1 (patch)
treeea4eb078b997e045eaa5601771e8c7dd67041c9e
parent48ec4cb1fb00b303460302c0eaa17c7ffaabca05 (diff)
Clear tag's wallpapers before removal.
-rw-r--r--db.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/db.c b/db.c
index d2b16be..38a24e2 100644
--- a/db.c
+++ b/db.c
@@ -557,7 +557,7 @@ sqlite_uint64 db_add_tag(const char *name, sqlite_uint64 parent) {
}
}
-static void db_remove_tag_walltags(sqlite_uint64 tagid) {
+static void db_clear_tag_walls(sqlite_uint64 tagid) {
sqlite3_stmt *stmt;
int rc;
@@ -578,10 +578,12 @@ static void db_remove_tag_walltags(sqlite_uint64 tagid) {
sqlite3_finalize(stmt);
}
-static void db_remove_tag_tag(sqlite_uint64 tagid) {
+void db_remove_tag(sqlite_uint64 tagid) {
sqlite3_stmt *stmt;
int rc;
+ db_clear_tag_walls(tagid);
+
rc = sqlite3_prepare_v2(db, "DELETE FROM tag WHERE id = ?", -1, &stmt, NULL);
if(rc != SQLITE_OK) {
@@ -599,12 +601,6 @@ static void db_remove_tag_tag(sqlite_uint64 tagid) {
sqlite3_finalize(stmt);
}
-void db_remove_tag(sqlite_uint64 tagid) {
- db_remove_tag_walltags(tagid);
-
- db_remove_tag_tag(tagid);
-}
-
int db_get_tags_all(GArray **array) {
struct tag_t temp, *temp2;
sqlite3_stmt *stmt;