diff --git a/data/com.github.bleakgrey.tootle.gschema.xml b/data/com.github.bleakgrey.tootle.gschema.xml index 998542c..92aa4c2 100644 --- a/data/com.github.bleakgrey.tootle.gschema.xml +++ b/data/com.github.bleakgrey.tootle.gschema.xml @@ -29,7 +29,7 @@ 20 - 14 + 0 true diff --git a/data/ui/dialogs/preferences.ui b/data/ui/dialogs/preferences.ui index 44cc189..95e873d 100644 --- a/data/ui/dialogs/preferences.ui +++ b/data/ui/dialogs/preferences.ui @@ -1,5 +1,5 @@ - + @@ -174,8 +174,8 @@ 1 - 14 - 32 + 0 + 50 1 1 diff --git a/src/Dialogs/Preferences.vala b/src/Dialogs/Preferences.vala index 2c5a20e..8ad9c5d 100644 --- a/src/Dialogs/Preferences.vala +++ b/src/Dialogs/Preferences.vala @@ -3,8 +3,22 @@ using Gtk; [GtkTemplate (ui = "/com/github/bleakgrey/tootle/ui/dialogs/preferences.ui")] public class Tootle.Dialogs.Preferences : Hdy.PreferencesWindow { + [GtkChild] + Switch dark_theme; + [GtkChild] + Switch autostart; + [GtkChild] + Switch work_in_background; [GtkChild] Hdy.ComboRow default_post_visibility; + [GtkChild] + SpinButton timeline_page_size; + [GtkChild] + SpinButton post_text_size; + [GtkChild] + Switch live_updates; + [GtkChild] + Switch public_live_updates; construct { transient_for = window; @@ -16,6 +30,7 @@ public class Tootle.Dialogs.Preferences : Hdy.PreferencesWindow { return vis.get_name (); }); + bind (); show (); } @@ -23,4 +38,19 @@ public class Tootle.Dialogs.Preferences : Hdy.PreferencesWindow { new Preferences (); } + void bind () { + settings.bind ("dark-theme", dark_theme, "active", SettingsBindFlags.DEFAULT); + settings.bind ("autostart", autostart, "active", SettingsBindFlags.DEFAULT); + settings.bind ("work-in-background", work_in_background, "active", SettingsBindFlags.DEFAULT); + default_post_visibility.selected_index = (int) settings.default_post_visibility; + default_post_visibility.notify["selected-index"].connect (p => { + var i = default_post_visibility.selected_index; + settings.default_post_visibility = (API.Visibility) i; + }); + 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); + } + }