diff options
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/entity/settings.vala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala index 0b09e9b9..a488e20f 100644 --- a/libdino/src/entity/settings.vala +++ b/libdino/src/entity/settings.vala @@ -12,6 +12,7 @@ public class Settings : Object { notifications_ = col_to_bool_or_default("notifications", true); convert_utf8_smileys_ = col_to_bool_or_default("convert_utf8_smileys", true); check_spelling = col_to_bool_or_default("check_spelling", true); + zoom_level = col_to_int_or_default("zoom_level", 100); } private bool col_to_bool_or_default(string key, bool def) { @@ -19,6 +20,24 @@ public class Settings : Object { return val != null ? bool.parse(val) : def; } + private int col_to_int_or_default(string key, int def) { + string? val = db.settings.select({db.settings.value}).with(db.settings.key, "=", key)[db.settings.value]; + return val != null ? int.parse(val) : def; + } + + public int zoom_level_; + public int zoom_level { + get { return zoom_level_; } + set { + if (value == zoom_level_) return; + db.settings.upsert() + .value(db.settings.key, "zoom_level", true) + .value(db.settings.value, value.to_string()) + .perform(); + zoom_level_ = value; + } + } + private bool send_typing_; public bool send_typing { get { return send_typing_; } |