@@ -16,6 +16,8 @@
1616
1717#include "fake_gsettings.h"
1818
19+#include <QList>
20+
1921struct GSettingsSchemaQmlPrivate {
2022 QByteArray id;
2123 QByteArray path;
@@ -25,27 +27,30 @@ struct GSettingsQmlPrivate {
2527 GSettingsSchemaQml *schema;
2628};
2729
28−bool GSettingsControllerQml::instance_exists;
29−GSettingsControllerQml* GSettingsControllerQml::_controllerInstance;
30+GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
3031
3132GSettingsControllerQml::GSettingsControllerQml() {
3233}
3334
3435GSettingsControllerQml::~GSettingsControllerQml() {
35− instance_exists = false;
36+ s_controllerInstance = 0;
3637}
3738
38−GSettingsControllerQml* GSettingsControllerQml::getInstance() {
39− if(!instance_exists) {
40− _controllerInstance = new GSettingsControllerQml();
41− instance_exists = true;
42− return _controllerInstance;
43− } else {
44− return _controllerInstance;
39+GSettingsControllerQml* GSettingsControllerQml::instance() {
40+ if(!s_controllerInstance) {
41+ s_controllerInstance = new GSettingsControllerQml();
4542 }
43+ return s_controllerInstance;
44+}
45+
46+void GSettingsControllerQml::registerSettingsObject(GSettingsQml *obj) {
47+ m_registeredGSettings.append(obj);
4648}
4749
4850void GSettingsControllerQml::setPictureUri(const QString &str) {
51+ Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
52+ obj->setPictureUri(str);
53+ }
4954}
5055
5156GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
@@ -83,9 +88,9 @@ void GSettingsSchemaQml::setPath(const QByteArray &path) {
8388}
8489
8590GSettingsQml::GSettingsQml(QObject *parent): QObject(parent) {
86− GSettingsControllerQml::getInstance();
8791 priv = new GSettingsQmlPrivate;
8892 priv->schema = new GSettingsSchemaQml(this);
93+ GSettingsControllerQml::instance()->registerSettingsObject(this);
8994}
9095
9196GSettingsQml::~GSettingsQml() {