on xenial help sign in
Put the data in the wrong object
78f0d77Ted Gould
plugins/Unity/Indicators/indicatorsmanager.cpp+22−28
@@ -21,7 +21,6 @@
21#include <QSettings>
21#include <QSettings>
22#include <QDebug>
22#include <QDebug>
23
23
24−#include <upstart.h>
25#include <nih/alloc.h>
24#include <nih/alloc.h>
26
25
27#include "paths.h"
26#include "paths.h"
@@ -34,32 +33,7 @@ public:
34 : m_name(name)
33 : m_name(name)
35 , m_fileInfo(fileInfo)
34 , m_fileInfo(fileInfo)
36 , m_verified (true)
35 , m_verified (true)
37− , m_upstart (NULL)
38 {
36 {
39− auto upstartsession = qgetenv("UPSTART_SESSION");
40− if (!upstartsession.isNull()) {
41− DBusConnection * conn = NULL;
42− conn = dbus_connection_open(upstartsession.constData(), NULL);
43− if (conn != NULL) {
44− m_upstart = nih_dbus_proxy_new(NULL, conn,
45− NULL,
46− DBUS_PATH_UPSTART,
47− NULL, NULL);
48− dbus_connection_unref(conn);
49− }
50− }
51−
52− if (m_upstart != NULL) {
53− m_upstart->auto_start = FALSE;
54− }
55− }
56−
57− ~IndicatorData ()
58− {
59− if (m_upstart != NULL) {
60− nih_unref(m_upstart, NULL);
61− m_upstart = NULL;
62− }
63 }
37 }
64
38
65 QString m_name;
39 QString m_name;
@@ -67,19 +41,39 @@ public:
67
41
68 bool m_verified;
42 bool m_verified;
69 Indicator::Ptr m_indicator;
43 Indicator::Ptr m_indicator;
70−
71− NihDBusProxy * m_upstart;
72};
44};
73
45
74IndicatorsManager::IndicatorsManager(QObject* parent)
46IndicatorsManager::IndicatorsManager(QObject* parent)
75 : QObject(parent)
47 : QObject(parent)
76 , m_loaded(false)
48 , m_loaded(false)
49+ , m_upstart(NULL)
77{
50{
51+ auto upstartsession = qgetenv("UPSTART_SESSION");
52+ if (!upstartsession.isNull()) {
53+ DBusConnection * conn = NULL;
54+ conn = dbus_connection_open(upstartsession.constData(), NULL);
55+ if (conn != NULL) {
56+ m_upstart = nih_dbus_proxy_new(NULL, conn,
57+ NULL,
58+ DBUS_PATH_UPSTART,
59+ NULL, NULL);
60+ dbus_connection_unref(conn);
61+ }
62+ }
63+
64+ if (m_upstart != NULL) {
65+ m_upstart->auto_start = FALSE;
66+ }
78}
67}
79
68
80IndicatorsManager::~IndicatorsManager()
69IndicatorsManager::~IndicatorsManager()
81{
70{
82 unload();
71 unload();
72+
73+ if (m_upstart != NULL) {
74+ nih_unref(m_upstart, NULL);
75+ m_upstart = NULL;
76+ }
83}
77}
84
78
85void IndicatorsManager::load()
79void IndicatorsManager::load()
plugins/Unity/Indicators/indicatorsmanager.h+3
@@ -28,6 +28,8 @@
28#include <QHash>
28#include <QHash>
29#include <QSharedPointer>
29#include <QSharedPointer>
30
30
31+#include <upstart.h>
32+
31class UNITYINDICATORS_EXPORT IndicatorsManager : public QObject
33class UNITYINDICATORS_EXPORT IndicatorsManager : public QObject
32{
34{
33 Q_OBJECT
35 Q_OBJECT
@@ -69,6 +71,7 @@ private:
69 QHash<QString, IndicatorData*> m_indicatorsData;
71 QHash<QString, IndicatorData*> m_indicatorsData;
70 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
72 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
71 bool m_loaded;
73 bool m_loaded;
74+ NihDBusProxy * m_upstart;
72};
75};
73
76
74#endif // INDICATORS_MANAGER_H
77#endif // INDICATORS_MANAGER_H