summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-09-27 17:33:08 -0300
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-09-27 17:45:45 -0300
commit720ef14d022d98f8b87921cec791f052f5609754 (patch)
tree554d6934f82e31dbf2e8fb6205de69de3028e9a0 /src
parent72f64639ca5706eed2d3396ee7dbea4530e5b7ab (diff)
downloadweekeyboard-720ef14d022d98f8b87921cec791f052f5609754.tar.gz
weekeyboard-720ef14d022d98f8b87921cec791f052f5609754.tar.bz2
weekeyboard-720ef14d022d98f8b87921cec791f052f5609754.zip
Emit 'ValueChanged' signal upon change
Change-Id: I4079c68f6c2b22da7d74115ad50fe894278c515b Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/wkb-ibus-config-eet-test.c2
-rw-r--r--src/wkb-ibus-config-eet.c25
-rw-r--r--src/wkb-ibus-config-eet.h2
-rw-r--r--src/wkb-ibus-config.c2
4 files changed, 25 insertions, 6 deletions
diff --git a/src/wkb-ibus-config-eet-test.c b/src/wkb-ibus-config-eet-test.c
index 5c014f1..5266be9 100644
--- a/src/wkb-ibus-config-eet-test.c
+++ b/src/wkb-ibus-config-eet-test.c
@@ -37,7 +37,7 @@ main (int argc, char *argv[])
goto eet_err;
}
- cfg = wkb_ibus_config_eet_new("ibus-cfg.eet");
+ cfg = wkb_ibus_config_eet_new("ibus-cfg.eet", NULL);
wkb_ibus_config_eet_free(cfg);
end:
diff --git a/src/wkb-ibus-config-eet.c b/src/wkb-ibus-config-eet.c
index d3a1d7d..15b8fa2 100644
--- a/src/wkb-ibus-config-eet.c
+++ b/src/wkb-ibus-config-eet.c
@@ -762,6 +762,7 @@ _config_ibus_new(void)
struct wkb_ibus_config_eet
{
const char *path;
+ Eldbus_Service_Interface *iface;
struct _config_section *ibus_config;
Eet_Data_Descriptor *hotkey_edd;
@@ -772,6 +773,22 @@ struct wkb_ibus_config_eet
Eet_Data_Descriptor *ibus_edd;
};
+static void
+_config_eet_value_changed(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name, Eldbus_Message_Iter *value)
+{
+ Eldbus_Message *signal = eldbus_service_signal_new(config_eet->iface, 0);
+ Eldbus_Message_Iter *iter = eldbus_message_iter_get(signal);
+
+ if (!value)
+ {
+ value = eldbus_message_iter_container_new(iter, 'v', NULL);
+ eldbus_message_iter_container_close(iter, value);
+ }
+
+ eldbus_message_iter_arguments_append(iter, "ssv", section, name, value);
+ eldbus_service_signal_send(config_eet->iface, signal);
+}
+
Eina_Bool
wkb_ibus_config_eet_set_value(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name, Eldbus_Message_Iter *value)
{
@@ -794,6 +811,7 @@ wkb_ibus_config_eet_set_value(struct wkb_ibus_config_eet *config_eet, const char
ret = EINA_FALSE;
}
eet_close(ef);
+ _config_eet_value_changed(config_eet, section, name, value);
}
end:
@@ -862,9 +880,10 @@ wkb_ibus_config_eet_set_defaults(struct wkb_ibus_config_eet *config_eet)
}
static struct wkb_ibus_config_eet *
-_config_eet_init(const char *path)
+_config_eet_init(const char *path, Eldbus_Service_Interface *iface)
{
struct wkb_ibus_config_eet *eet = calloc(1, sizeof(*eet));
+ eet->iface = iface;
eet->path = eina_stringshare_add(path);
eet->hotkey_edd = _config_hotkey_edd_new();
@@ -885,9 +904,9 @@ _config_eet_exists(const char *path)
}
struct wkb_ibus_config_eet *
-wkb_ibus_config_eet_new(const char *path)
+wkb_ibus_config_eet_new(const char *path, Eldbus_Service_Interface *iface)
{
- struct wkb_ibus_config_eet *eet = _config_eet_init(path);
+ struct wkb_ibus_config_eet *eet = _config_eet_init(path, iface);
Eet_File *ef = NULL;
Eet_File_Mode mode = EET_FILE_MODE_READ_WRITE;
diff --git a/src/wkb-ibus-config-eet.h b/src/wkb-ibus-config-eet.h
index ce2bde0..020d8a4 100644
--- a/src/wkb-ibus-config-eet.h
+++ b/src/wkb-ibus-config-eet.h
@@ -28,7 +28,7 @@ Eina_Bool wkb_ibus_config_eet_get_values(struct wkb_ibus_config_eet *config_eet,
void wkb_ibus_config_eet_set_defaults(struct wkb_ibus_config_eet *config_eet);
-struct wkb_ibus_config_eet *wkb_ibus_config_eet_new(const char *path);
+struct wkb_ibus_config_eet *wkb_ibus_config_eet_new(const char *path, Eldbus_Service_Interface *iface);
void wkb_ibus_config_eet_free(struct wkb_ibus_config_eet *config_eet);
#endif /* _WKB_IBUS_CONFIG_EET_H_ */
diff --git a/src/wkb-ibus-config.c b/src/wkb-ibus-config.c
index ebaf82e..aadffb7 100644
--- a/src/wkb-ibus-config.c
+++ b/src/wkb-ibus-config.c
@@ -200,7 +200,7 @@ wkb_ibus_config_register(Eldbus_Connection *conn)
goto end;
}
- _conf_eet = wkb_ibus_config_eet_new("/home/edebarro/projects/wayland/weekeyboard/ibus-cfg.eet");
+ _conf_eet = wkb_ibus_config_eet_new("/home/edebarro/projects/wayland/weekeyboard/ibus-cfg.eet", ret);
if (!_conf_eet)
{