diff options
author | Guilherme Lepsch <lepsch@expertisesolutions.com.br> | 2015-03-18 11:24:33 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2015-07-22 01:57:35 -0300 |
commit | fe71900ad6194cfe7cf1f912a562baaeb09f8df9 (patch) | |
tree | 46c1168904e007a570d0eb9ea5977c8020a62972 | |
parent | 59b9f512364db1f1aa1346be14ace3d20c25ba1d (diff) | |
download | efl-devs/felipealmeida/eldbus-model.tar.gz |
Emodel API changesdevs/felipealmeida/eldbus-model
19 files changed, 199 insertions, 226 deletions
diff --git a/src/lib/efl/Efl_Model_Common.h b/src/lib/efl/Efl_Model_Common.h index 360e509e4e..4d4d79d08e 100644 --- a/src/lib/efl/Efl_Model_Common.h +++ b/src/lib/efl/Efl_Model_Common.h @@ -76,8 +76,11 @@ EAPI Eina_Value_Struct_Desc *efl_model_value_struct_desc_new(unsigned int member /** * @brief Frees the memory allocated to the struct description. - * + *.c * @param desc The struct description. If @c NULL, the function returns immediately. */ EAPI void efl_model_value_struct_desc_free(Eina_Value_Struct_Desc *desc); +EAPI void efl_model_property_changed_notify(Efl_Model_Base *model, const char *property); + +EAPI void efl_model_property_invalidated_notify(Efl_Model_Base *model, const char *property); diff --git a/src/lib/efl/interfaces/efl_model_common.c b/src/lib/efl/interfaces/efl_model_common.c index ec83e60639..0363509581 100644 --- a/src/lib/efl/interfaces/efl_model_common.c +++ b/src/lib/efl/interfaces/efl_model_common.c @@ -80,6 +80,38 @@ efl_model_error_notify(Efl_Model_Base *model) eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_LOAD_STATUS, &load)); } +EAPI void +efl_model_property_changed_notify(Efl_Model_Base *model, const char *property) +{ + Eina_Array *changed_properties = eina_array_new(1); + EINA_SAFETY_ON_NULL_RETURN(changed_properties); + + Eina_Bool ret = eina_array_push(changed_properties, property); + EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); + + Efl_Model_Property_Event evt = {.changed_properties = changed_properties}; + eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); + +on_error: + eina_array_free(changed_properties); +} + +EAPI void +efl_model_property_invalidated_notify(Efl_Model_Base *model, const char *property) +{ + Eina_Array *invalidated_properties = eina_array_new(1); + EINA_SAFETY_ON_NULL_RETURN(invalidated_properties); + + Eina_Bool ret = eina_array_push(invalidated_properties, property); + EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); + + Efl_Model_Property_Event evt = {.invalidated_properties = invalidated_properties}; + eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); + +on_error: + eina_array_free(invalidated_properties); +} + typedef struct _Efl_Model_Value_Struct_Desc { Eina_Value_Struct_Desc base; diff --git a/src/lib/eldbus/eldbus_model_arguments.c b/src/lib/eldbus/eldbus_model_arguments.c index dc622e66c9..3329b081bc 100644 --- a/src/lib/eldbus/eldbus_model_arguments.c +++ b/src/lib/eldbus/eldbus_model_arguments.c @@ -18,9 +18,14 @@ static void _eldbus_model_arguments_efl_model_base_children_load(Eo *, Eldbus_Mo static void _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *); static bool _eldbus_model_arguments_is_input_argument(Eldbus_Model_Arguments_Data *, const char *); static bool _eldbus_model_arguments_is_output_argument(Eldbus_Model_Arguments_Data *, const char *); -static bool _eldbus_model_arguments_property_set(Eldbus_Model_Arguments_Data *, Eina_Value *, const char *); +static Eina_Bool _eldbus_model_arguments_property_set(Eldbus_Model_Arguments_Data *, Eina_Value *, const char *); static unsigned int _eldbus_model_arguments_argument_index_get(Eldbus_Model_Arguments_Data *, const char *); -static void _eldbus_model_arguments_member_setup_cb(void *data, int index, Eina_Value_Struct_Member *member); + +static void +_eldbus_model_arguments_hash_free(Eina_Value *value) +{ + eina_value_free(value); +} static Eo_Base* _eldbus_model_arguments_eo_base_constructor(Eo *obj, Eldbus_Model_Arguments_Data *pd) @@ -31,8 +36,7 @@ _eldbus_model_arguments_eo_base_constructor(Eo *obj, Eldbus_Model_Arguments_Data pd->obj = obj; pd->load.status = EFL_MODEL_LOAD_STATUS_UNLOADED; pd->properties_array = NULL; - pd->properties_desc = NULL; - pd->properties = NULL; + pd->properties_hash = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_arguments_hash_free)); pd->pending_list = NULL; pd->proxy = NULL; pd->arguments = NULL; @@ -63,12 +67,7 @@ _eldbus_model_arguments_eo_base_destructor(Eo *obj, Eldbus_Model_Arguments_Data _eldbus_model_arguments_unload(pd); - eina_value_free(pd->properties); -<<<<<<< HEAD - efl_model_value_struct_desc_free(pd->properties_desc); -======= - emodel_value_struct_desc_free(pd->properties_desc); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. + eina_hash_free(pd->properties_hash); eina_stringshare_del(pd->name); eldbus_proxy_unref(pd->proxy); @@ -88,11 +87,7 @@ _eldbus_model_arguments_efl_model_base_properties_get(Eo *obj EINA_UNUSED, if (!(pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES)) { ERR("%s", "o not loaded."); -<<<<<<< HEAD return EFL_MODEL_LOAD_STATUS_ERROR; -======= - return EMODEL_LOAD_STATUS_ERROR; ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. } *(Eina_Array**)properties_array = pd->properties_array; @@ -119,26 +114,18 @@ _eldbus_model_arguments_efl_model_base_properties_load(Eo *obj, Eldbus_Model_Arg Eina_Bool ret = eina_array_push(pd->properties_array, name); EINA_SAFETY_ON_FALSE_RETURN(ret); - } -<<<<<<< HEAD - efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES); -======= - if (arguments_count > 0) - { - if (!pd->properties_desc) - { - pd->properties_desc = emodel_value_struct_desc_new( - arguments_count, - _eldbus_model_arguments_member_setup_cb, - pd); - } + Eldbus_Introspection_Argument *arg = eina_list_nth(pd->arguments, i); + const Eina_Value_Type *type = _dbus_type_to_eina_value_type(arg->type[0]); - pd->properties = eina_value_struct_new(pd->properties_desc); + Eina_Value *value = eina_value_new(type); + EINA_SAFETY_ON_NULL_RETURN(value); + + ret = eina_hash_add(pd->properties_hash, name, value); + EINA_SAFETY_ON_FALSE_RETURN(ret); } - emodel_load_set(pd->obj, &pd->load, EMODEL_LOAD_STATUS_LOADED_PROPERTIES); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. + efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES); } static Efl_Model_Load_Status @@ -148,6 +135,7 @@ _eldbus_model_arguments_efl_model_base_property_set(Eo *obj EINA_UNUSED, Eina_Value const* value) { EINA_SAFETY_ON_NULL_RETURN_VAL(property, EFL_MODEL_LOAD_STATUS_ERROR); + EINA_SAFETY_ON_NULL_RETURN_VAL(value, EFL_MODEL_LOAD_STATUS_ERROR); DBG("(%p): property=%s", obj, property); if (!(pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES)) @@ -159,14 +147,12 @@ _eldbus_model_arguments_efl_model_base_property_set(Eo *obj EINA_UNUSED, return EFL_MODEL_LOAD_STATUS_ERROR; } -<<<<<<< HEAD - // TODO: - //Eina_Bool ret = eina_value_struct_value_set(pd->properties, property, &value); - //EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EFL_MODEL_LOAD_STATUS_ERROR); -======= - Eina_Bool ret = eina_value_struct_value_set(pd->properties, property, &value); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EMODEL_LOAD_STATUS_ERROR); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. + Eina_Value *prop_value = eina_hash_find(pd->properties_hash, property); + EINA_SAFETY_ON_NULL_RETURN_VAL(prop_value, EFL_MODEL_LOAD_STATUS_ERROR); + + eina_value_flush(prop_value); + Eina_Bool ret = eina_value_copy(value, prop_value); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EFL_MODEL_LOAD_STATUS_ERROR); return pd->load.status; } @@ -187,22 +173,12 @@ _eldbus_model_arguments_efl_model_base_property_get(Eo *obj EINA_UNUSED, if (!_eldbus_model_arguments_is_output_argument(pd, property)) { WRN("Property (argument) not found or it is for input only: %s", property); -<<<<<<< HEAD return EFL_MODEL_LOAD_STATUS_ERROR; } - Eina_Bool ret = eina_value_struct_value_get(pd->properties, property, &pd->tmp_value); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EFL_MODEL_LOAD_STATUS_ERROR); -======= - return EMODEL_LOAD_STATUS_ERROR; - } - - Eina_Bool ret = eina_value_struct_value_get(pd->properties, property, value); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EMODEL_LOAD_STATUS_ERROR); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. + *value = eina_hash_find(pd->properties_hash, property); + EINA_SAFETY_ON_NULL_RETURN_VAL(*value, EFL_MODEL_LOAD_STATUS_ERROR); - *value = &pd->tmp_value; - return pd->load.status; } @@ -307,8 +283,7 @@ _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *pd) pd->properties_array = NULL; } - eina_value_free(pd->properties); - pd->properties = NULL; + eina_hash_free_buckets(pd->properties_hash); } bool @@ -335,7 +310,9 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd, return true; } - bool result = false, changed = false; + Eina_Array *changed_properties = eina_array_new(1); + + bool result = false; unsigned int i = 0; const Eina_List *it; const Eldbus_Introspection_Argument *argument; @@ -346,53 +323,47 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd, const Eina_Stringshare *property = eina_array_data_get(pd->properties_array, i); EINA_SAFETY_ON_NULL_GOTO(property, on_error); - bool ret = _eldbus_model_arguments_property_set(pd, value_struct, property); -<<<<<<< HEAD - EINA_SAFETY_ON_FALSE_GOTO(ret, cleanup); -======= + Eina_Bool ret = _eldbus_model_arguments_property_set(pd, value_struct, property); EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. - changed = true; + ret = eina_array_push(changed_properties, property); + EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); } ++i; } - if (changed) + if (eina_array_count(changed_properties)) { -<<<<<<< HEAD - Efl_Model_Property_Event evt = {.changed_properties = pd->properties}; + Efl_Model_Property_Event evt = {.changed_properties = changed_properties}; eo_do(pd->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); -======= - Emodel_Property_Event evt = {.changed_properties = pd->properties}; - eo_do(pd->obj, eo_event_callback_call(EMODEL_EVENT_PROPERTIES_CHANGED, &evt)); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. } result = true; -<<<<<<< HEAD -cleanup: -======= on_error: ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. + eina_array_free(changed_properties); eina_value_free(value_struct); return result; } -static bool +static Eina_Bool _eldbus_model_arguments_property_set(Eldbus_Model_Arguments_Data *pd, Eina_Value *value_struct, const char *property) { - Eina_Value value = {0}; + Eina_Value *prop_value = eina_hash_find(pd->properties_hash, property); + EINA_SAFETY_ON_NULL_RETURN_VAL(prop_value, EINA_FALSE); + Eina_Value value; Eina_Bool ret = eina_value_struct_value_get(value_struct, "arg0", &value); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, false); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EINA_FALSE); - ret = eina_value_struct_value_set(pd->properties, property, &value); + eina_value_flush(prop_value); + ret = eina_value_copy(&value, prop_value); eina_value_flush(&value); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EINA_FALSE); + return ret; } @@ -445,15 +416,4 @@ _eldbus_model_arguments_argument_index_get(Eldbus_Model_Arguments_Data *pd, cons return ++i; } -static void -_eldbus_model_arguments_member_setup_cb(void *data, int index, Eina_Value_Struct_Member *member) -{ - Eldbus_Model_Arguments_Data *pd = (Eldbus_Model_Arguments_Data*)data; - - member->name = eina_stringshare_ref(eina_array_data_get(pd->properties_array, index)); - - Eldbus_Introspection_Argument *arg = eina_list_nth(pd->arguments, index); - member->type = _dbus_type_to_eina_value_type(arg->type[0]); -} - #include "eldbus_model_arguments.eo.c" diff --git a/src/lib/eldbus/eldbus_model_arguments_private.h b/src/lib/eldbus/eldbus_model_arguments_private.h index 1181c1af43..fc93552a81 100644 --- a/src/lib/eldbus/eldbus_model_arguments_private.h +++ b/src/lib/eldbus/eldbus_model_arguments_private.h @@ -16,8 +16,7 @@ struct _Eldbus_Model_Arguments_Data Efl_Model_Load load; Eldbus_Proxy *proxy; Eina_Array *properties_array; - Eina_Value_Struct_Desc *properties_desc; - Eina_Value *properties; + Eina_Hash *properties_hash; Eina_Stringshare *name; Eina_List *pending_list; const Eina_List *arguments; diff --git a/src/lib/eldbus/eldbus_model_connection.c b/src/lib/eldbus/eldbus_model_connection.c index 427c0109b9..72173b695e 100644 --- a/src/lib/eldbus/eldbus_model_connection.c +++ b/src/lib/eldbus/eldbus_model_connection.c @@ -15,7 +15,7 @@ static void _eldbus_model_connection_efl_model_base_children_load(Eo *, Eldbus_M static void _eldbus_model_connection_names_list_cb(void *, const Eldbus_Message *, Eldbus_Pending *); static void _eldbus_model_connection_connect(Eldbus_Model_Connection_Data *); static void _eldbus_model_connection_disconnect(Eldbus_Model_Connection_Data *); -static void _eldbus_model_connection_unload(Eldbus_Model_Connection_Data *); +static void _eldbus_model_connection_clear(Eldbus_Model_Connection_Data *); static Eo_Base* _eldbus_model_connection_eo_base_constructor(Eo *obj, Eldbus_Model_Connection_Data *pd) @@ -58,7 +58,7 @@ _eldbus_model_connection_eo_base_destructor(Eo *obj, Eldbus_Model_Connection_Dat eina_stringshare_del(pd->address); - _eldbus_model_connection_unload(pd); + _eldbus_model_connection_clear(pd); eo_do_super(obj, MY_CLASS, eo_destructor()); } @@ -96,7 +96,13 @@ _eldbus_model_connection_efl_model_base_properties_load(Eo *obj, Eldbus_Model_Co if (!pd->connection) _eldbus_model_connection_connect(pd); - pd->unique_name = eina_stringshare_add(eldbus_connection_unique_name_get(pd->connection)); + pd->unique_name = eina_value_new(EINA_VALUE_TYPE_STRING); + EINA_SAFETY_ON_NULL_RETURN(pd->unique_name); + + const char *unique_name = eldbus_connection_unique_name_get(pd->connection); + Eina_Bool ret = eina_value_set(pd->unique_name, unique_name); + EINA_SAFETY_ON_FALSE_RETURN(ret); + efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES); } @@ -127,9 +133,7 @@ _eldbus_model_connection_efl_model_base_property_get(Eo *obj EINA_UNUSED, if (strcmp(property, UNIQUE_NAME_PROPERTY) != 0) return EFL_MODEL_LOAD_STATUS_ERROR; - eina_value_setup(value, EINA_VALUE_TYPE_STRING); - eina_value_set(value, pd->unique_name); - + *value = pd->unique_name; return pd->load.status; } @@ -157,7 +161,7 @@ _eldbus_model_connection_efl_model_base_unload(Eo *obj EINA_UNUSED, Eldbus_Model { DBG("(%p)", obj); - _eldbus_model_connection_unload(pd); + _eldbus_model_connection_clear(pd); efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_UNLOADED); } @@ -296,13 +300,13 @@ _eldbus_model_connection_disconnect(Eldbus_Model_Connection_Data *pd) } static void -_eldbus_model_connection_unload(Eldbus_Model_Connection_Data *pd) +_eldbus_model_connection_clear(Eldbus_Model_Connection_Data *pd) { EINA_SAFETY_ON_NULL_RETURN(pd); if (!pd->connection) return; - eina_stringshare_del(pd->unique_name); + eina_value_free(pd->unique_name); pd->unique_name = NULL; Eo *child; diff --git a/src/lib/eldbus/eldbus_model_connection_private.h b/src/lib/eldbus/eldbus_model_connection_private.h index 1eff30b76c..4123f92b07 100644 --- a/src/lib/eldbus/eldbus_model_connection_private.h +++ b/src/lib/eldbus/eldbus_model_connection_private.h @@ -20,7 +20,7 @@ struct _Eldbus_Model_Connection_Data Eldbus_Connection_Type type; Eina_Stringshare *address; bool private; - Eina_Stringshare *unique_name; + Eina_Value *unique_name; Eina_List *pending_list; }; diff --git a/src/lib/eldbus/eldbus_model_method.c b/src/lib/eldbus/eldbus_model_method.c index 5d9804ea67..0f4e88b7cf 100644 --- a/src/lib/eldbus/eldbus_model_method.c +++ b/src/lib/eldbus/eldbus_model_method.c @@ -62,17 +62,15 @@ _eldbus_model_method_call(Eo *obj EINA_UNUSED, Eldbus_Model_Method_Data *pd EINA const Eina_Stringshare *name = eina_array_data_get(data->properties_array, i); EINA_SAFETY_ON_NULL_GOTO(name, on_error); - Eina_Value value = {0}; - Eina_Bool ret = eina_value_struct_value_get(data->properties, name, &value); - EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); + const Eina_Value *value = eina_hash_find(data->properties_hash, name); + EINA_SAFETY_ON_NULL_GOTO(value, on_error); + Eina_Bool ret; const char *signature = argument->type; if (dbus_type_is_basic(signature[0])) - ret = _message_iter_from_eina_value(signature, iter, &value); + ret = _message_iter_from_eina_value(signature, iter, value); else - ret = _message_iter_from_eina_value_struct(signature, iter, &value); - - eina_value_flush(&value); + ret = _message_iter_from_eina_value_struct(signature, iter, value); EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); diff --git a/src/lib/eldbus/eldbus_model_object.c b/src/lib/eldbus/eldbus_model_object.c index 0cf462c380..a50c848391 100644 --- a/src/lib/eldbus/eldbus_model_object.c +++ b/src/lib/eldbus/eldbus_model_object.c @@ -18,7 +18,7 @@ static bool _eldbus_model_object_introspect(Eldbus_Model_Object_Data *, const ch static void _eldbus_model_object_introspect_cb(void *, const Eldbus_Message *, Eldbus_Pending *); static void _eldbus_model_object_connect(Eldbus_Model_Object_Data *); static void _eldbus_model_object_disconnect(Eldbus_Model_Object_Data *); -static void _eldbus_model_object_unload(Eldbus_Model_Object_Data *); +static void _eldbus_model_object_clear(Eldbus_Model_Object_Data *); static void _eldbus_model_object_introspect_nodes(Eldbus_Model_Object_Data *, const char *, Eina_List *); static char *_eldbus_model_object_concatenate_path(const char *, const char *); static void _eldbus_model_object_create_children(Eldbus_Model_Object_Data *, Eldbus_Object *, Eina_List *); @@ -93,7 +93,7 @@ _eldbus_model_object_eo_base_destructor(Eo *obj, Eldbus_Model_Object_Data *pd) eina_stringshare_del(pd->bus); eina_stringshare_del(pd->path); - _eldbus_model_object_unload(pd); + _eldbus_model_object_clear(pd); eo_do_super(obj, MY_CLASS, eo_destructor()); } @@ -131,7 +131,13 @@ _eldbus_model_object_efl_model_base_properties_load(Eo *obj, Eldbus_Model_Object if (!pd->connection) _eldbus_model_object_connect(pd); - pd->unique_name = eina_stringshare_add(eldbus_connection_unique_name_get(pd->connection)); + pd->unique_name = eina_value_new(EINA_VALUE_TYPE_STRING); + EINA_SAFETY_ON_NULL_RETURN(pd->unique_name); + + const char *unique_name = eldbus_connection_unique_name_get(pd->connection); + Eina_Bool ret = eina_value_set(pd->unique_name, unique_name); + EINA_SAFETY_ON_FALSE_RETURN(ret); + efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES); } @@ -162,9 +168,7 @@ _eldbus_model_object_efl_model_base_property_get(Eo *obj EINA_UNUSED, if (strcmp(property, UNIQUE_NAME_PROPERTY) != 0) return EFL_MODEL_LOAD_STATUS_ERROR; - eina_value_setup(value, EINA_VALUE_TYPE_STRING); - eina_value_set(value, pd->unique_name); - + *value = pd->unique_name; return pd->load.status; } @@ -192,7 +196,7 @@ _eldbus_model_object_efl_model_base_unload(Eo *obj EINA_UNUSED, Eldbus_Model_Obj { DBG("(%p)", obj); - _eldbus_model_object_unload(pd); + _eldbus_model_object_clear(pd); efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_UNLOADED); } @@ -363,13 +367,13 @@ _eldbus_model_object_disconnect(Eldbus_Model_Object_Data *pd) } static void -_eldbus_model_object_unload(Eldbus_Model_Object_Data *pd) +_eldbus_model_object_clear(Eldbus_Model_Object_Data *pd) { EINA_SAFETY_ON_NULL_RETURN(pd); if (!pd->connection) return; - eina_stringshare_del(pd->unique_name); + eina_value_free(pd->unique_name); pd->unique_name = NULL; Eo *child; diff --git a/src/lib/eldbus/eldbus_model_object_private.h b/src/lib/eldbus/eldbus_model_object_private.h index dd5747c35a..745492143e 100644 --- a/src/lib/eldbus/eldbus_model_object_private.h +++ b/src/lib/eldbus/eldbus_model_object_private.h @@ -23,7 +23,7 @@ struct _Eldbus_Model_Object_Data bool private; Eina_Stringshare *bus; Eina_Stringshare *path; - Eina_Stringshare *unique_name; + Eina_Value *unique_name; Eina_List *pending_list; Eldbus_Introspection_Node *introspection; }; diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c index bad39d1042..400a68eae5 100644 --- a/src/lib/eldbus/eldbus_model_proxy.c +++ b/src/lib/eldbus/eldbus_model_proxy.c @@ -25,7 +25,6 @@ static bool _eldbus_model_proxy_is_property_readable(Eldbus_Model_Proxy_Data *, static const char *_eldbus_model_proxy_property_type_get(Eldbus_Model_Proxy_Data *, const char *); static void _eldbus_model_proxy_create_methods_children(Eldbus_Model_Proxy_Data *); static void _eldbus_model_proxy_create_signals_children(Eldbus_Model_Proxy_Data *); -static void _eldbus_model_proxy_member_setup_cb(void *data, int index, Eina_Value_Struct_Member *member); typedef struct _Eldbus_Model_Proxy_Property_Set_Data Eldbus_Model_Proxy_Property_Set_Data; @@ -36,9 +35,15 @@ struct _Eldbus_Model_Proxy_Property_Set_Data Eina_Value value; }; -static Eldbus_Model_Proxy_Property_Set_Data * _eldbus_model_proxy_property_set_data_new(Eldbus_Model_Proxy_Data *, const char *, Eina_Value *); +static Eldbus_Model_Proxy_Property_Set_Data * _eldbus_model_proxy_property_set_data_new(Eldbus_Model_Proxy_Data *, const char *, const Eina_Value *); static void _eldbus_model_proxy_property_set_data_free(Eldbus_Model_Proxy_Property_Set_Data *); +static void +_eldbus_model_proxy_hash_free(Eina_Value *value) +{ + eina_value_free(value); +} + static Eo_Base* _eldbus_model_proxy_eo_base_constructor(Eo *obj, Eldbus_Model_Proxy_Data *pd) { @@ -51,8 +56,7 @@ _eldbus_model_proxy_eo_base_constructor(Eo *obj, Eldbus_Model_Proxy_Data *pd) pd->object = NULL; pd->proxy = NULL; pd->properties_array = NULL; - pd->properties_desc = NULL; - pd->properties = NULL; + pd->properties_hash = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_proxy_hash_free)); pd->children_list = NULL; pd->name = NULL; pd->pending_list = NULL; @@ -83,8 +87,7 @@ _eldbus_model_proxy_eo_base_destructor(Eo *obj, Eldbus_Model_Proxy_Data *pd) _eldbus_model_proxy_unload(pd); - eina_value_free(pd->properties); - efl_model_value_struct_desc_free(pd->properties_desc); + eina_hash_free(pd->properties_hash); eina_stringshare_del(pd->name); eldbus_object_unref(pd->object); @@ -104,7 +107,7 @@ _eldbus_model_proxy_efl_model_base_properties_get(Eo *obj EINA_UNUSED, if (!(pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES)) { WRN("%s", "Properties not loaded."); - return EMODEL_LOAD_STATUS_ERROR; + return EFL_MODEL_LOAD_STATUS_ERROR; } *(Eina_Array**)properties_array = pd->properties_array; @@ -168,7 +171,7 @@ _eldbus_model_proxy_efl_model_base_property_set(Eo *obj EINA_UNUSED, } Eldbus_Model_Proxy_Property_Set_Data *data = - _eldbus_model_proxy_property_set_data_new(pd, property, (Eina_Value*)value); + _eldbus_model_proxy_property_set_data_new(pd, property, value); EINA_SAFETY_ON_NULL_RETURN_VAL(data, EFL_MODEL_LOAD_STATUS_ERROR); const char *signature = _eldbus_model_proxy_property_type_get(pd, property); @@ -202,10 +205,8 @@ _eldbus_model_proxy_efl_model_base_property_get(Eo *obj EINA_UNUSED, WRN("\n"); - Eina_Bool ret = eina_value_struct_value_get(pd->properties, property, &pd->tmp_value); - EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, EFL_MODEL_LOAD_STATUS_ERROR); - - WRN("\n"); + *value = eina_hash_find(pd->properties_hash, property); + EINA_SAFETY_ON_NULL_RETURN_VAL(*value, EFL_MODEL_LOAD_STATUS_ERROR); *value = &pd->tmp_value; @@ -296,7 +297,7 @@ _eldbus_model_proxy_efl_model_base_children_count_get(Eo *obj EINA_UNUSED, } static void -_eldbus_model_proxy_efl_model_base_children_load(Eo *obj, Eldbus_Model_Proxy_Data *pd) +_eldbus_model_proxy_efl_model_base_children_load(Eo *obj EINA_UNUSED, Eldbus_Model_Proxy_Data *pd) { WRN("\n"); @@ -442,8 +443,7 @@ _eldbus_model_proxy_unload(Eldbus_Model_Proxy_Data *pd) pd->properties_array = NULL; } - eina_value_free(pd->properties); - pd->properties = NULL; + eina_hash_free_buckets(pd->properties_hash); _eldbus_model_proxy_stop_monitor(pd); @@ -500,11 +500,13 @@ _eldbus_model_proxy_property_changed_cb(void *data, Eldbus_Object_Event_Property_Changed *event = (Eldbus_Object_Event_Property_Changed*)event_info; - Eina_Bool ret = eina_value_struct_value_set(pd->properties, event->name, event->value); + Eina_Value *prop_value = eina_hash_find(pd->properties_hash, event->name); + EINA_SAFETY_ON_NULL_RETURN(prop_value); + + Eina_Bool ret = eina_value_copy(event->value, prop_value); EINA_SAFETY_ON_FALSE_RETURN(ret); - Efl_Model_Property_Event evt = {.changed_properties = pd->properties_array}; - eo_do(pd->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); + efl_model_property_changed_notify(pd->obj, event->name); } static void @@ -519,11 +521,7 @@ _eldbus_model_proxy_property_invalidated_cb(void *data, // TODO: eldbus_proxy_property_get(event->name) ? -<<<<<<< HEAD Efl_Model_Property_Event evt = {0}; -======= - Emodel_Property_Event evt = {0}; ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. evt.invalidated_properties = eina_array_new(1); EINA_SAFETY_ON_NULL_RETURN(evt.invalidated_properties); @@ -532,6 +530,7 @@ _eldbus_model_proxy_property_invalidated_cb(void *data, on_error: eina_array_free(evt.invalidated_properties); + efl_model_property_invalidated_notify(pd->obj, event->name); } static void @@ -559,24 +558,19 @@ _eldbus_model_proxy_property_get_all_cb(void *data, return; } - if (!pd->properties_desc) + Eina_List *it; + Eldbus_Introspection_Property *prop; + EINA_LIST_FOREACH(pd->interface->properties, it, prop) { -<<<<<<< HEAD - pd->properties_desc = efl_model_value_struct_desc_new( -======= - pd->properties_desc = emodel_value_struct_desc_new( ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. - eina_list_count(pd->interface->properties), - _eldbus_model_proxy_member_setup_cb, - pd); + const Eina_Value_Type *type = _dbus_type_to_eina_value_type(prop->type[0]); + Eina_Value *value = eina_value_new(type); + EINA_SAFETY_ON_NULL_RETURN(value); + + Eina_Bool ret = eina_hash_add(pd->properties_hash, prop->name, value); + EINA_SAFETY_ON_FALSE_RETURN(ret); } -<<<<<<< HEAD - EINA_SAFETY_ON_TRUE_RETURN(pd->properties); -======= ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. - pd->properties = eina_value_struct_new(pd->properties_desc); - bool changed = false; + Eina_Array *changed_properties = eina_array_new(1); Eldbus_Message_Iter *entry; while (eldbus_message_iter_get_and_next(values, 'e', &entry)) { @@ -588,42 +582,39 @@ _eldbus_model_proxy_property_get_all_cb(void *data, WRN("(%p): Adding property value: %s", pd->obj, property); Eina_Value *struct_value = eldbus_message_iter_struct_like_to_eina_value(variant); - EINA_SAFETY_ON_NULL_RETURN(struct_value); + EINA_SAFETY_ON_NULL_GOTO(struct_value, on_error); Eina_Value arg0; Eina_Bool ret = eina_value_struct_value_get(struct_value, "arg0", &arg0); eina_value_free(struct_value); - EINA_SAFETY_ON_FALSE_RETURN(ret); + EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); -<<<<<<< HEAD fprintf(stderr, "arg0: %s\n", eina_value_to_string(&arg0)); -======= ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. - ret = eina_value_struct_value_set(pd->properties, property, &arg0); + Eina_Value *prop_value = eina_hash_find(pd->properties_hash, property); + EINA_SAFETY_ON_NULL_GOTO(prop_value, on_error); + + ret = eina_value_copy(&arg0, prop_value); + EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); + eina_value_flush(&arg0); - EINA_SAFETY_ON_FALSE_RETURN(ret); - changed = true; + ret = eina_array_push(changed_properties, property); + EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); } _eldbus_model_proxy_start_monitor(pd); - if (changed) + if (eina_array_count(changed_properties)) { -<<<<<<< HEAD - Efl_Model_Property_Event evt = {.changed_properties = pd->properties_array}; + Efl_Model_Property_Event evt = {.changed_properties = changed_properties}; eo_do(pd->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); } efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES); -======= - Emodel_Property_Event evt = {.changed_properties = pd->properties}; - eo_do(pd->obj, eo_event_callback_call(EMODEL_EVENT_PROPERTIES_CHANGED, &evt)); - } - emodel_load_set(pd->obj, &pd->load, EMODEL_LOAD_STATUS_LOADED_PROPERTIES); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. +on_error: + eina_array_free(changed_properties); } @@ -642,26 +633,20 @@ _eldbus_model_proxy_property_set_cb(void *data, if (eldbus_message_error_get(msg, &error_name, &error_text)) { ERR("%s: %s", error_name, error_text); -<<<<<<< HEAD efl_model_error_notify(pd->obj); -======= - emodel_error_notify(pd->obj); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. goto on_error; } - Eina_Bool ret = eina_value_struct_value_set(pd->properties, - property_set_data->property, - &property_set_data->value); + Eina_Value *prop_value = eina_hash_find(pd->properties_hash, + property_set_data->property); + EINA_SAFETY_ON_NULL_GOTO(prop_value, on_error); + + Eina_Bool ret = eina_value_copy(&property_set_data->value, prop_value); EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); -<<<<<<< HEAD Efl_Model_Property_Event evt = {.changed_properties = pd->properties_array}; eo_do(pd->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt)); -======= - Emodel_Property_Event evt = {.changed_properties = pd->properties}; - eo_do(pd->obj, eo_event_callback_call(EMODEL_EVENT_PROPERTIES_CHANGED, &evt)); ->>>>>>> 0bf80ad... Emodel API changes: Emodel_Property_Event::changed_properties as Eina_Value now. + efl_model_property_changed_notify(pd->obj, property_set_data->property); on_error: _eldbus_model_proxy_property_set_data_free(property_set_data); @@ -715,7 +700,7 @@ _eldbus_model_proxy_property_type_get(Eldbus_Model_Proxy_Data *pd, const char *p static Eldbus_Model_Proxy_Property_Set_Data * _eldbus_model_proxy_property_set_data_new(Eldbus_Model_Proxy_Data *pd, const char *property, - Eina_Value *value) + const Eina_Value *value) { Eldbus_Model_Proxy_Property_Set_Data *data = calloc(1, sizeof(Eldbus_Model_Proxy_Property_Set_Data)); EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL); @@ -742,15 +727,4 @@ _eldbus_model_proxy_property_set_data_free(Eldbus_Model_Proxy_Property_Set_Data free(data); } -static void -_eldbus_model_proxy_member_setup_cb(void *data, int index, Eina_Value_Struct_Member *member) -{ - Eldbus_Model_Proxy_Data *pd = (Eldbus_Model_Proxy_Data*)data; - - member->name = eina_stringshare_ref(eina_array_data_get(pd->properties_array, index)); - - Eldbus_Introspection_Property *property = eina_list_nth(pd->interface->properties, index); - member->type = _dbus_type_to_eina_value_type(property->type[0]); -} - #include "eldbus_model_proxy.eo.c" diff --git a/src/lib/eldbus/eldbus_model_proxy_private.h b/src/lib/eldbus/eldbus_model_proxy_private.h index 2a7a5edd1d..02153fc2b9 100644 --- a/src/lib/eldbus/eldbus_model_proxy_private.h +++ b/src/lib/eldbus/eldbus_model_proxy_private.h @@ -17,8 +17,7 @@ struct _Eldbus_Model_Proxy_Data Eldbus_Object *object; Eldbus_Proxy *proxy; Eina_Array *properties_array; - Eina_Value_Struct_Desc *properties_desc; - Eina_Value *properties; + Eina_Hash *properties_hash; Eina_List *children_list; Eina_Stringshare *name; Eina_List *pending_list; diff --git a/src/tests/eldbus/eldbus_suite.c b/src/tests/eldbus/eldbus_suite.c index 3aca778394..8b6a181e1e 100644 --- a/src/tests/eldbus/eldbus_suite.c +++ b/src/tests/eldbus/eldbus_suite.c @@ -18,11 +18,11 @@ struct _Eldbus_Test_Case }; static const Eldbus_Test_Case etc[] = { - //{ "eldbus_init", eldbus_test_eldbus_init }, - /* { "eldbus_model", eldbus_test_eldbus_model }, */ - /* { "eldbus_model_connection", eldbus_test_eldbus_model_connection }, */ - /* { "eldbus_model_object", eldbus_test_eldbus_model_object }, */ - /* { "eldbus_model_proxy", eldbus_test_eldbus_model_proxy }, */ + { "eldbus_init", eldbus_test_eldbus_init }, + { "eldbus_model", eldbus_test_eldbus_model }, + { "eldbus_model_connection", eldbus_test_eldbus_model_connection }, + { "eldbus_model_object", eldbus_test_eldbus_model_object }, + { "eldbus_model_proxy", eldbus_test_eldbus_model_proxy }, { "eldbus_test_fake_server_eldbus_model_proxy", eldbus_test_fake_server_eldbus_model_proxy }, { "eldbus_model_method", eldbus_test_eldbus_model_method }, { "eldbus_model_signal", eldbus_test_eldbus_model_signal }, diff --git a/src/tests/eldbus/eldbus_test_eldbus_model.c b/src/tests/eldbus/eldbus_test_eldbus_model.c index 94bcda5248..0bf861c02f 100644 --- a/src/tests/eldbus/eldbus_test_eldbus_model.c +++ b/src/tests/eldbus/eldbus_test_eldbus_model.c @@ -113,6 +113,7 @@ check_property(Eo *object, const char *property_name, const char *expected_value Efl_Model_Load_Status status; eo_do(object, status = efl_model_property_get(property_name, &property_value)); ck_assert_msg(EFL_MODEL_LOAD_STATUS_ERROR != status, "Nonexistent property: %s", property_name); + ck_assert_ptr_ne(NULL, property_value); char *actual_value = eina_value_to_string(property_value); if (!actual_value) ck_assert_ptr_eq(expected_value, actual_value); @@ -327,8 +328,8 @@ eldbus_model_proxy_from_object_get(Eldbus_Model_Object *object, const char *inte unsigned int i; EINA_ACCESSOR_FOREACH(accessor, i, proxy) { - const char *name; - eo_do(proxy, name = eldbus_model_proxy_name_get()); + const char *name; + eo_do(proxy, name = eldbus_model_proxy_name_get()); ck_assert_ptr_ne(NULL, name); if (strcmp(name, interface_name) == 0) goto end; @@ -357,7 +358,7 @@ _eldbus_model_arguments_from_proxy_get(Eldbus_Model_Proxy *proxy, const char *me continue; const char *name; - eo_do(child, name = eldbus_model_arguments_name_get/*eldbus_model_arguments_name_get*/()); + eo_do(child, name = eldbus_model_arguments_name_get()); ck_assert_ptr_ne(NULL, name); if (strcmp(name, method_name) == 0) goto end; @@ -388,6 +389,7 @@ check_efl_model_property_int_eq(Efl_Model_Base *efl_model, const char *property, Efl_Model_Load_Status status; eo_do(efl_model, status = efl_model_property_get(property, &property_value)); ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status); + ck_assert_ptr_ne(NULL, property_value); fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_connection.c b/src/tests/eldbus/eldbus_test_eldbus_model_connection.c index 94a135af4c..4dc9f3decd 100644 --- a/src/tests/eldbus/eldbus_test_eldbus_model_connection.c +++ b/src/tests/eldbus/eldbus_test_eldbus_model_connection.c @@ -39,7 +39,7 @@ START_TEST(load_status_get) } END_TEST -START_TEST(properties_list_get) +START_TEST(properties_get) { Eina_Array *properties = NULL; Efl_Model_Load_Status status; @@ -67,6 +67,7 @@ START_TEST(property_get) Efl_Model_Load_Status status; eo_do(connection, status = efl_model_property_get(UNIQUE_NAME_PROPERTY, &property_value)); ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status); + ck_assert_ptr_ne(NULL, property_value); // Nonexistent property must return EFL_MODEL_LOAD_STATUS_ERROR eo_do(connection, status = efl_model_property_get("nonexistent", &property_value)); @@ -187,7 +188,7 @@ void eldbus_test_eldbus_model_connection(TCase *tc) { tcase_add_checked_fixture(tc, _setup, _teardown); tcase_add_test(tc, load_status_get); - tcase_add_test(tc, properties_list_get); + tcase_add_test(tc, properties_get); tcase_add_test(tc, property_get); tcase_add_test(tc, property_set); tcase_add_test(tc, children_count); diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_method.c b/src/tests/eldbus/eldbus_test_eldbus_model_method.c index 7c2f6176ff..6c9dc5b008 100644 --- a/src/tests/eldbus/eldbus_test_eldbus_model_method.c +++ b/src/tests/eldbus/eldbus_test_eldbus_model_method.c @@ -66,7 +66,7 @@ START_TEST(load_status_get) } END_TEST -START_TEST(properties_list_get) +START_TEST(properties_get) { Eina_Array *properties = NULL; Efl_Model_Load_Status status; @@ -206,7 +206,7 @@ void eldbus_test_eldbus_model_method(TCase *tc) { tcase_add_checked_fixture(tc, _setup, _teardown); tcase_add_test(tc, load_status_get); - tcase_add_test(tc, properties_list_get); + tcase_add_test(tc, properties_get); tcase_add_test(tc, property_get); tcase_add_test(tc, property_set); tcase_add_test(tc, children_count); diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_object.c b/src/tests/eldbus/eldbus_test_eldbus_model_object.c index b1acb177cb..bc0340969f 100644 --- a/src/tests/eldbus/eldbus_test_eldbus_model_object.c +++ b/src/tests/eldbus/eldbus_test_eldbus_model_object.c @@ -39,7 +39,7 @@ START_TEST(load_status_get) } END_TEST -START_TEST(properties_list_get) +START_TEST(properties_get) { Eina_Array *properties = NULL; Efl_Model_Load_Status status; @@ -188,7 +188,7 @@ void eldbus_test_eldbus_model_object(TCase *tc) { tcase_add_checked_fixture(tc, _setup, _teardown); tcase_add_test(tc, load_status_get); - tcase_add_test(tc, properties_list_get); + tcase_add_test(tc, properties_get); tcase_add_test(tc, property_get); tcase_add_test(tc, property_set); tcase_add_test(tc, children_count); diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c b/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c index 01bf1d8d5b..fea1642a49 100644 --- a/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c +++ b/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c @@ -46,7 +46,7 @@ START_TEST(load_status_get) } END_TEST -START_TEST(properties_list_get) +START_TEST(properties_get) { // ELDBUS_FDO_INTERFACE have no properties Eina_Array *properties = NULL; @@ -171,7 +171,7 @@ void eldbus_test_eldbus_model_proxy(TCase *tc) { tcase_add_checked_fixture(tc, _setup, _teardown); tcase_add_test(tc, load_status_get); - tcase_add_test(tc, properties_list_get); + tcase_add_test(tc, properties_get); tcase_add_test(tc, property_get); tcase_add_test(tc, property_set); tcase_add_test(tc, children_count); diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_signal.c b/src/tests/eldbus/eldbus_test_eldbus_model_signal.c index 073efa2aa3..1a7e907905 100644 --- a/src/tests/eldbus/eldbus_test_eldbus_model_signal.c +++ b/src/tests/eldbus/eldbus_test_eldbus_model_signal.c @@ -64,7 +64,7 @@ START_TEST(load_status_get) } END_TEST -START_TEST(properties_list_get) +START_TEST(properties_get) { Eina_Array *properties = NULL; Efl_Model_Load_Status status; @@ -81,10 +81,11 @@ END_TEST START_TEST(property_get) { // Signal properties always have output direction - Eina_Value dummy = {0}; + Eina_Value const* dummy; Efl_Model_Load_Status status; eo_do(pong_signal, status = efl_model_property_get(ARGUMENT_A, &dummy)); ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status); + ck_assert_ptr_ne(NULL, dummy); // Nonexistent property must return EFL_MODEL_LOAD_STATUS_ERROR eo_do(pong_signal, status = efl_model_property_get("nonexistent", &dummy)); @@ -205,7 +206,7 @@ void eldbus_test_eldbus_model_signal(TCase *tc) { tcase_add_checked_fixture(tc, _setup, _teardown); tcase_add_test(tc, load_status_get); - tcase_add_test(tc, properties_list_get); + tcase_add_test(tc, properties_get); tcase_add_test(tc, property_get); tcase_add_test(tc, property_set); tcase_add_test(tc, children_count); diff --git a/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c b/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c index a7d77d6a21..725ee4dbd6 100644 --- a/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c +++ b/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c @@ -80,14 +80,14 @@ END_TEST START_TEST(property_get) { - /* check_efl_model_property_int_eq(fake_server_proxy, FAKE_SERVER_READONLY_PROPERTY, FAKE_SERVER_READONLY_PROPERTY_VALUE); */ + check_efl_model_property_int_eq(fake_server_proxy, FAKE_SERVER_READONLY_PROPERTY, FAKE_SERVER_READONLY_PROPERTY_VALUE); check_efl_model_property_int_eq(fake_server_proxy, FAKE_SERVER_READWRITE_PROPERTY, FAKE_SERVER_READWRITE_PROPERTY_VALUE); /* // Write-only property returns error */ - /* Eina_Value const* dummy; */ + /* const Eina_Value *dummy; */ /* Efl_Model_Load_Status status; */ - /* eo_do(fake_server_proxy, status = efl_model_property_get(FAKE_SERVER_WRITEONLY_PROPERTY, &dummy)); */ - /* ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_ERROR, status); */ + /* /\* eo_do(fake_server_proxy, status = efl_model_property_get(FAKE_SERVER_WRITEONLY_PROPERTY, &dummy)); *\/ */ + /* /\* ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_ERROR, status); *\/ */ } END_TEST @@ -139,12 +139,9 @@ START_TEST(children_slice_get) Eldbus_Model_Arguments *method2 = efl_model_nth_child_get(fake_server_proxy, 2); Eldbus_Model_Arguments *signal1 = efl_model_nth_child_get(fake_server_proxy, 3); - const char *actual_method1_name; - eo_do(method1, actual_method1_name = eldbus_model_arguments_name_get()); - const char *actual_method2_name; - eo_do(method2, actual_method2_name = eldbus_model_arguments_name_get()); - const char *actual_signal1_name; - eo_do(signal1, actual_signal1_name = eldbus_model_arguments_name_get()); + const char *actual_method1_name = eo_do_ret(method1, actual_method1_name, eldbus_model_arguments_name_get()); + const char *actual_method2_name = eo_do_ret(method2, actual_method2_name, eldbus_model_arguments_name_get()); + const char *actual_signal1_name = eo_do_ret(signal1, actual_signal1_name, eldbus_model_arguments_name_get()); ck_assert_ptr_ne(NULL, actual_method1_name); ck_assert_ptr_ne(NULL, actual_method2_name); @@ -202,8 +199,7 @@ END_TEST START_TEST(child_add) { - Eo *child; - eo_do(fake_server_proxy, child = efl_model_child_add()); + Eo *child = eo_do_ret(fake_server_proxy, child, efl_model_child_add()); ck_assert_ptr_eq(NULL, child); } END_TEST |