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

Proposed by Iain Lane
Status: Merged
Approved by: Ken VanDine
Approved revision: 551
Merged at revision: 550
Proposed branch: lp:~laney/ubuntu-system-settings/private-as-background
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~laney/ubuntu-system-settings/as-library
Diff against target: 142 lines (+19/-54)
3 files modified
plugins/background/CMakeLists.txt (+2/-1)
plugins/background/background.cpp (+14/-50)
plugins/background/background.h (+3/-3)
To merge this branch: bzr merge lp:~laney/ubuntu-system-settings/private-as-background
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+200648@code.launchpad.net

Commit message

[background] Drop direct use of AS & use the new private library.

Description of the change

Drop direct use of AS & use the new private library.

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
Ken VanDine (ken-vandine) wrote :

I'm not a fan of adding unneeded whitespace, can you drop the blank line after defining m_accountsService?

review: Needs Fixing
551. By Iain Lane

Remove whitespace after defining m_accountsService

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/background/CMakeLists.txt'
--- plugins/background/CMakeLists.txt 2013-11-27 21:21:28 +0000
+++ plugins/background/CMakeLists.txt 2014-01-07 15:12:03 +0000
@@ -1,4 +1,3 @@
1
2set(QML_SOURCES1set(QML_SOURCES
3 MainPage.qml2 MainPage.qml
4 OverlayImage.qml3 OverlayImage.qml
@@ -13,6 +12,8 @@
13${QML_SOURCES}) # So they show up in Qt designer.12${QML_SOURCES}) # So they show up in Qt designer.
14qt5_use_modules(UbuntuBackgroundPanel Qml Quick DBus)13qt5_use_modules(UbuntuBackgroundPanel Qml Quick DBus)
1514
15target_link_libraries(UbuntuBackgroundPanel uss-accountsservice)
16
16set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Background)17set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Background)
17install(TARGETS UbuntuBackgroundPanel DESTINATION ${PLUG_DIR})18install(TARGETS UbuntuBackgroundPanel DESTINATION ${PLUG_DIR})
18install(FILES qmldir DESTINATION ${PLUG_DIR})19install(FILES qmldir DESTINATION ${PLUG_DIR})
1920
=== modified file 'plugins/background/background.cpp'
--- plugins/background/background.cpp 2013-12-09 17:17:59 +0000
+++ plugins/background/background.cpp 2014-01-07 15:12:03 +0000
@@ -19,6 +19,7 @@
19*/19*/
2020
21#include "background.h"21#include "background.h"
22
22#include <QDir>23#include <QDir>
23#include <QStandardPaths>24#include <QStandardPaths>
24#include <QEvent>25#include <QEvent>
@@ -27,52 +28,24 @@
27#include <QDebug>28#include <QDebug>
2829
29Background::Background(QObject *parent) :30Background::Background(QObject *parent) :
30 QObject(parent),31 QObject(parent)
31 m_systemBusConnection (QDBusConnection::systemBus()),
32 m_accountsserviceIface ("org.freedesktop.Accounts",
33 "/org/freedesktop/Accounts",
34 "org.freedesktop.Accounts",
35 m_systemBusConnection)
36{32{
37 if (!m_accountsserviceIface.isValid()) {33 QObject::connect(&m_accountsService,
38 return;34 SIGNAL (changed ()),
39 }35 this,
4036 SLOT (slotChanged()));
41 QDBusReply<QDBusObjectPath> qObjectPath = m_accountsserviceIface.call(
42 "FindUserById", qlonglong(getuid()));
43
44 if (qObjectPath.isValid()) {
45 m_objectPath = qObjectPath.value().path();
46 }
47
48 m_systemBusConnection.connect("org.freedesktop.Accounts",
49 m_objectPath,
50 "org.freedesktop.Accounts.User",
51 "Changed",
52 this,
53 SLOT(slotChanged()));
54 updateUbuntuArt();37 updateUbuntuArt();
55 updateCustomBackgrounds();38 updateCustomBackgrounds();
56}39}
5740
58QString Background::getBackgroundFile()41QString Background::getBackgroundFile()
59{42{
60 QDBusInterface userInterface (43 QVariant answer = m_accountsService.getUserProperty(
61 "org.freedesktop.Accounts",44 "org.freedesktop.Accounts.User",
62 m_objectPath,45 "BackgroundFile");
63 "org.freedesktop.DBus.Properties",46
64 m_systemBusConnection,47 if (answer.isValid())
65 this);48 return answer.toString();
66
67 if (userInterface.isValid()) {
68 QDBusReply<QDBusVariant> answer = userInterface.call (
69 "Get",
70 "org.freedesktop.Accounts.User",
71 "BackgroundFile");
72
73 if (answer.isValid())
74 return answer.value().variant().toString();
75 }
7649
77 return QString();50 return QString();
78}51}
@@ -85,18 +58,9 @@
85 if (backgroundFile.url() == m_backgroundFile)58 if (backgroundFile.url() == m_backgroundFile)
86 return;59 return;
8760
88 QDBusInterface userInterface (
89 "org.freedesktop.Accounts",
90 m_objectPath,
91 "org.freedesktop.Accounts.User",
92 m_systemBusConnection,
93 this);
94
95 if (!userInterface.isValid())
96 return;
97
98 m_backgroundFile = backgroundFile.url();61 m_backgroundFile = backgroundFile.url();
99 userInterface.call("SetBackgroundFile", backgroundFile.path());62 m_accountsService.customSetUserProperty("SetBackgroundFile",
63 backgroundFile.path());
100 Q_EMIT backgroundFileChanged();64 Q_EMIT backgroundFileChanged();
101}65}
10266
10367
=== modified file 'plugins/background/background.h'
--- plugins/background/background.h 2013-12-09 17:27:10 +0000
+++ plugins/background/background.h 2014-01-07 15:12:03 +0000
@@ -21,6 +21,8 @@
21#ifndef BACKGROUND_H21#ifndef BACKGROUND_H
22#define BACKGROUND_H22#define BACKGROUND_H
2323
24#include "accountsservice.h"
25
24#include <QDBusInterface>26#include <QDBusInterface>
25#include <QObject>27#include <QObject>
26#include <QProcess>28#include <QProcess>
@@ -60,14 +62,12 @@
60 void ubuntuArtChanged();62 void ubuntuArtChanged();
6163
62private:64private:
65 AccountsService m_accountsService;
63 QStringList m_ubuntuArt;66 QStringList m_ubuntuArt;
64 QStringList m_customBackgrounds;67 QStringList m_customBackgrounds;
65 void updateCustomBackgrounds();68 void updateCustomBackgrounds();
66 void updateUbuntuArt();69 void updateUbuntuArt();
67 QString m_backgroundFile;70 QString m_backgroundFile;
68 QDBusConnection m_systemBusConnection;
69 QString m_objectPath;
70 QDBusInterface m_accountsserviceIface;
71 QString getBackgroundFile();71 QString getBackgroundFile();
72};72};
7373

Subscribers

People subscribed via source and target branches