summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-13 21:42:11 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-13 21:42:11 +0000
commit0c98b8a1bc00a86f3c0a00aeef8b9276f475366a (patch)
tree2b150f84fecb4521e8338e6a9766a2e6e4aed1eb
parent84fa9983df320c0bd5c400735474b5c0e98e5efd (diff)
Register notification callback
-rw-r--r--daemon/main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/daemon/main.c b/daemon/main.c
index d7afaedc..2c13b6a5 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -47,6 +47,23 @@ 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 void sig_term(int sig)
{
g_main_loop_quit(main_loop);
@@ -138,6 +155,8 @@ int main(int argc, char *argv[])
notify_init();
+ notify_add(CONFIGDIR, config_notify, NULL);
+
system_bus = init_dbus("org.bluez", NULL, NULL);
if (!system_bus) {
g_main_loop_unref(main_loop);
@@ -148,6 +167,8 @@ int main(int argc, char *argv[])
dbus_connection_unref(system_bus);
+ notify_remove(CONFIGDIR);
+
notify_close();
g_main_loop_unref(main_loop);