summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2016-02-08 11:39:15 +0100
committerLukasz Stanislawski <l.stanislaws@samsung.com>2016-02-10 08:48:12 -0800
commit82ed46930e0bc67d456feb5303e710260e3b93be (patch)
tree89fc461e76bb290306870c5f36c6bca11c6a48a0 /inc
parent913019cbd7b12b3a9c6fb036d378ef8e387986a0 (diff)
downloadindicator-win-82ed46930e0bc67d456feb5303e710260e3b93be.tar.gz
indicator-win-82ed46930e0bc67d456feb5303e710260e3b93be.tar.bz2
indicator-win-82ed46930e0bc67d456feb5303e710260e3b93be.zip
util: add utiliy functions for system settings and runtime info
System settings and runtime info API allows to register only one global callback per key. In case when multiple indicator modules wants to listen on the same key changes API enforces some cross module dependencies. Adding utility function for handling multiple callbacks per key solves this issue, making module more independent of each other. Change-Id: Ie760ab7184a6a7f5ca402e6ef1db2350b57a2de2 Signed-off-by: Lukasz Stanislawski <l.stanislaws@samsung.com>
Diffstat (limited to 'inc')
-rw-r--r--inc/util.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/inc/util.h b/inc/util.h
index 27d79e9..2a8ced2 100644
--- a/inc/util.h
+++ b/inc/util.h
@@ -23,6 +23,8 @@
#define __INDICATOR_UTIL_H__
#include <Ecore.h>
#include <wifi.h>
+#include <system_settings.h>
+#include <runtime_info.h>
typedef enum {
INDICATOR_ERROR_NONE = 0,
@@ -128,4 +130,42 @@ int util_wifi_set_connection_state_changed_cb(wifi_connection_state_changed_cb,
*/
void util_wifi_unset_connection_state_changed_cb(wifi_connection_state_changed_cb);
+/**
+ * @brief Allows to register multiple callbacks using system_settings_changed_cb API.
+ *
+ * @param key key to monitor.
+ * @param cb callback.
+ * @param data user_data passed to callback function.
+ *
+ * @return 0 on success, other value on failure.
+ */
+int util_system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb cb, void *data);
+
+/**
+ * @brief Unregisters callback set with util_system_settings_set_changed_cb.
+ *
+ * @param key key to stop monitor.
+ * @param cb callback
+ */
+void util_system_settings_unset_changed_cb(system_settings_key_e key, system_settings_changed_cb cb);
+
+/**
+ * @brief Allows to register multiple callbacks using runtime_info_set_changed_cb API.
+ *
+ * @param key key to monitor.
+ * @param cb callback.
+ * @param data user data passed to callback function.
+ *
+ * @return 0 on success, other value on failure.
+ */
+int util_runtime_info_set_changed_cb(runtime_info_key_e key, runtime_info_changed_cb cb, void *data);
+
+/**
+ * @brief Unregisters callback set with util_runtime_info_set_changed_cb.
+ *
+ * @param key key to stop monitor.
+ * @param cb callback.
+ */
+void util_runtime_info_unset_changed_cb(runtime_info_key_e key, runtime_info_changed_cb cb);
+
#endif /* __INDICATOR_UTIL_H__ */