Skip to content

Commit

Permalink
Fix criticals (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored Mar 10, 2024
1 parent 79d06ef commit 7b05167
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Cards/UserCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,18 @@ public class Greeter.UserCard : Greeter.BaseCard {
settings.set_value ("xkb-options", options);
}

/*
* When we get string typed settings from our settings daemon account service we might get a null value.
* In this case we reset the value to avoid criticals and unwanted behaviour.
*/
private void set_or_reset_settings_key (GLib.Settings settings, string key, GLib.Variant? value) {
if (value != null) {
settings.set_value (key, value);
} else {
settings.reset (key);
}
}

private void set_mouse_touchpad_settings () {
var mouse_settings = new GLib.Settings ("org.gnome.desktop.peripherals.mouse");
mouse_settings.set_boolean ("left-handed", settings_act.left_handed);
Expand Down Expand Up @@ -461,9 +473,9 @@ public class Greeter.UserCard : Greeter.BaseCard {
interface_settings.set_value ("cursor-size", settings_act.cursor_size);
interface_settings.set_value ("locate-pointer", settings_act.locate_pointer);
interface_settings.set_value ("text-scaling-factor", settings_act.text_scaling_factor);
interface_settings.set_value ("document-font-name", settings_act.document_font_name);
interface_settings.set_value ("font-name", settings_act.font_name);
interface_settings.set_value ("monospace-font-name", settings_act.monospace_font_name);
set_or_reset_settings_key (interface_settings, "document-font-name", settings_act.document_font_name);
set_or_reset_settings_key (interface_settings, "font-name", settings_act.font_name);
set_or_reset_settings_key (interface_settings, "monospace-font-name", settings_act.monospace_font_name);

var touchscreen_settings = new GLib.Settings ("org.gnome.settings-daemon.peripherals.touchscreen");
touchscreen_settings.set_boolean ("orientation-lock", settings_act.orientation_lock);
Expand Down

0 comments on commit 7b05167

Please sign in to comment.