summaryrefslogtreecommitdiff
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
parent1e3ecdd55ffdf4dd0bd8edc556b4d7d3a42149a1 (diff)
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)
110 Efl_Model_View_Logic *logic = data; 110 Efl_Model_View_Logic *logic = data;
111 Eina_Stringshare *source; 111 Eina_Stringshare *source;
112 112
113 logic->get.free_cb(logic->get.data); 113 if (logic->get.free_cb) logic->get.free_cb(logic->get.data);
114 logic->set.free_cb(logic->set.data); 114 if (logic->set.free_cb) logic->set.free_cb(logic->set.data);
115 EINA_LIST_FREE(logic->sources, source) 115 EINA_LIST_FREE(logic->sources, source)
116 { 116 {
117 efl_model_view_property_unbind(logic->object, source, logic->property); 117 efl_model_view_property_unbind(logic->object, source, logic->property);
@@ -121,6 +121,23 @@ _logic_free(void *data)
121 free(logic); 121 free(logic);
122} 122}
123 123
124static Eina_Value *
125_efl_model_view_property_dummy_get(void *data EINA_UNUSED,
126 const Efl_Model_View *model_view EINA_UNUSED,
127 Eina_Stringshare *property EINA_UNUSED)
128{
129 return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED);
130}
131
132static Eina_Future *
133_efl_model_view_property_dummy_set(void *data EINA_UNUSED,
134 Efl_Model_View *model_view,
135 Eina_Stringshare *property EINA_UNUSED,
136 Eina_Value *value EINA_UNUSED)
137{
138 return efl_loop_future_rejected(model_view, EFL_MODEL_ERROR_READ_ONLY);
139}
140
124static Eina_Error 141static Eina_Error
125_efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd, 142_efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
126 const char *property, 143 const char *property,
@@ -145,10 +162,10 @@ _efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
145 162
146 logic->object = obj; 163 logic->object = obj;
147 logic->property = prop; 164 logic->property = prop;
148 logic->get.fct = get; 165 logic->get.fct = get ? get : _efl_model_view_property_dummy_get;
149 logic->get.free_cb = get_free_cb; 166 logic->get.free_cb = get_free_cb;
150 logic->get.data = get_data; 167 logic->get.data = get_data;
151 logic->set.fct = set; 168 logic->set.fct = set ? set : _efl_model_view_property_dummy_set;
152 logic->set.free_cb = set_free_cb; 169 logic->set.free_cb = set_free_cb;
153 logic->set.data = set_data; 170 logic->set.data = set_data;
154 171