aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-12-19 14:49:23 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-02 13:39:29 -0800
commit83e3b25d80f84666eec34298f50c552da6490b64 (patch)
tree6277ab01666c3f40077abb6941ba88dbfe26f411
parentecore: test for Efl.ModelView. (diff)
downloadefl-83e3b25d80f84666eec34298f50c552da6490b64.tar.gz
ecore: define behavior when no getter/setter callback function is defined for ModelView property logic.
This allow for simplifying the code that doesn't need to handle get/set/free callback when not needed. Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7489
-rw-r--r--src/lib/ecore/efl_model_view.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/lib/ecore/efl_model_view.c b/src/lib/ecore/efl_model_view.c
index da9b672d5c..4fdcae606e 100644
--- a/src/lib/ecore/efl_model_view.c
+++ b/src/lib/ecore/efl_model_view.c
@@ -110,8 +110,8 @@ _logic_free(void *data)
Efl_Model_View_Logic *logic = data;
Eina_Stringshare *source;
- logic->get.free_cb(logic->get.data);
- logic->set.free_cb(logic->set.data);
+ if (logic->get.free_cb) logic->get.free_cb(logic->get.data);
+ if (logic->set.free_cb) logic->set.free_cb(logic->set.data);
EINA_LIST_FREE(logic->sources, source)
{
efl_model_view_property_unbind(logic->object, source, logic->property);
@@ -121,6 +121,23 @@ _logic_free(void *data)
free(logic);
}
+static Eina_Value *
+_efl_model_view_property_dummy_get(void *data EINA_UNUSED,
+ const Efl_Model_View *model_view EINA_UNUSED,
+ Eina_Stringshare *property EINA_UNUSED)
+{
+ return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED);
+}
+
+static Eina_Future *
+_efl_model_view_property_dummy_set(void *data EINA_UNUSED,
+ Efl_Model_View *model_view,
+ Eina_Stringshare *property EINA_UNUSED,
+ Eina_Value *value EINA_UNUSED)
+{
+ return efl_loop_future_rejected(model_view, EFL_MODEL_ERROR_READ_ONLY);
+}
+
static Eina_Error
_efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
const char *property,
@@ -145,10 +162,10 @@ _efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
logic->object = obj;
logic->property = prop;
- logic->get.fct = get;
+ logic->get.fct = get ? get : _efl_model_view_property_dummy_get;
logic->get.free_cb = get_free_cb;
logic->get.data = get_data;
- logic->set.fct = set;
+ logic->set.fct = set ? set : _efl_model_view_property_dummy_set;
logic->set.free_cb = set_free_cb;
logic->set.data = set_data;