From 0c98b8a1bc00a86f3c0a00aeef8b9276f475366a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 13 Jan 2007 21:42:11 +0000 Subject: Register notification callback --- daemon/main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'daemon/main.c') 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); -- cgit