#include <Elementary.h>
static void
_item_changed_cb(void *cb_data,
void *event_info)
{
printf(
"item %s had its value changed to %s\n", evt->
key, str);
free(str);
printf("elm_prefs_data_event_callback_del(): %s\n", ok ? "ok" : "fail");
}
int
elm_main(int argc, char **argv)
{
int version;
char *str;
printf("elm_prefs_data_new(): %s\n", prefs_data ? "ok" : "fail");
printf("elm_prefs_data_autosave_get() returns: %s\n", ok ? "yes" : "no");
printf("elm_prefs_data_value_set(): %s\n", ok ? "ok" : "fail");
printf("value for \'position\' is now %s\n", str);
free(str);
printf("elm_prefs_data_version_get() returns %d\n",
printf("elm_prefs_data_value_get(): %s\n", ok ? "ok" : "fail");
printf("value for \'position\' is %s\n", str);
free(str);
printf("elm_prefs_data_event_callback_add(): %s\n", ok ? "ok" : "fail");
printf("elm_prefs_data_value_set(): %s\n", ok ? "ok" : "fail");
printf("value for \'position\' is now %s\n", str);
free(str);
printf("elm_prefs_data_save(): %s\n", ok ? "ok" : "fail");
printf("elm_prefs_data_version_get() returns %d\n",
return 0;
}
@ EET_FILE_MODE_READ_WRITE
File is for both read and write.
Definition: Eet.h:481
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
EINA_API const Eina_Value_Type * EINA_VALUE_TYPE_INT
manages int type.
Definition: eina_value.c:5602
EINA_API char * eina_value_to_string(const Eina_Value *value)
Converts value to string.
Definition: eina_value.c:5719
static Eina_Bool eina_value_set(Eina_Value *value,...)
Sets the generic value.
static Eina_Bool eina_value_setup(Eina_Value *value, const Eina_Value_Type *type)
Initializes generic value storage.
#define ELM_MAIN()
macro to be used after the elm_main() function
Definition: elm_general.h:556
Elm_Prefs_Data * elm_prefs_data_ref(Elm_Prefs_Data *prefs_data)
Increment reference count on a given prefs data handle.
Definition: elm_prefs_data.c:613
Eina_Bool elm_prefs_data_event_callback_add(Elm_Prefs_Data *prefs_data, Elm_Prefs_Data_Event_Type type, Elm_Prefs_Data_Event_Cb cb, const void *cb_data)
Register a callback for one of the prefs data events.
Definition: elm_prefs_data.c:795
Eina_Bool elm_prefs_data_value_get(const Elm_Prefs_Data *prefs_data, const char *path, Elm_Prefs_Item_Type *type, Eina_Value *value)
Get one value of a given prefs data handle (by key).
Definition: elm_prefs_data.c:748
Elm_Prefs_Data * elm_prefs_data_new(const char *data_file, const char *key, Eet_File_Mode mode)
Create a new prefs data handle.
Definition: elm_prefs_data.c:329
void elm_prefs_data_unref(Elm_Prefs_Data *prefs_data)
Decrement reference count on a given prefs data handle.
Definition: elm_prefs_data.c:649
struct _Elm_Prefs_Data Elm_Prefs_Data
An Elm Prefs Data handle.
Definition: elm_prefs_data.h:89
Eina_Bool elm_prefs_data_save(const Elm_Prefs_Data *prefs_data, const char *file, const char *key)
Save, manually, a given elm prefs data handle data back, on the given file and key.
Definition: elm_prefs_data.c:894
void elm_prefs_data_autosave_set(Elm_Prefs_Data *prefs_data, Eina_Bool autosave)
Set whether a given elm prefs data handle should save its values back automatically on changes.
Definition: elm_prefs_data.c:860
Eina_Bool elm_prefs_data_autosave_get(const Elm_Prefs_Data *prefs_data)
Get whether a given elm prefs data handle is saving its values back automatically on changes.
Definition: elm_prefs_data.c:887
Eina_Bool elm_prefs_data_value_set(Elm_Prefs_Data *prefs_data, const char *path, const Elm_Prefs_Item_Type type, const Eina_Value *value)
Set (or delete) one value of a given prefs data handle.
Definition: elm_prefs_data.c:660
Eina_Bool elm_prefs_data_version_set(Elm_Prefs_Data *prefs_data, unsigned int version)
Set the version field of a given prefs data handle.
Definition: elm_prefs_data.c:600
unsigned int elm_prefs_data_version_get(const Elm_Prefs_Data *prefs_data)
Get the version field of a given prefs data handle.
Definition: elm_prefs_data.c:391
Elm_Prefs_Data_Event_Type
Types of events a given prefs data handle may issue.
Definition: elm_prefs_data.h:76
Eina_Bool elm_prefs_data_event_callback_del(Elm_Prefs_Data *prefs_data, Elm_Prefs_Data_Event_Type type, Elm_Prefs_Data_Event_Cb cb, const void *cb_data)
Unregister a callback for one of the prefs data events.
Definition: elm_prefs_data.c:822
@ ELM_PREFS_DATA_EVENT_ITEM_CHANGED
The group of values has been automatically saved (event info is the group's name (key))
Definition: elm_prefs_data.h:78
defines the contents of a value
Definition: eina_value.h:662
Definition: elm_prefs_data.h:105
const Eina_Value * value
key of the data value which changed
Definition: elm_prefs_data.h:107