Merge lp:~embik/switchboard-plug-pantheon-shell/set-wallpaper-in-accountsservice into lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk

Proposed by Marvin Beckers
Status: Merged
Approved by: Raphael Isemann
Approved revision: 314
Merged at revision: 315
Proposed branch: lp:~embik/switchboard-plug-pantheon-shell/set-wallpaper-in-accountsservice
Merge into: lp:~elementary-apps/switchboard-plug-pantheon-shell/trunk
Diff against target: 83 lines (+37/-0)
2 files modified
src/CMakeLists.txt (+1/-0)
src/Wallpaper.vala (+36/-0)
To merge this branch: bzr merge lp:~embik/switchboard-plug-pantheon-shell/set-wallpaper-in-accountsservice
Reviewer Review Type Date Requested Status
Raphael Isemann (community) code-style, functionality Needs Fixing
Review via email: mp+249262@code.launchpad.net

Commit message

set wallpaper now via accountsservice to make it available for pantheon-greeter

Description of the change

This branch sets the user background image / wallpaper correctly via accountsservice to make information about them available to the greeter.

To post a comment you must log in.
Revision history for this message
Raphael Isemann (teemperor) wrote :

Could you re-add the source code comments from my source[1]? Otherwise only the small indentation error in diff-line 40 needs to be fixed.

Functionality is there.

[1] http://bazaar.launchpad.net/~teemperor/switchboard-plug-pantheon-shell/fix-wallpaper-accountsservices/revision/262

review: Needs Fixing (code-style, functionality)
314. By Marvin Beckers

added comments on implemented accountsservice functionality

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2014-12-25 18:00:56 +0000
+++ src/CMakeLists.txt 2015-02-11 15:02:32 +0000
@@ -24,6 +24,7 @@
24 gnome-desktop-3.024 gnome-desktop-3.0
25 switchboard-2.025 switchboard-2.0
26 granite26 granite
27 posix
27 plank28 plank
28OPTIONS29OPTIONS
29 --thread30 --thread
3031
=== modified file 'src/Wallpaper.vala'
--- src/Wallpaper.vala 2014-11-16 12:33:17 +0000
+++ src/Wallpaper.vala 2015-02-11 15:02:32 +0000
@@ -61,6 +61,11 @@
61 NAME61 NAME
62}62}
6363
64[DBus (name = "org.freedesktop.Accounts.User")]
65interface AccountsServiceUser : Object {
66 public abstract void set_background_file (string filename) throws IOError;
67}
68
64class Wallpaper : EventBox {69class Wallpaper : EventBox {
6570
66 class WallpaperContainer : Gtk.FlowBoxChild {71 class WallpaperContainer : Gtk.FlowBoxChild {
@@ -82,6 +87,9 @@
8287
83 GLib.Settings settings;88 GLib.Settings settings;
8489
90 //Instance of the AccountsServices-Interface for this user
91 AccountsServiceUser accountsservice = null;
92
85 Gtk.FlowBox wallpaper_view;93 Gtk.FlowBox wallpaper_view;
86 ComboBoxText combo;94 ComboBoxText combo;
87 ComboBoxText folder_combo;95 ComboBoxText folder_combo;
@@ -103,6 +111,17 @@
103111
104 settings = new GLib.Settings ("org.gnome.desktop.background");112 settings = new GLib.Settings ("org.gnome.desktop.background");
105113
114 //DBus connection needed in update_wallpaper for
115 //passing the wallpaper-information to accountsservice.
116 try {
117 string uid = "%d".printf ((int) Posix.getuid ());
118 accountsservice = Bus.get_proxy_sync (BusType.SYSTEM,
119 "org.freedesktop.Accounts",
120 "/org/freedesktop/Accounts/User" + uid);
121 } catch (Error e) {
122 warning (e.message);
123 }
124
106 var vbox = new Box (Orientation.VERTICAL, 4);125 var vbox = new Box (Orientation.VERTICAL, 4);
107126
108 wallpaper_view = new Gtk.FlowBox ();127 wallpaper_view = new Gtk.FlowBox ();
@@ -183,10 +202,27 @@
183 current_wallpaper_path = settings.get_string ("picture-uri");202 current_wallpaper_path = settings.get_string ("picture-uri");
184 }203 }
185204
205 void update_accountsservice () {
206 /*
207 * We pass the path to accountsservices that the login-screen can
208 * see what background we selected. This is right now just a patched-in functionality of
209 * accountsservice, so we expect that it is maybe not there
210 * and do nothing if we encounter a unpatched accountsservices-backend.
211 */
212 try {
213 var file = File.new_for_uri (current_wallpaper_path);
214
215 accountsservice.set_background_file (file.get_path ());
216 } catch (Error e) {
217 warning (e.message);
218 }
219 }
220
186 void update_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {221 void update_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {
187 var selected = (WallpaperContainer) wallpaper_view.get_selected_children ().data;222 var selected = (WallpaperContainer) wallpaper_view.get_selected_children ().data;
188 current_wallpaper_path = selected.uri;223 current_wallpaper_path = selected.uri;
189 settings.set_string ("picture-uri", current_wallpaper_path);224 settings.set_string ("picture-uri", current_wallpaper_path);
225 update_accountsservice ();
190 }226 }
191227
192 void update_color () {228 void update_color () {

Subscribers

People subscribed via source and target branches

to all changes: