aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-08-26 15:01:29 -0400
committerfrosty <gabriel@bwaaa.monster>2026-08-26 15:01:29 -0400
commit2ba1fe874070fc372c1a522c5c5b97173fbe1459 (patch)
treea7da63605cc3210bc0288600b9b42737d0f3c073 /libdino/src
parent3a4aa40217276ac0d864c392f9a4b875ff8970ab (diff)
feat: add tweaks page to preferences, as well as an option for avatar roundness
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/entity/settings.vala20
1 files changed, 20 insertions, 0 deletions
diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala
index 8a3eb2fe..7d0f03c8 100644
--- a/libdino/src/entity/settings.vala
+++ b/libdino/src/entity/settings.vala
@@ -21,6 +21,7 @@ public class Settings : Object {
notifications_connection_errors_ = col_to_bool_or_default("notifications_connection_errors", true);
convert_utf8_smileys_ = col_to_bool_or_default("convert_utf8_smileys", true);
check_spelling = col_to_bool_or_default("check_spelling", true);
+ avatar_roundness_ = col_to_int_or_default("avatar_roundness", 20).clamp(0, 100);
}
private bool col_to_bool_or_default(string key, bool def) {
@@ -28,6 +29,12 @@ 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];
+ int parsed = def;
+ return val != null && int.try_parse(val, out parsed) ? parsed : def;
+ }
+
private bool send_typing_;
public bool send_typing {
get { return send_typing_; }
@@ -173,6 +180,19 @@ public class Settings : Object {
}
}
+ private int avatar_roundness_;
+ public int avatar_roundness {
+ get { return avatar_roundness_; }
+ set {
+ int clamped_value = value.clamp(0, 100);
+ db.settings.upsert()
+ .value(db.settings.key, "avatar_roundness", true)
+ .value(db.settings.value, clamped_value.to_string())
+ .perform();
+ avatar_roundness_ = clamped_value;
+ }
+ }
+
public Encryption get_default_encryption(Account account) {
string? setting = db.account_settings.get_value(account.id, "default-encryption");
if (setting != null) {