From 1c4d47f35274d560ee9eb855d7f1c45dd4dd140c Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Fri, 13 Oct 2023 00:05:26 +0200 Subject: Add keyboard shortcut and setting to increase text size (fixes #978) * Can zoom in / out or reset zoom levels via shortcuts * Can change zoom value via global preferences window --- libdino/src/entity/settings.vala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libdino/src/entity/settings.vala') 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_; } -- cgit v1.2.3-70-g09d2