summaryrefslogtreecommitdiffstats
path: root/daemon/main.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-19 02:21:55 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-19 02:21:55 +0000
commita6dcaafcc9ac9d791991fff9964bc3e48e6b9a8a (patch)
tree09371601e0d2e266d523f16dbf64ca962d18ae50 /daemon/main.c
parent32443320a01544f9a26d09b47cbaee7ca5f30ede (diff)
Add skeleton for service framework
Diffstat (limited to 'daemon/main.c')
-rw-r--r--daemon/main.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 3064a6a6..6c4bc963 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -47,28 +47,12 @@
#include "system.h"
#include "manager.h"
#include "database.h"
+#include "service.h"
static GMainLoop *main_loop = NULL;
static DBusConnection *system_bus = NULL;
-static void config_notify(int action, const char *name, void *data)
-{
- switch (action) {
- case NOTIFY_CREATE:
- debug("File %s/%s created", CONFIGDIR, name);
- break;
-
- case NOTIFY_DELETE:
- debug("File %s/%s deleted", CONFIGDIR, name);
- break;
-
- case NOTIFY_MODIFY:
- debug("File %s/%s modified", CONFIGDIR, name);
- break;
- }
-}
-
static int setup_dbus(void)
{
system_bus = init_dbus("org.bluez", NULL, NULL);
@@ -95,11 +79,21 @@ static int setup_dbus(void)
return -1;
}
+ if (service_init(system_bus) < 0) {
+ database_exit();
+ manager_exit();
+ dbus_connection_destroy_object_path(system_bus, SYSTEM_PATH);
+ dbus_connection_unref(system_bus);
+ return -1;
+ }
+
return 0;
}
static void cleanup_dbus(void)
{
+ service_exit();
+
database_exit();
manager_exit();
@@ -200,8 +194,6 @@ int main(int argc, char *argv[])
notify_init();
- notify_add(CONFIGDIR, config_notify, NULL);
-
if (setup_dbus() < 0) {
g_main_loop_unref(main_loop);
exit(1);
@@ -219,8 +211,6 @@ int main(int argc, char *argv[])
cleanup_dbus();
- notify_remove(CONFIGDIR);
-
notify_close();
g_main_loop_unref(main_loop);