From da6f25bee077c4caae44115ef98ee074015cb372 Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Thu, 17 Oct 2019 11:11:00 -0300 Subject: [PATCH] csharp: Add Efl.Model implementations to internal model Summary: CollectionView tries to access some properties from the base model so we need to provide some implementation of the property getter/setter. Reviewers: SanghyeonLee, cedric, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10300 --- src/lib/efl_mono/efl_mono_model_internal.c | 53 +++++++++++++-------- src/lib/efl_mono/efl_mono_model_internal.eo | 1 + 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/lib/efl_mono/efl_mono_model_internal.c b/src/lib/efl_mono/efl_mono_model_internal.c index cda6d66e14..1d4f79b536 100644 --- a/src/lib/efl_mono/efl_mono_model_internal.c +++ b/src/lib/efl_mono/efl_mono_model_internal.c @@ -101,11 +101,12 @@ _efl_mono_model_internal_add_property(Eo *obj EINA_UNUSED, Efl_Mono_Model_Intern eina_array_push (pd->properties_names, eina_stringshare_add(info->name)); } +static const char* _efl_mono_model_properties_names[] = { }; static Eina_Iterator * _efl_mono_model_internal_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED) { - return eina_array_iterator_new (NULL); + return EINA_C_ARRAY_ITERATOR_NEW(_efl_mono_model_properties_names); } static Efl_Object* @@ -129,6 +130,38 @@ _efl_mono_model_internal_efl_model_children_count_get(const Eo *obj EINA_UNUSED, return eina_array_count_get(pd->items); } +static Eina_Future * +_efl_mono_model_internal_efl_model_children_slice_get(Eo *obj, Efl_Mono_Model_Internal_Data *pd, unsigned int start, unsigned int count EINA_UNUSED) +{ + unsigned int i; + Eina_Value array = EINA_VALUE_EMPTY; + Efl_Mono_Model_Internal_Child_Data* pcd; + + eina_value_array_setup(&array, EINA_VALUE_TYPE_OBJECT, count % 8); + + for (i = start; i != start + count; ++i) + { + pcd = eina_array_data_get(pd->items, i); + eina_value_array_append (&array, pcd->child); + } + + return efl_loop_future_resolved(obj, array); +} + +static Eina_Future * +_efl_mono_model_internal_efl_model_property_set(Eo *obj, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED, const char *property EINA_UNUSED, Eina_Value *value EINA_UNUSED) +{ + return efl_loop_future_rejected(obj, ENOSYS); +} + +static Eina_Value * +_efl_mono_model_internal_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Mono_Model_Internal_Data *pd EINA_UNUSED, const char *property EINA_UNUSED) +{ + return eina_value_error_new(ENOSYS); +} + +/// Model_Internal_Child implementations + static Eina_Future * _efl_mono_model_internal_child_efl_model_property_set(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd, const char *property, Eina_Value *value) { @@ -180,24 +213,6 @@ _efl_mono_model_internal_child_efl_model_property_get(const Eo *obj EINA_UNUSED, } } -static Eina_Future * -_efl_mono_model_internal_efl_model_children_slice_get(Eo *obj, Efl_Mono_Model_Internal_Data *pd, unsigned int start, unsigned int count EINA_UNUSED) -{ - unsigned int i; - Eina_Value array = EINA_VALUE_EMPTY; - Efl_Mono_Model_Internal_Child_Data* pcd; - - eina_value_array_setup(&array, EINA_VALUE_TYPE_OBJECT, count % 8); - - for (i = start; i != start + count; ++i) - { - pcd = eina_array_data_get(pd->items, i); - eina_value_array_append (&array, pcd->child); - } - - return efl_loop_future_resolved(obj, array); -} - static Eo * _efl_mono_model_internal_child_efl_object_constructor(Eo *obj, Efl_Mono_Model_Internal_Child_Data *pd EINA_UNUSED) { diff --git a/src/lib/efl_mono/efl_mono_model_internal.eo b/src/lib/efl_mono/efl_mono_model_internal.eo index 71b331378b..a146ef71c8 100644 --- a/src/lib/efl_mono/efl_mono_model_internal.eo +++ b/src/lib/efl_mono/efl_mono_model_internal.eo @@ -23,5 +23,6 @@ class @beta Efl.Mono_Model_Internal extends Efl.Loop_Consumer implements Efl.Mod Efl.Model.child_add; Efl.Model.children_count { get; } Efl.Model.children_slice_get; + Efl.Model.property { get; set; } } }