feat(status)[a11y]: large font and line height options

fix: #40
This commit is contained in:
Evangelos Paterakis 2022-12-29 22:04:45 +02:00
parent 85064950c6
commit 0c2876861f
No known key found for this signature in database
GPG key ID: FE5185F095BFC8C9
6 changed files with 71 additions and 0 deletions

View file

@ -36,6 +36,12 @@
<key name="show-spoilers" type="b">
<default>false</default>
</key>
<key name="larger-font-size" type="b">
<default>false</default>
</key>
<key name="larger-line-height" type="b">
<default>false</default>
</key>
<key name="aggressive-resolving" type="b">
<default>false</default>
</key>

View file

@ -148,3 +148,11 @@
.ttl-box-no-shadow > revealer > box {
box-shadow: none;
}
.ttl-status-font-large {
font-size: 18.333333333333332px;
}
.ttl-status-line-height-large {
line-height: 1.4;
}

View file

@ -166,6 +166,35 @@
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Status</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Larger font size</property>
<property name="activatable_widget">larger_font_size</property>
<property name="subtitle" translatable="yes">Makes the status font larger</property>
<child>
<object class="GtkSwitch" id="larger_font_size">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Larger line height</property>
<property name="activatable_widget">larger_line_height</property>
<property name="subtitle" translatable="yes">Makes the status line height larger</property>
<child>
<object class="GtkSwitch" id="larger_line_height">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>

View file

@ -11,6 +11,8 @@ public class Tooth.Dialogs.Preferences : Adw.PreferencesWindow {
[GtkChild] unowned Switch live_updates;
[GtkChild] unowned Switch public_live_updates;
[GtkChild] unowned Switch show_spoilers;
[GtkChild] unowned Switch larger_font_size;
[GtkChild] unowned Switch larger_line_height;
static construct {
typeof (ColorSchemeListModel).ensure ();
@ -47,6 +49,8 @@ public class Tooth.Dialogs.Preferences : Adw.PreferencesWindow {
settings.bind ("live-updates", live_updates, "active", SettingsBindFlags.DEFAULT);
settings.bind ("public-live-updates", public_live_updates, "active", SettingsBindFlags.DEFAULT);
settings.bind ("show-spoilers", show_spoilers, "active", SettingsBindFlags.DEFAULT);
settings.bind ("larger-font-size", larger_font_size, "active", SettingsBindFlags.DEFAULT);
settings.bind ("larger-line-height", larger_line_height, "active", SettingsBindFlags.DEFAULT);
}
[GtkCallback]

View file

@ -11,6 +11,8 @@ public class Tooth.Settings : GLib.Settings {
public bool live_updates { get; set; }
public bool public_live_updates { get; set; }
public bool show_spoilers { get; set; }
public bool larger_font_size { get; set; }
public bool larger_line_height { get; set; }
public bool aggressive_resolving { get; set; }
public Settings () {
@ -24,6 +26,8 @@ public class Tooth.Settings : GLib.Settings {
init ("live-updates");
init ("public-live-updates");
init ("show-spoilers");
init ("larger-font-size");
init ("larger-line-height");
init ("aggressive-resolving");
}

View file

@ -71,6 +71,11 @@ public class Tooth.Widgets.Status : ListBoxRow {
construct {
open.connect (on_open);
if (settings.larger_font_size)
add_css_class("ttl-status-font-large");
if (settings.larger_line_height)
add_css_class("ttl-status-line-height-large");
rebuild_actions ();
}
@ -215,6 +220,21 @@ public class Tooth.Widgets.Status : ListBoxRow {
// status.formal.bind_property ("has-spoiler", this, "reveal-spoiler", BindingFlags.INVERT_BOOLEAN);
settings.notify["larger-font-size"].connect (() => {
if (settings.larger_font_size) {
add_css_class("ttl-status-font-large");
} else {
remove_css_class("ttl-status-font-large");
}
});
settings.notify["larger-line-height"].connect (() => {
if (settings.larger_line_height) {
add_css_class("ttl-status-line-height-large");
} else {
remove_css_class("ttl-status-line-height-large");
}
});
status.formal.bind_property ("has-spoiler", this, "reveal-spoiler", BindingFlags.SYNC_CREATE, (b, src, ref target) => {
target.set_boolean (!src.get_boolean () || settings.show_spoilers);
return true;