Skip to content

Commit 6d357b5

Browse files
leolost2605lenemter
authored andcommitted
Use uri instead of path for the background settings
1 parent 5b13c00 commit 6d357b5

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;
@@ -172,6 +172,7 @@ public class Greeter.UserCard : Greeter.BaseCard {
172172
Greeter.BackgroundImage background_image;
173173

174174
var background_path = lightdm_user.background;
175+
warning ("Set background path to %s", background_path);
175176
var background_exists = (
176177
background_path != null &&
177178
FileUtils.test (background_path, EXISTS) &&
@@ -319,7 +320,7 @@ public class Greeter.UserCard : Greeter.BaseCard {
319320
settings.set_value ("xkb-options", options);
320321
}
321322

322-
/*
323+
/*
323324
* When we get string typed settings from our settings daemon account service we might get a null value.
324325
* In this case we reset the value to avoid criticals and unwanted behaviour.
325326
*/
@@ -378,7 +379,14 @@ public class Greeter.UserCard : Greeter.BaseCard {
378379

379380
var background_settings = new GLib.Settings ("org.gnome.desktop.background");
380381
background_settings.set_enum ("picture-options", settings_act.picture_options);
381-
set_or_reset_settings_key (background_settings, "picture-uri", lightdm_user.background);
382+
383+
try {
384+
var uri = Filename.to_uri (lightdm_user.background, null);
385+
set_or_reset_settings_key (background_settings, "picture-uri", uri);
386+
} catch (Error e) {
387+
critical ("Failed to set background URI: %s", e.message);
388+
}
389+
382390
set_or_reset_settings_key (background_settings, "primary-color", settings_act.primary_color);
383391
}
384392

0 commit comments

Comments
 (0)