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
1=== modified file 'src/CMakeLists.txt'
2--- src/CMakeLists.txt 2014-12-25 18:00:56 +0000
3+++ src/CMakeLists.txt 2015-02-11 15:02:32 +0000
4@@ -24,6 +24,7 @@
5 gnome-desktop-3.0
6 switchboard-2.0
7 granite
8+ posix
9 plank
10 OPTIONS
11 --thread
12
13=== modified file 'src/Wallpaper.vala'
14--- src/Wallpaper.vala 2014-11-16 12:33:17 +0000
15+++ src/Wallpaper.vala 2015-02-11 15:02:32 +0000
16@@ -61,6 +61,11 @@
17 NAME
18 }
19
20+[DBus (name = "org.freedesktop.Accounts.User")]
21+interface AccountsServiceUser : Object {
22+ public abstract void set_background_file (string filename) throws IOError;
23+}
24+
25 class Wallpaper : EventBox {
26
27 class WallpaperContainer : Gtk.FlowBoxChild {
28@@ -82,6 +87,9 @@
29
30 GLib.Settings settings;
31
32+ //Instance of the AccountsServices-Interface for this user
33+ AccountsServiceUser accountsservice = null;
34+
35 Gtk.FlowBox wallpaper_view;
36 ComboBoxText combo;
37 ComboBoxText folder_combo;
38@@ -103,6 +111,17 @@
39
40 settings = new GLib.Settings ("org.gnome.desktop.background");
41
42+ //DBus connection needed in update_wallpaper for
43+ //passing the wallpaper-information to accountsservice.
44+ try {
45+ string uid = "%d".printf ((int) Posix.getuid ());
46+ accountsservice = Bus.get_proxy_sync (BusType.SYSTEM,
47+ "org.freedesktop.Accounts",
48+ "/org/freedesktop/Accounts/User" + uid);
49+ } catch (Error e) {
50+ warning (e.message);
51+ }
52+
53 var vbox = new Box (Orientation.VERTICAL, 4);
54
55 wallpaper_view = new Gtk.FlowBox ();
56@@ -183,10 +202,27 @@
57 current_wallpaper_path = settings.get_string ("picture-uri");
58 }
59
60+ void update_accountsservice () {
61+ /*
62+ * We pass the path to accountsservices that the login-screen can
63+ * see what background we selected. This is right now just a patched-in functionality of
64+ * accountsservice, so we expect that it is maybe not there
65+ * and do nothing if we encounter a unpatched accountsservices-backend.
66+ */
67+ try {
68+ var file = File.new_for_uri (current_wallpaper_path);
69+
70+ accountsservice.set_background_file (file.get_path ());
71+ } catch (Error e) {
72+ warning (e.message);
73+ }
74+ }
75+
76 void update_wallpaper (Gtk.FlowBox box, Gtk.FlowBoxChild child) {
77 var selected = (WallpaperContainer) wallpaper_view.get_selected_children ().data;
78 current_wallpaper_path = selected.uri;
79 settings.set_string ("picture-uri", current_wallpaper_path);
80+ update_accountsservice ();
81 }
82
83 void update_color () {

Subscribers

People subscribed via source and target branches

to all changes: