Skip to content

Commit 8fc0586

Browse files
committed
Use uri instead of path for the background settings
1 parent 4416df6 commit 8fc0586

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/Cards/UserCard.vala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Greeter.UserCard : Greeter.BaseCard {
99
public LightDM.User lightdm_user { get; construct; }
1010
public bool show_input { get; set; default = false; }
1111
public bool is_24h { get; set; default = true; }
12-
// TODO: In Gtk4 remove this gesture and move it to MainWindow
12+
// TODO: In Gtk4 remove this gesture and move it to MainWindow
1313
public Gtk.GestureMultiPress click_gesture { get; private set; }
1414

1515
private Pantheon.AccountsService greeter_act;
@@ -182,6 +182,7 @@ public class Greeter.UserCard : Greeter.BaseCard {
182182
Greeter.BackgroundImage background_image;
183183

184184
var background_path = lightdm_user.background;
185+
warning ("Set background path to %s", background_path);
185186
var background_exists = (
186187
background_path != null &&
187188
FileUtils.test (background_path, EXISTS) &&
@@ -323,7 +324,7 @@ public class Greeter.UserCard : Greeter.BaseCard {
323324
settings.set_value ("xkb-options", options);
324325
}
325326

326-
/*
327+
/*
327328
* When we get string typed settings from our settings daemon account service we might get a null value.
328329
* In this case we reset the value to avoid criticals and unwanted behaviour.
329330
*/
@@ -382,7 +383,14 @@ public class Greeter.UserCard : Greeter.BaseCard {
382383

383384
var background_settings = new GLib.Settings ("org.gnome.desktop.background");
384385
background_settings.set_enum ("picture-options", settings_act.picture_options);
385-
set_or_reset_settings_key (background_settings, "picture-uri", lightdm_user.background);
386+
387+
try {
388+
var uri = Filename.to_uri (lightdm_user.background, null);
389+
set_or_reset_settings_key (background_settings, "picture-uri", uri);
390+
} catch (Error e) {
391+
critical ("Failed to set background URI: %s", e.message);
392+
}
393+
386394
set_or_reset_settings_key (background_settings, "primary-color", settings_act.primary_color);
387395
}
388396

0 commit comments

Comments
 (0)