@@ -21,7 +21,6 @@
2121#include <QSettings>
2222#include <QDebug>
2323
24−#include <upstart.h>
2524#include <nih/alloc.h>
2625
2726#include "paths.h"
@@ -34,32 +33,7 @@ public:
3433 : m_name(name)
3534 , m_fileInfo(fileInfo)
3635 , m_verified (true)
37− , m_upstart (NULL)
3836 {
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− }
6337 }
6438
6539 QString m_name;
@@ -67,19 +41,39 @@ public:
6741
6842 bool m_verified;
6943 Indicator::Ptr m_indicator;
70−
71− NihDBusProxy * m_upstart;
7244};
7345
7446IndicatorsManager::IndicatorsManager(QObject* parent)
7547 : QObject(parent)
7648 , m_loaded(false)
49+ , m_upstart(NULL)
7750{
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+ }
7867}
7968
8069IndicatorsManager::~IndicatorsManager()
8170{
8271 unload();
72+
73+ if (m_upstart != NULL) {
74+ nih_unref(m_upstart, NULL);
75+ m_upstart = NULL;
76+ }
8377}
8478
8579void IndicatorsManager::load()