From 0beb592c5a6a2767e11a892bdb5ac9bcc5283c38 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 10 Jun 2020 23:40:00 +0200 Subject: Use sqlite UPSERT --- main/src/ui/util/config.vala | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/src/ui/util/config.vala b/main/src/ui/util/config.vala index 4ca0d8a0..ce5a3c59 100644 --- a/main/src/ui/util/config.vala +++ b/main/src/ui/util/config.vala @@ -22,7 +22,10 @@ public class Config : Object { get { return window_maximize_; } set { if (value == window_maximize_) return; - db.settings.insert().or("REPLACE").value(db.settings.key, "window_maximized").value(db.settings.value, value.to_string()).perform(); + db.settings.upsert() + .value(db.settings.key, "window_maximized", true) + .value(db.settings.value, value.to_string()) + .perform(); window_maximize_ = value; } } @@ -32,7 +35,10 @@ public class Config : Object { get { return window_height_; } set { if (value == window_height_) return; - db.settings.insert().or("REPLACE").value(db.settings.key, "window_height").value(db.settings.value, value.to_string()).perform(); + db.settings.upsert() + .value(db.settings.key, "window_height", true) + .value(db.settings.value, value.to_string()) + .perform(); window_height_ = value; } } @@ -42,7 +48,10 @@ public class Config : Object { get { return window_width_; } set { if (value == window_width_) return; - db.settings.insert().or("REPLACE").value(db.settings.key, "window_width").value(db.settings.value, value.to_string()).perform(); + db.settings.upsert() + .value(db.settings.key, "window_width", true) + .value(db.settings.value, value.to_string()) + .perform(); window_width_ = value; } } -- cgit v1.2.3-70-g09d2