@@ -15,6 +15,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Application 0.1
19import Ubuntu.Application 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
21import Ubuntu.Gestures 0.1
@@ -41,8 +42,8 @@ FocusScope {
41 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
42 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
43 property real edgeSize: units.gu(2)
44 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 defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
45− property url background: default_background
46+ property url background
46 readonly property real panelHeight: panel.panelHeight
47 readonly property real panelHeight: panel.panelHeight
48 property bool dashShown: dash.shown
49 property bool dashShown: dash.shown
@@ -115,6 +116,36 @@ FocusScope {
120+ id: backgroundSettings
121+ schema.id: "org.gnome.desktop.background"
123+ property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
124+ onGSettingsPictureChanged: {
125+ shell.background = gSettingsPicture
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.
137+ source: shell.background
140+ sourceSize.height: 0
143+ if (status == Image.Error && source != shell.defaultBackground) {
144+ shell.background = defaultBackground
118 VolumeControl {
149 VolumeControl {
119 id: volumeControl
150 id: volumeControl
@@ -139,12 +170,12 @@ FocusScope {
139 // through the translucent parts of the shell surface.
170 // through the translucent parts of the shell surface.
140 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
171 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
142− Image {
173+ CrossFadeImage {
143 id: backgroundImage
174 id: backgroundImage
144− source: shell.background
175+ objectName: "backgroundImage"
145− sourceSize.width: parent.width
176+
146− sourceSize.height: parent.height
147 anchors.fill: parent
177 anchors.fill: parent
178+ source: shell.background
150 Rectangle {
181 Rectangle {
@@ -189,7 +220,6 @@ FocusScope {
194 id: stagesOuterContainer
224 id: stagesOuterContainer
@@ -254,7 +284,6 @@ FocusScope {
254 ignoreUnknownSignals: true
284 ignoreUnknownSignals: true
259 id: mainStage
288 id: mainStage
@@ -429,10 +458,6 @@ FocusScope {
431 onUnlocked: greeter.hide()
460 onUnlocked: greeter.hide()
433− var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
434− shell.background = bgPath ? bgPath : default_background
437 onLeftTeaserPressedChanged: {
462 onLeftTeaserPressedChanged: {
438 if (leftTeaserPressed) {
463 if (leftTeaserPressed) {