From 90ac1faf32d4e6db26bd55130c7acb81182bc084 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Thu, 23 Sep 2010 01:57:35 +0300 Subject: [PATCH] confd: emit "changed" signal when value is initially set --- conf.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/conf.c b/conf.c index 5af7adc0..ed421173 100644 --- a/conf.c +++ b/conf.c @@ -385,6 +385,19 @@ static struct pair * find_pair(const char * key) return NULL; } +static void emit_changed(struct pair * pair_ptr) +{ + dbus_signal_emit( + g_dbus_connection, + CONF_OBJECT_PATH, + CONF_IFACE, + "changed", + "sst", + &pair_ptr->key, + &pair_ptr->value, + &pair_ptr->version); +} + /***************************************************************************/ /* D-Bus interface implementation */ @@ -420,6 +433,8 @@ static void conf_set(struct dbus_method_call * call_ptr) return; } + emit_changed(pair_ptr); + store = true; } else @@ -438,15 +453,7 @@ static void conf_set(struct dbus_method_call * call_ptr) pair_ptr->version++; pair_ptr->stored = false; /* mark that new value was not stored on disk yet */ - dbus_signal_emit( - g_dbus_connection, - CONF_OBJECT_PATH, - CONF_IFACE, - "changed", - "sst", - &pair_ptr->key, - &pair_ptr->value, - &pair_ptr->version); + emit_changed(pair_ptr); } else if (!pair_ptr->stored) /* if store to disk failed last time, retry */ { -- 2.11.4.GIT