Tooth/src/Dialogs/Preferences.vala

44 lines
1.7 KiB
Vala
Raw Normal View History

2018-05-20 12:43:42 +00:00
using Gtk;
2022-11-13 20:57:43 +00:00
[GtkTemplate (ui = "/dev/geopjr/tooth/ui/dialogs/preferences.ui")]
public class Tooth.Dialogs.Preferences : Adw.PreferencesWindow {
2021-07-23 11:41:03 +00:00
// [GtkChild] unowned Switch dark_theme;
2021-07-23 11:41:03 +00:00
[GtkChild] unowned Switch autostart;
[GtkChild] unowned Switch work_in_background;
[GtkChild] unowned SpinButton timeline_page_size;
[GtkChild] unowned SpinButton post_text_size;
[GtkChild] unowned Switch live_updates;
[GtkChild] unowned Switch public_live_updates;
2018-05-20 12:43:42 +00:00
2020-05-31 18:55:40 +00:00
construct {
2021-07-23 11:41:03 +00:00
transient_for = app.main_window;
2019-03-11 14:14:37 +00:00
2021-07-23 11:41:03 +00:00
// TODO: default_post_visibility options
// default_post_visibility.set_for_enum (typeof (API.Visibility), e => {
// var i = e.get_value ();
// var vis = API.Visibility.all ()[i];
// default_post_visibility.subtitle = vis.get_desc ();
// return vis.get_name ();
// });
2019-03-11 14:14:37 +00:00
2020-05-31 20:56:43 +00:00
bind ();
2020-05-31 18:55:40 +00:00
show ();
2018-05-20 12:43:42 +00:00
}
public static void open () {
2020-05-31 18:55:40 +00:00
new Preferences ();
2018-05-20 12:43:42 +00:00
}
2020-05-31 20:56:43 +00:00
void bind () {
// settings.bind ("dark-theme", dark_theme, "active", SettingsBindFlags.DEFAULT);
2020-05-31 20:56:43 +00:00
settings.bind ("autostart", autostart, "active", SettingsBindFlags.DEFAULT);
settings.bind ("work-in-background", work_in_background, "active", SettingsBindFlags.DEFAULT);
settings.bind ("timeline-page-size", timeline_page_size.adjustment, "value", SettingsBindFlags.DEFAULT);
settings.bind ("post-text-size", post_text_size.adjustment, "value", SettingsBindFlags.DEFAULT);
settings.bind ("live-updates", live_updates, "active", SettingsBindFlags.DEFAULT);
settings.bind ("public-live-updates", public_live_updates, "active", SettingsBindFlags.DEFAULT);
}
2018-05-20 12:43:42 +00:00
}