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
1=== modified file 'src/Wallpaper.vala'
2--- src/Wallpaper.vala 2014-08-13 22:21:43 +0000
3+++ src/Wallpaper.vala 2014-11-16 12:39:36 +0000
4@@ -64,15 +64,15 @@
5 class Wallpaper : EventBox {
6
7 class WallpaperContainer : Gtk.FlowBoxChild {
8- public string filename { get; construct; }
9+ public string uri { get; construct; }
10
11 Gtk.Image image;
12
13- public WallpaperContainer (string filename) {
14- Object (filename: filename);
15+ public WallpaperContainer (string uri) {
16+ Object (uri: uri);
17
18 try {
19- image = new Gtk.Image.from_pixbuf (new Gdk.Pixbuf.from_file_at_scale (filename, 150, 100, false));
20+ image = new Gtk.Image.from_pixbuf (new Gdk.Pixbuf.from_file_at_scale (GLib.Filename.from_uri (uri), 150, 100, false));
21 add (image);
22 } catch (Error e) {
23 warning ("Failed to load wallpaper thumbnail: %s", e.message);
24@@ -185,7 +185,7 @@
25
26 void update_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {
27 var selected = (WallpaperContainer) wallpaper_view.get_selected_children ().data;
28- current_wallpaper_path = selected.filename;
29+ current_wallpaper_path = selected.uri;
30 settings.set_string ("picture-uri", current_wallpaper_path);
31 }
32
33@@ -283,21 +283,21 @@
34 }
35
36 var file = File.new_for_uri (basefolder + "/" + info.get_name ());
37- string filename = file.get_path ();
38+ string uri = file.get_uri ();
39
40 // Skip the default_wallpaper as seen in the description of the
41 // default_link variable
42- if (filename == default_link) {
43+ if (uri == default_link) {
44 continue;
45 }
46
47 try {
48- var wallpaper = new WallpaperContainer (filename);
49+ var wallpaper = new WallpaperContainer (uri);
50 wallpaper_view.add (wallpaper);
51 wallpaper.show_all ();
52
53 // Select the wallpaper if it is the current wallpaper
54- if (current_wallpaper_path.has_suffix (filename)) {
55+ if (current_wallpaper_path.has_suffix (uri)) {
56 this.wallpaper_view.select_child (wallpaper);
57 }
58
59@@ -355,10 +355,10 @@
60 warning ("Copying wallpaper to local directory failed: %s", e.message);
61 }
62
63- string filename = dest.get_path ();
64+ string uri = dest.get_uri ();
65
66 // Add the wallpaper name and thumbnail to the IconView
67- var wallpaper = new WallpaperContainer (filename);
68+ var wallpaper = new WallpaperContainer (uri);
69 wallpaper_view.add (wallpaper);
70 wallpaper.show_all ();
71

Subscribers

People subscribed via source and target branches

to all changes: