Merge lp:~laney/ubuntu-system-settings/background-gsettings into lp:ubuntu-system-settings

Proposed by Iain Lane
Status: Merged
Approved by: Ken VanDine
Approved revision: 77
Merged at revision: 78
Proposed branch: lp:~laney/ubuntu-system-settings/background-gsettings
Merge into: lp:ubuntu-system-settings
Diff against target: 71 lines (+30/-1)
2 files modified
debian/control (+2/-0)
plugins/background/MainPage.qml (+28/-1)
To merge this branch: bzr merge lp:~laney/ubuntu-system-settings/background-gsettings
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+171995@code.launchpad.net

Commit message

Read the user's background from GSettings

Description of the change

Read the background from GSettings.

There's a slightly ugly way of dealing with image loading failures, but it's pretty small so I think we can live with it.

On the device we don't appear to use GSettings (yet?) for the background, so this doesn't work there. Try it on the desktop.

Should I depend on gsettings-desktop-schemas too for org.gnome.desktop.background?

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

> Should I depend on gsettings-desktop-schemas too for org.gnome.desktop.background?

yes please

(not commenting on the other parts yet because I'm trying to wrap my head about the connections/signal stuff used there, would be good if Alberto or Ken could comment on that)

76. By Iain Lane

Don't use Connections - just update from onStatusChanged directly

77. By Iain Lane

Depend on gsettings-desktop-schemas

Revision history for this message
Iain Lane (laney) wrote :

On Fri, Jun 28, 2013 at 10:46:48AM -0000, Sebastien Bacher wrote:
> > Should I depend on gsettings-desktop-schemas too for org.gnome.desktop.background?
>
> yes please

Done.

>
> (not commenting on the other parts yet because I'm trying to wrap my head about the connections/signal stuff used there, would be good if Alberto or Ken could comment on that)

I just got rid of the Connections thing as it was unnecessary - should
be simpler now.

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Love to see something using gsettings-qt!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-06-20 12:44:52 +0000
3+++ debian/control 2013-06-28 10:58:30 +0000
4@@ -21,6 +21,8 @@
5 Architecture: i386 amd64 armhf
6 Depends: ${misc:Depends},
7 ${shlibs:Depends},
8+ gsettings-desktop-schemas,
9+ qtdeclarative5-gsettings1.0,
10 qtdeclarative5-ubuntu-ui-toolkit-plugin,
11 libsystemsettings1 (= ${binary:Version}),
12 Recommends: ubuntu-mobile-icons,
13
14=== modified file 'plugins/background/MainPage.qml'
15--- plugins/background/MainPage.qml 2013-06-20 13:17:10 +0000
16+++ plugins/background/MainPage.qml 2013-06-28 10:58:30 +0000
17@@ -19,6 +19,7 @@
18 */
19
20 import QtQuick 2.0
21+import GSettings 1.0
22 import Ubuntu.Components 0.1
23 import Ubuntu.Components.ListItems 0.1 as ListItem
24 import SystemSettings 1.0
25@@ -28,6 +29,11 @@
26 id: mainPage
27 title: i18n.tr("Background")
28
29+ GSettings {
30+ id: background
31+ schema: "org.gnome.desktop.background"
32+ }
33+
34 Label {
35 id: welcomeLabel
36
37@@ -75,12 +81,33 @@
38 right: parent.right
39 }
40
41- source: "aeg.jpg"
42+ Component.onCompleted: updateImage()
43
44 onClicked: pageStack.push(Utilities.createAlbumPage(
45 i18n.tr("Home screen")))
46 }
47
48+ /* We don't have a good way of doing this after passing an invalid image to
49+ SwappableImage, so test the image is valid /before/ showing it and show a
50+ fallback if it isn't. */
51+ function updateImage() {
52+ // TODO: Doesn't yet fade when the background is changed, but probably
53+ // not a huge issue. Will resolve itself when we switch to the SDK's
54+ // CrossFadeImage
55+ if (testImage.status == Image.Ready) {
56+ homeImage.source = testImage.source
57+ } else if (testImage.status == Image.Error) {
58+ homeImage.source = "aeg.jpg"
59+ }
60+ }
61+
62+ Image {
63+ id: testImage
64+ source: background.pictureUri
65+ visible: false
66+ onStatusChanged: updateImage()
67+ }
68+
69
70 ListItem.ThinDivider {
71 id: topDivider

Subscribers

People subscribed via source and target branches