2004-07-14 07:15:50 -07:00
|
|
|
/* Demonstrates how to use listeners.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_Config.h>
|
|
|
|
|
2006-01-06 07:32:46 -08:00
|
|
|
#define INT_PROPERTY_KEY "/example/integer"
|
2004-07-14 07:15:50 -07:00
|
|
|
#define CALLBACK_NAME "change listener"
|
|
|
|
|
|
|
|
int change_listener (const char *key, const Ecore_Config_Type type,
|
|
|
|
const int tag, void *data) {
|
|
|
|
printf("Callback called when property '%s' is %li\n", key, ecore_config_int_get(key));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main (int argc, char *argv[]) {
|
|
|
|
/* We'll use the same config as config_basic_example.c */
|
|
|
|
ecore_config_init("config_basic_example");
|
|
|
|
ecore_config_int_default (INT_PROPERTY_KEY, -1);
|
|
|
|
ecore_config_listen(CALLBACK_NAME, INT_PROPERTY_KEY, change_listener, 1, NULL);
|
|
|
|
ecore_config_load();
|
|
|
|
ecore_config_int_set(INT_PROPERTY_KEY, ecore_config_int_get(INT_PROPERTY_KEY) + 1);
|
|
|
|
ecore_config_shutdown();
|
|
|
|
return 0;
|
|
|
|
}
|