[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:04:22 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=199697d
The following commit has been merged in the master branch:
commit 199697dd69e826e5ce3d746d70d9518647744f9d
Author: George Goldberg <grundleborg at googlemail.com>
Date: Sat Jun 20 16:30:03 2009 +0000
Terminate the daemon when the AccountMonitor instance is destroyed. Also terminate it when the SIGTERM and SIGINT signals are received.
svn path=/trunk/playground/network/telepathy-integration-daemon/; revision=984368
---
kpeople/nepomuk-feeder/main.cpp | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/kpeople/nepomuk-feeder/main.cpp b/kpeople/nepomuk-feeder/main.cpp
index 192c8bd..cd0a8d7 100644
--- a/kpeople/nepomuk-feeder/main.cpp
+++ b/kpeople/nepomuk-feeder/main.cpp
@@ -18,16 +18,48 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+extern "C"
+{
+#include <signal.h>
+}
+
#include "telepathyaccountmonitor.h"
+#include <kdebug.h>
+
#include <QtCore/QCoreApplication>
+namespace
+{
+ static void signal_handler(int signal)
+ {
+ if ((signal == SIGTERM) || (signal == SIGINT)) {
+ QCoreApplication * const app(QCoreApplication::instance());
+ if (app != 0) {
+ app->quit();
+ }
+ }
+ }
+}
+
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
// Create an instance of the Telepathy Account Monitor.
- new TelepathyAccountMonitor(&app);
+ TelepathyAccountMonitor *monitor = new TelepathyAccountMonitor(&app);
+
+ // Set up signal handlers.
+ if (signal(SIGINT, signal_handler) == SIG_ERR) {
+ kWarning() << "Setting up SIGINT signal handler failed.";
+ }
+
+ if (signal(SIGTERM, signal_handler) == SIG_ERR) {
+ kWarning() << "Setting up SIGTERM signal handler failed.";
+ }
+
+ // Quite the application when the monitor is destroyed.
+ QObject::connect(monitor, SIGNAL(destroyed()), &app, SLOT(quit()));
// Start event loop.
app.exec();
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list