csharp: Add Efl.Model implementations to internal model
authorLauro Moura <lauromoura@expertisesolutions.com.br>
Thu, 17 Oct 2019 14:11:00 +0000 (11:11 -0300)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 11 Nov 2019 02:18:26 +0000 (11:18 +0900)
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
src/lib/efl_mono/efl_mono_model_internal.eo

index cda6d66..1d4f79b 100644 (file)
@@ -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*
@@ -130,6 +131,38 @@ _efl_mono_model_internal_efl_model_children_count_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 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)
 {
   int i = _find_property_index (property, pd->model_pd->properties_names);
@@ -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)
 {
index 71b3313..a146ef7 100644 (file)
@@ -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; }
   }
 }