2020-05-29 12:19:35 +00:00
|
|
|
using GLib;
|
|
|
|
|
2022-11-13 20:57:43 +00:00
|
|
|
public class Tooth.Settings : GLib.Settings {
|
2020-05-29 12:19:35 +00:00
|
|
|
|
2021-02-20 11:02:25 +00:00
|
|
|
public string active_account { get; set; }
|
2022-12-22 22:39:55 +00:00
|
|
|
public ColorScheme color_scheme { get; set; }
|
2020-05-31 19:56:03 +00:00
|
|
|
public bool autostart { get; set; }
|
|
|
|
public bool work_in_background { get; set; }
|
|
|
|
public int timeline_page_size { get; set; }
|
|
|
|
public bool live_updates { get; set; }
|
|
|
|
public bool public_live_updates { get; set; }
|
2022-12-02 16:10:51 +00:00
|
|
|
public bool show_spoilers { get; set; }
|
2022-12-29 20:04:45 +00:00
|
|
|
public bool larger_font_size { get; set; }
|
|
|
|
public bool larger_line_height { get; set; }
|
2020-08-01 17:56:12 +00:00
|
|
|
public bool aggressive_resolving { get; set; }
|
2020-05-29 12:19:35 +00:00
|
|
|
|
|
|
|
public Settings () {
|
|
|
|
Object (schema_id: Build.DOMAIN);
|
2021-02-20 11:02:25 +00:00
|
|
|
init ("active-account");
|
2022-12-22 22:39:55 +00:00
|
|
|
init ("color-scheme");
|
2020-05-31 19:56:03 +00:00
|
|
|
init ("autostart");
|
|
|
|
init ("work-in-background");
|
|
|
|
init ("timeline-page-size");
|
|
|
|
init ("live-updates");
|
|
|
|
init ("public-live-updates");
|
2022-12-02 16:10:51 +00:00
|
|
|
init ("show-spoilers");
|
2022-12-29 20:04:45 +00:00
|
|
|
init ("larger-font-size");
|
|
|
|
init ("larger-line-height");
|
2020-08-01 17:56:12 +00:00
|
|
|
init ("aggressive-resolving");
|
2020-05-29 12:19:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void init (string key) {
|
|
|
|
bind (key, this, key, SettingsBindFlags.DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
2022-12-22 22:39:55 +00:00
|
|
|
|
|
|
|
public enum Tooth.ColorScheme {
|
|
|
|
SYSTEM,
|
|
|
|
LIGHT,
|
|
|
|
DARK;
|
|
|
|
|
|
|
|
public string to_string () {
|
|
|
|
switch (this) {
|
|
|
|
case SYSTEM:
|
2023-02-24 04:19:16 +00:00
|
|
|
// translators: Follow System's dark mode preference
|
2022-12-22 22:39:55 +00:00
|
|
|
return _("Follow System");
|
|
|
|
case LIGHT:
|
2023-02-24 04:19:16 +00:00
|
|
|
// translators: Light mode theme
|
2022-12-22 22:39:55 +00:00
|
|
|
return _("Light");
|
|
|
|
case DARK:
|
2023-02-24 04:19:16 +00:00
|
|
|
// translators: Dark mode theme
|
2022-12-22 22:39:55 +00:00
|
|
|
return _("Dark");
|
|
|
|
default:
|
|
|
|
assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Adw.ColorScheme to_adwaita_scheme () {
|
|
|
|
switch (this) {
|
|
|
|
case SYSTEM:
|
|
|
|
return DEFAULT;
|
|
|
|
case LIGHT:
|
|
|
|
return FORCE_LIGHT;
|
|
|
|
case DARK:
|
|
|
|
return FORCE_DARK;
|
|
|
|
default:
|
|
|
|
assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|