@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import GSettings 1.0
1819import Ubuntu.Application 0.1
1920import Ubuntu.Components 0.1
2021import Ubuntu.Gestures 0.1
@@ -41,8 +42,8 @@ FocusScope {
4142 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
4243
4344 property real edgeSize: units.gu(2)
44− property url default_background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
45− property url background: default_background
45+ property url defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
46+ property url background
4647 readonly property real panelHeight: panel.panelHeight
4748
4849 property bool dashShown: dash.shown
@@ -115,6 +116,36 @@ FocusScope {
115116 }
116117 }
117118
119+ GSettings {
120+ id: backgroundSettings
121+ schema.id: "org.gnome.desktop.background"
122+ }
123+ property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
124+ onGSettingsPictureChanged: {
125+ shell.background = gSettingsPicture
126+ }
127+
128+ // This is a dummy image that is needed to determine if the picture url
129+ // in backgroundSettings points to a valid picture file.
130+ // We can't do this with the real background image because setting a
131+ // new source in onStatusChanged triggers a binding loop detection
132+ // inside Image, which causes it not to render even though a valid source
133+ // would be set. We don't mind about this image staying black and just
134+ // use it for verification to populate the source for the real
135+ // background image.
136+ Image {
137+ source: shell.background
138+ height: 0
139+ width: 0
140+ sourceSize.height: 0
141+ sourceSize.width: 0
142+ onStatusChanged: {
143+ if (status == Image.Error && source != shell.defaultBackground) {
144+ shell.background = defaultBackground
145+ }
146+ }
147+ }
148+
118149 VolumeControl {
119150 id: volumeControl
120151 }
@@ -139,12 +170,12 @@ FocusScope {
139170 // through the translucent parts of the shell surface.
140171 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
141172
142− Image {
173+ CrossFadeImage {
143174 id: backgroundImage
144− source: shell.background
145− sourceSize.width: parent.width
146− sourceSize.height: parent.height
175+ objectName: "backgroundImage"
176+
147177 anchors.fill: parent
178+ source: shell.background
148179 }
149180
150181 Rectangle {
@@ -189,7 +220,6 @@ FocusScope {
189220 }
190221 }
191222
192−
193223 Item {
194224 id: stagesOuterContainer
195225
@@ -254,7 +284,6 @@ FocusScope {
254284 ignoreUnknownSignals: true
255285 }
256286
257−
258287 Stage {
259288 id: mainStage
260289
@@ -429,10 +458,6 @@ FocusScope {
429458 }
430459
431460 onUnlocked: greeter.hide()
432− onSelected: {
433− var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
434− shell.background = bgPath ? bgPath : default_background
435− }
436461
437462 onLeftTeaserPressedChanged: {
438463 if (leftTeaserPressed) {