Data Model Events
[Data Model API]

Events and their usage with models. More...

Typedefs

typedef void(* Eina_Model_Event_Cb )(void *data, Eina_Model *model, const Eina_Model_Event_Description *desc, void *event_info)
 Notifies of events in this model.

Functions

Eina_Bool eina_model_event_callback_add (Eina_Model *model, const char *event_name, Eina_Model_Event_Cb cb, const void *data)
 Add a callback to be called when event_name is emited.
Eina_Bool eina_model_event_callback_del (Eina_Model *model, const char *event_name, Eina_Model_Event_Cb cb, const void *data)
 Remove a callback that was to be called when event_name was emited.
const
Eina_Model_Event_Description
eina_model_event_description_get (const Eina_Model *model, const char *event_name)
 Returns a description of the event named event_name.
Eina_Listeina_model_event_names_list_get (const Eina_Model *model)
 Returns list of events this model may emit.
void eina_model_event_names_list_free (Eina_List *list)
 Frees the list of event's names gotten from eina_model_event_names_list_get().
Eina_Bool eina_model_event_callback_call (Eina_Model *model, const char *name, const void *event_info)
 Calls every callback associated to name on model model with event_info.
int eina_model_event_callback_freeze (Eina_Model *model, const char *name)
 Makes model not call the callbacks associated with name.
int eina_model_event_callback_thaw (Eina_Model *model, const char *name)
 Makes model able to call the callbacks associated with name.

Detailed Description

Events and their usage with models.

Events are specified by each type and interface level using Eina_Model_Event_Description. One can know all events supported by a model with eina_model_event_names_list_get() and then eina_model_event_description_get() to retrieve details.

By default the following events are supported in every object:

Mix-in interfaces may emit these:
  • properties,loaded
  • properties,unloaded
  • children,loaded
  • children,unloaded
One can be notified of events with eina_model_event_callback_add().

Types emit these events with eina_model_event_callback_call(), these are handled asynchronously unless event is frozen with eina_model_event_callback_freeze() is blocking it. In this case the events are ignored. Usually this is used in some cases that want to avoid storm of events in batch operations.


Typedef Documentation

Notifies of events in this model.

Since:
1.2


Function Documentation

Eina_Bool eina_model_event_callback_add ( Eina_Model model,
const char *  event_name,
Eina_Model_Event_Cb  cb,
const void *  data 
)

Add a callback to be called when event_name is emited.

Parameters:
model The model instance.
event_name The name of event for which cb will be called.
cb The function to be called.
data Data cb will be called with. May be NULL.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
See also:
eina_model_event_callback_del()
Since:
1.2

References EINA_FALSE, eina_inlist_append(), EINA_INLIST_GET, and EINA_TRUE.

Eina_Bool eina_model_event_callback_del ( Eina_Model model,
const char *  event_name,
Eina_Model_Event_Cb  cb,
const void *  data 
)

Remove a callback that was to be called when event_name was emited.

Parameters:
model The model instance.
event_name The name of event for which to delete callback.
cb The function given to eina_model_event_callback_add().
data Data given to eina_model_event_callback_add(). A NULL value means every data will not be compared.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
See also:
eina_model_event_callback_add()
Since:
1.2

References EINA_FALSE, EINA_INLIST_FOREACH, EINA_INLIST_GET, eina_inlist_remove(), eina_list_append(), and EINA_TRUE.

const Eina_Model_Event_Description* eina_model_event_description_get ( const Eina_Model model,
const char *  event_name 
)

Returns a description of the event named event_name.

Parameters:
model The model instance.
event_name Name of event whose description is wanted.
Returns:
Description of event.
See also:
Eina_Model_Event_Description
Since:
1.2

Eina_List* eina_model_event_names_list_get ( const Eina_Model model  ) 

Returns list of events this model may emit.

Parameters:
model The model whose events are to be listed.
Returns:
An Eina_List of stringshares with the name of every event. Free the list with eina_model_event_names_list_free().
Since:
1.2

References eina_list_append(), and eina_stringshare_add().

void eina_model_event_names_list_free ( Eina_List list  ) 

Frees the list of event's names gotten from eina_model_event_names_list_get().

Parameters:
list The list to free.
See also:
eina_model_event_names_list_get()
Since:
1.2

References EINA_LIST_FREE, and eina_stringshare_del().

Eina_Bool eina_model_event_callback_call ( Eina_Model model,
const char *  name,
const void *  event_info 
)

Calls every callback associated to name on model model with event_info.

Parameters:
model The model instance.
name The event whose callbacks will be called.
event_info The data given to the callback as event_info. May be NULL.
Returns:
EINA_TRUE on success, EINA_FALSE on failure.
See also:
eina_model_event_callback_add()

eina_model_event_callback_del()

Since:
1.2

References EINA_FALSE.

int eina_model_event_callback_freeze ( Eina_Model model,
const char *  name 
)

Makes model not call the callbacks associated with name.

Parameters:
model The model instance.
name The event whose callbacks are to be frozen.
Returns:
Count of freezes called on this event.
See also:
eina_model_event_callback_call()

eina_model_event_callback_thaw()

Since:
1.2

int eina_model_event_callback_thaw ( Eina_Model model,
const char *  name 
)

Makes model able to call the callbacks associated with name.

Parameters:
model The model instance.
name The event whose callbacks are to be frozen.
Returns:
Count of freezes still valid in this event.
Warning:
Behavior is undefined if called on a model, name not frozen.
See also:
eina_model_event_callback_call()

eina_model_event_callback_freeze()

Since:
1.2