aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/entity/settings.vala
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2023-10-13 00:05:26 +0200
committerMiquel Lionel <lionel@les-miquelots.net>2023-10-18 01:37:45 +0200
commit1c4d47f35274d560ee9eb855d7f1c45dd4dd140c (patch)
tree75a62a5828459d6f1481bee0f5701901edf6a655 /libdino/src/entity/settings.vala
parent86b101900c28a09ebc6bcbf212f9969f70ce51b7 (diff)
downloaddino-1c4d47f35274d560ee9eb855d7f1c45dd4dd140c.tar.gz
dino-1c4d47f35274d560ee9eb855d7f1c45dd4dd140c.zip
Add keyboard shortcut and setting to increase text size (fixes #978)add-kbd-shortcut-to-zoom-text
* Can zoom in / out or reset zoom levels via shortcuts * Can change zoom value via global preferences window
Diffstat (limited to 'libdino/src/entity/settings.vala')
-rw-r--r--libdino/src/entity/settings.vala19
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_; }