aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 3669115..72fa6dc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -11,18 +11,22 @@
* GNU General Public License for more details:
*
* Copyright (C) 2008 - 2009 Novell, Inc.
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009 - 2010 Red Hat, Inc.
*/
+#include <config.h>
#include <signal.h>
#include <syslog.h>
#include <string.h>
+#include <unistd.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include "mm-manager.h"
#include "mm-options.h"
-#define HAL_DBUS_SERVICE "org.freedesktop.Hal"
+#if !defined(MM_DIST_VERSION)
+# define MM_DIST_VERSION VERSION
+#endif
static GMainLoop *loop = NULL;
@@ -33,8 +37,11 @@ mm_signal_handler (int signo)
mm_options_set_debug (!mm_options_debug ());
else if (signo == SIGINT || signo == SIGTERM) {
g_message ("Caught signal %d, shutting down...", signo);
- g_main_loop_quit (loop);
- }
+ if (loop)
+ g_main_loop_quit (loop);
+ else
+ _exit (0);
+ }
}
static void
@@ -178,6 +185,8 @@ main (int argc, char *argv[])
if (!mm_options_debug ())
logging_setup ();
+ g_message ("ModemManager (version " MM_DIST_VERSION ") starting...");
+
bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err);
if (!bus) {
g_warning ("Could not get the system bus. Make sure "
@@ -201,6 +210,16 @@ main (int argc, char *argv[])
g_signal_handler_disconnect (proxy, id);
+ mm_manager_shutdown (manager);
+
+ /* Wait for all modems to be removed */
+ while (mm_manager_num_modems (manager)) {
+ GMainContext *ctx = g_main_loop_get_context (loop);
+
+ g_main_context_iteration (ctx, FALSE);
+ g_usleep (50);
+ }
+
g_object_unref (manager);
g_object_unref (proxy);
dbus_g_connection_unref (bus);