Merge lp:~vikoadi/switchboard-plug-pantheon-shell/use-background-uri into lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Approved by: Danielle Foré
Approved revision: 275
Merged at revision: 275
Proposed branch: lp:~vikoadi/switchboard-plug-pantheon-shell/use-background-uri
Merge into: lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk
Diff against target: 70 lines (+11/-11)
1 file modified
src/Wallpaper.vala (+11/-11)
To merge this branch: bzr merge lp:~vikoadi/switchboard-plug-pantheon-shell/use-background-uri
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+241892@code.launchpad.net

Commit message

org.gnome.desktop.background picture-uri only support uri, so we give them uri

Description of the change

for AccountService to work org.gnome.desktop.background picture-uri must contains an URI and not a path, so i change how it handle file. Instead of refering to it filename, now it refer to its URI.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

Code looks solid and it does what it says. Can't confirm it fixes the issue for some weird reason, but I can confirm that it doesn't break anything and populating the key with what it's supposed to contain can only be a good thing.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Wallpaper.vala'
--- src/Wallpaper.vala 2014-08-13 22:21:43 +0000
+++ src/Wallpaper.vala 2014-11-16 12:39:36 +0000
@@ -64,15 +64,15 @@
64class Wallpaper : EventBox {64class Wallpaper : EventBox {
6565
66 class WallpaperContainer : Gtk.FlowBoxChild {66 class WallpaperContainer : Gtk.FlowBoxChild {
67 public string filename { get; construct; }67 public string uri { get; construct; }
6868
69 Gtk.Image image;69 Gtk.Image image;
7070
71 public WallpaperContainer (string filename) {71 public WallpaperContainer (string uri) {
72 Object (filename: filename);72 Object (uri: uri);
7373
74 try {74 try {
75 image = new Gtk.Image.from_pixbuf (new Gdk.Pixbuf.from_file_at_scale (filename, 150, 100, false));75 image = new Gtk.Image.from_pixbuf (new Gdk.Pixbuf.from_file_at_scale (GLib.Filename.from_uri (uri), 150, 100, false));
76 add (image);76 add (image);
77 } catch (Error e) {77 } catch (Error e) {
78 warning ("Failed to load wallpaper thumbnail: %s", e.message);78 warning ("Failed to load wallpaper thumbnail: %s", e.message);
@@ -185,7 +185,7 @@
185185
186 void update_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {186 void update_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {
187 var selected = (WallpaperContainer) wallpaper_view.get_selected_children ().data;187 var selected = (WallpaperContainer) wallpaper_view.get_selected_children ().data;
188 current_wallpaper_path = selected.filename;188 current_wallpaper_path = selected.uri;
189 settings.set_string ("picture-uri", current_wallpaper_path);189 settings.set_string ("picture-uri", current_wallpaper_path);
190 }190 }
191191
@@ -283,21 +283,21 @@
283 }283 }
284284
285 var file = File.new_for_uri (basefolder + "/" + info.get_name ());285 var file = File.new_for_uri (basefolder + "/" + info.get_name ());
286 string filename = file.get_path ();286 string uri = file.get_uri ();
287287
288 // Skip the default_wallpaper as seen in the description of the288 // Skip the default_wallpaper as seen in the description of the
289 // default_link variable289 // default_link variable
290 if (filename == default_link) {290 if (uri == default_link) {
291 continue;291 continue;
292 }292 }
293293
294 try {294 try {
295 var wallpaper = new WallpaperContainer (filename);295 var wallpaper = new WallpaperContainer (uri);
296 wallpaper_view.add (wallpaper);296 wallpaper_view.add (wallpaper);
297 wallpaper.show_all ();297 wallpaper.show_all ();
298298
299 // Select the wallpaper if it is the current wallpaper299 // Select the wallpaper if it is the current wallpaper
300 if (current_wallpaper_path.has_suffix (filename)) {300 if (current_wallpaper_path.has_suffix (uri)) {
301 this.wallpaper_view.select_child (wallpaper);301 this.wallpaper_view.select_child (wallpaper);
302 }302 }
303303
@@ -355,10 +355,10 @@
355 warning ("Copying wallpaper to local directory failed: %s", e.message);355 warning ("Copying wallpaper to local directory failed: %s", e.message);
356 }356 }
357357
358 string filename = dest.get_path ();358 string uri = dest.get_uri ();
359359
360 // Add the wallpaper name and thumbnail to the IconView360 // Add the wallpaper name and thumbnail to the IconView
361 var wallpaper = new WallpaperContainer (filename);361 var wallpaper = new WallpaperContainer (uri);
362 wallpaper_view.add (wallpaper);362 wallpaper_view.add (wallpaper);
363 wallpaper.show_all ();363 wallpaper.show_all ();
364364

Subscribers

People subscribed via source and target branches

to all changes: