diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-10 19:15:18 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-10 19:15:18 +0200 |
commit | 15ac98299094f5502044fde7820bf4b05a898a83 (patch) | |
tree | 959497f9c1b6745da64c044720874318618b9033 /sowatchd | |
parent | 4ad9e1874af29864ca8531e5ba033b85d6616639 (diff) | |
download | sowatch-15ac98299094f5502044fde7820bf4b05a898a83.tar.gz sowatch-15ac98299094f5502044fde7820bf4b05a898a83.zip |
autostart daemon on boot
Diffstat (limited to 'sowatchd')
-rw-r--r-- | sowatchd/main.cpp | 10 | ||||
-rw-r--r-- | sowatchd/sowatchd.conf | 13 | ||||
-rw-r--r-- | sowatchd/sowatchd.pro | 22 | ||||
-rw-r--r-- | sowatchd/watchhandler.cpp | 2 |
4 files changed, 31 insertions, 16 deletions
diff --git a/sowatchd/main.cpp b/sowatchd/main.cpp index 2816830..7853cde 100644 --- a/sowatchd/main.cpp +++ b/sowatchd/main.cpp @@ -15,14 +15,14 @@ using namespace sowatch; int main(int argc, char *argv[]) { - // Some plugins might require a user interface, so use QApplication instead - // of QCoreApplication - QApplication a(argc, argv); + // Some plugins use QtGui functionality, so QApplication must be used + // instead of QCoreApplication. + QApplication app(argc, argv); QApplication::setOrganizationDomain("com.javispedro.sowatch"); QApplication::setOrganizationName("sowatch"); QApplication::setApplicationName("sowatchd"); - sowatch::daemon = new Daemon(&a); + sowatch::daemon = new Daemon(&app); new DaemonAdaptor(sowatch::daemon); QDBusConnection connection = QDBusConnection::sessionBus(); @@ -33,5 +33,5 @@ int main(int argc, char *argv[]) qCritical("Could not register daemon object"); } - return a.exec(); + return app.exec(); } diff --git a/sowatchd/sowatchd.conf b/sowatchd/sowatchd.conf new file mode 100644 index 0000000..2cebb82 --- /dev/null +++ b/sowatchd/sowatchd.conf @@ -0,0 +1,13 @@ +description "Sowatch daemon" +author "maemo@javispedro.com" + +stop on stopping xsession + +console none + +respawn +respawn limit 3 10 + +nice 2 + +exec /usr/bin/aegis-exec -s -u user -l "exec /opt/sowatch/bin/sowatchd" diff --git a/sowatchd/sowatchd.pro b/sowatchd/sowatchd.pro index 9299f05..f44acdc 100644 --- a/sowatchd/sowatchd.pro +++ b/sowatchd/sowatchd.pro @@ -5,31 +5,31 @@ TEMPLATE = app QT += core gui dbus CONFIG -= app_bundle -SOURCES += main.cpp daemon.cpp daemonadaptor.cpp \ - watchhandler.cpp -HEADERS += global.h daemon.h daemonadaptor.h \ - watchhandler.h +SOURCES += main.cpp daemon.cpp daemonadaptor.cpp watchhandler.cpp +HEADERS += global.h daemon.h daemonadaptor.h watchhandler.h LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch INCLUDEPATH += $$PWD/../libsowatch DEPENDPATH += $$PWD/../libsowatch -xml.files = service.xml -INSTALLS += xml - +# Library & target paths !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { QMAKE_RPATHDIR += /opt/sowatch/lib target.path = /opt/sowatch/bin - xml.path = /opt/sowatch/xml } else { target.path = /usr/bin - xml.path = /usr/share/sowatch/xml } INSTALLS += target +# Service files +!isEmpty(MEEGO_VERSION_MAJOR) { + service.files = sowatchd.conf + service.path = /etc/init/apps + INSTALLS += service +} + dbus.path = /usr/share/dbus-1/services dbus.files = com.javispedro.sowatch.service.sowatch-service.service INSTALLS += dbus -OTHER_FILES += scanner.xml \ - daemon.xml +OTHER_FILES += daemon.xml diff --git a/sowatchd/watchhandler.cpp b/sowatchd/watchhandler.cpp index 00d0641..314156a 100644 --- a/sowatchd/watchhandler.cpp +++ b/sowatchd/watchhandler.cpp @@ -65,6 +65,8 @@ void WatchHandler::updateWatchlets() QStringList newWatchlets = _config->value("watchlets").toStringList(); QStringList curWatchlets = _watchlet_order; + if (newWatchlets == curWatchlets) return; // Nothing to do + // TODO: Something better than removing all and readding foreach (const QString& s, curWatchlets) { Watchlet* watchlet = _watchlets[s]; |