summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-02-12 11:55:03 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-03-07 09:58:54 -0800
commitd0b70ef4e70f02e802aabb6e539f881d511ab922 (patch)
tree52297c7bd050d5e005d680d94a38d8e26285fafa
parent3cf418ab82ddc16f3af7269ec6e90347f1e2f52f (diff)
efl: Property_Bind should actually tell us if it succeeded or failed by returning an Eina.Error.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D7939
-rw-r--r--src/lib/efl/Efl_MVVM_Common.h2
-rw-r--r--src/lib/efl/interfaces/efl_mvvm_common.c8
-rw-r--r--src/lib/efl/interfaces/efl_ui_property_bind.eo3
-rw-r--r--src/lib/elementary/efl_ui_caching_factory.c5
-rw-r--r--src/lib/elementary/efl_ui_image.c5
-rw-r--r--src/lib/elementary/efl_ui_image_factory.c5
-rw-r--r--src/lib/elementary/efl_ui_layout.c8
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.c5
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c6
9 files changed, 33 insertions, 14 deletions
diff --git a/src/lib/efl/Efl_MVVM_Common.h b/src/lib/efl/Efl_MVVM_Common.h
index 954163b..d928fa5 100644
--- a/src/lib/efl/Efl_MVVM_Common.h
+++ b/src/lib/efl/Efl_MVVM_Common.h
@@ -12,6 +12,8 @@ EAPI extern Eina_Error EFL_MODEL_ERROR_INCORRECT_VALUE;
12EAPI extern Eina_Error EFL_MODEL_ERROR_PERMISSION_DENIED; 12EAPI extern Eina_Error EFL_MODEL_ERROR_PERMISSION_DENIED;
13EAPI extern Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT; /**< @since 1.19 */ 13EAPI extern Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT; /**< @since 1.19 */
14 14
15EAPI extern Eina_Error EFL_PROPERTY_ERROR_INVALID_KEY; /**< Returned when the given key during a efl_ui_property_bind does not exist on the object. */
16
15EAPI extern Eina_Error EFL_FACTORY_ERROR_NOT_SUPPORTED; /**< Returned error when factory got a request that it can't fullfil due to a set of unsupported parameters @since 1.22 */ 17EAPI extern Eina_Error EFL_FACTORY_ERROR_NOT_SUPPORTED; /**< Returned error when factory got a request that it can't fullfil due to a set of unsupported parameters @since 1.22 */
16 18
17#include "interfaces/efl_model.eo.h" 19#include "interfaces/efl_model.eo.h"
diff --git a/src/lib/efl/interfaces/efl_mvvm_common.c b/src/lib/efl/interfaces/efl_mvvm_common.c
index 2c95c76..2fb9118 100644
--- a/src/lib/efl/interfaces/efl_mvvm_common.c
+++ b/src/lib/efl/interfaces/efl_mvvm_common.c
@@ -15,6 +15,7 @@ EAPI Eina_Error EFL_MODEL_ERROR_INCORRECT_VALUE = 0;
15EAPI Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT = 0; 15EAPI Eina_Error EFL_MODEL_ERROR_INVALID_OBJECT = 0;
16 16
17EAPI Eina_Error EFL_FACTORY_ERROR_NOT_SUPPORTED = 0; 17EAPI Eina_Error EFL_FACTORY_ERROR_NOT_SUPPORTED = 0;
18EAPI Eina_Error EFL_PROPERTY_ERROR_INVALID_KEY = 0;
18 19
19static const char EFL_MODEL_ERROR_UNKNOWN_STR[] = "Unknown Error"; 20static const char EFL_MODEL_ERROR_UNKNOWN_STR[] = "Unknown Error";
20static const char EFL_MODEL_ERROR_NOT_SUPPORTED_STR[] = "Operation not supported"; 21static const char EFL_MODEL_ERROR_NOT_SUPPORTED_STR[] = "Operation not supported";
@@ -27,6 +28,9 @@ static const char EFL_MODEL_ERROR_INVALID_OBJECT_STR[] = "Object is invalid";
27 28
28static const char EFL_FACTORY_ERROR_NOT_SUPPORTED_STR[] = "Operation not supported"; 29static const char EFL_FACTORY_ERROR_NOT_SUPPORTED_STR[] = "Operation not supported";
29 30
31static const char EFL_PROPERTY_ERROR_INVALID_KEY_STR[] = "Incorrect key provided";
32
33
30EAPI int 34EAPI int
31efl_model_init(void) 35efl_model_init(void)
32{ 36{
@@ -44,6 +48,10 @@ efl_model_init(void)
44#define _ERROR(Name) EFL_FACTORY_ERROR_##Name = eina_error_msg_static_register(EFL_FACTORY_ERROR_##Name##_STR); 48#define _ERROR(Name) EFL_FACTORY_ERROR_##Name = eina_error_msg_static_register(EFL_FACTORY_ERROR_##Name##_STR);
45 _ERROR(NOT_SUPPORTED); 49 _ERROR(NOT_SUPPORTED);
46 50
51#undef _ERROR
52#define _ERROR(Name) EFL_PROPERTY_ERROR_##Name = eina_error_msg_static_register(EFL_PROPERTY_ERROR_##Name##_STR);
53 _ERROR(INVALID_KEY);
54
47 return EINA_TRUE; 55 return EINA_TRUE;
48} 56}
49 57
diff --git a/src/lib/efl/interfaces/efl_ui_property_bind.eo b/src/lib/efl/interfaces/efl_ui_property_bind.eo
index 54ce4d9..5134bd2 100644
--- a/src/lib/efl/interfaces/efl_ui_property_bind.eo
+++ b/src/lib/efl/interfaces/efl_ui_property_bind.eo
@@ -1,3 +1,5 @@
1import eina_types;
2
1interface @beta Efl.Ui.Property_Bind 3interface @beta Efl.Ui.Property_Bind
2{ 4{
3 [[Efl UI Property_Bind interface. 5 [[Efl UI Property_Bind interface.
@@ -13,6 +15,7 @@ interface @beta Efl.Ui.Property_Bind
13 key: string; [[key string for bind model property data]] 15 key: string; [[key string for bind model property data]]
14 property: string; [[Model property name]] 16 property: string; [[Model property name]]
15 } 17 }
18 return: Eina.Error; [[0 when it succeed, an error code otherwise.]]
16 } 19 }
17 } 20 }
18} 21}
diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c
index cfd8182..bea7a33 100644
--- a/src/lib/elementary/efl_ui_caching_factory.c
+++ b/src/lib/elementary/efl_ui_caching_factory.c
@@ -324,13 +324,14 @@ _efl_ui_caching_factory_efl_object_parent_set(Eo *obj, Efl_Ui_Caching_Factory_Da
324 if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); 324 if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd);
325} 325}
326 326
327static void 327static Eina_Error
328_efl_ui_caching_factory_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, 328_efl_ui_caching_factory_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Caching_Factory_Data *pd,
329 const char *key, const char *property) 329 const char *key, const char *property)
330{ 330{
331 if (!strcmp(key, "style")) 331 if (!strcmp(key, "style"))
332 eina_stringshare_replace(&pd->style, property); 332 eina_stringshare_replace(&pd->style, property);
333 efl_ui_property_bind(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), key, property); 333
334 return efl_ui_property_bind(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), key, property);
334} 335}
335 336
336#include "efl_ui_caching_factory.eo.c" 337#include "efl_ui_caching_factory.eo.c"
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index f1c0b35..a29ce75 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -1949,7 +1949,7 @@ _efl_ui_image_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data
1949 return pd->property.model; 1949 return pd->property.model;
1950} 1950}
1951 1951
1952EOLIAN static void 1952EOLIAN static Eina_Error
1953_efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd, const char *key, const char *property) 1953_efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd, const char *key, const char *property)
1954{ 1954{
1955 if (strcmp(key, "filename") == 0) 1955 if (strcmp(key, "filename") == 0)
@@ -1967,9 +1967,10 @@ _efl_ui_image_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Image_Data *pd,
1967 { 1967 {
1968 eina_stringshare_replace(&pd->property.key, property); 1968 eina_stringshare_replace(&pd->property.key, property);
1969 } 1969 }
1970 else return; 1970 else return EINA_FALSE;
1971 1971
1972 _update_viewmodel(obj, pd); 1972 _update_viewmodel(obj, pd);
1973 return 0;
1973} 1974}
1974 1975
1975EAPI void 1976EAPI void
diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c
index 1b34c11..9bf9f39 100644
--- a/src/lib/elementary/efl_ui_image_factory.c
+++ b/src/lib/elementary/efl_ui_image_factory.c
@@ -62,10 +62,11 @@ _efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *
62 .data = pd); 62 .data = pd);
63} 63}
64 64
65EOLIAN static void 65EOLIAN static Eina_Error
66_efl_ui_image_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, const char *key EINA_UNUSED, const char *property) 66_efl_ui_image_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, const char *key EINA_UNUSED, const char *property)
67{ 67{
68 eina_stringshare_replace(&pd->property, property); 68 eina_stringshare_replace(&pd->property, property);
69 return 0;
69} 70}
70 71
71#include "efl_ui_image_factory.eo.c" 72#include "efl_ui_image_factory.eo.c"
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 543a017..c67e948 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -2267,16 +2267,16 @@ _efl_ui_layout_base_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layo
2267 return pd->connect.model; 2267 return pd->connect.model;
2268} 2268}
2269 2269
2270EOLIAN static void 2270EOLIAN static Eina_Error
2271_efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *key, const char *property) 2271_efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *key, const char *property)
2272{ 2272{
2273 EINA_SAFETY_ON_NULL_RETURN(key); 2273 EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY);
2274 Eina_Stringshare *sprop; 2274 Eina_Stringshare *sprop;
2275 Eina_Hash *hash = NULL; 2275 Eina_Hash *hash = NULL;
2276 char *data = NULL; 2276 char *data = NULL;
2277 2277
2278 if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE)) 2278 if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE))
2279 return; 2279 return EFL_PROPERTY_ERROR_INVALID_KEY;
2280 2280
2281 _efl_ui_layout_connect_hash(pd); 2281 _efl_ui_layout_connect_hash(pd);
2282 2282
@@ -2314,6 +2314,8 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_
2314 2314
2315 if (!sprop) 2315 if (!sprop)
2316 free(data); 2316 free(data);
2317
2318 return 0;
2317} 2319}
2318 2320
2319EOLIAN static void 2321EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c
index d2f3488..3c93116 100644
--- a/src/lib/elementary/efl_ui_layout_factory.c
+++ b/src/lib/elementary/efl_ui_layout_factory.c
@@ -123,7 +123,7 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl
123 } 123 }
124} 124}
125 125
126EOLIAN static void 126EOLIAN static Eina_Error
127_efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd, 127_efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd,
128 const char *key, const char *property) 128 const char *key, const char *property)
129{ 129{
@@ -134,7 +134,7 @@ _efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, E
134 { 134 {
135 eina_hash_del(pd->bind.properties, ss_key, NULL); 135 eina_hash_del(pd->bind.properties, ss_key, NULL);
136 eina_stringshare_del(ss_key); 136 eina_stringshare_del(ss_key);
137 return; 137 return 0;
138 } 138 }
139 139
140 ss_prop = eina_stringshare_add(property); 140 ss_prop = eina_stringshare_add(property);
@@ -145,6 +145,7 @@ _efl_ui_layout_factory_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSED, E
145 eina_stringshare_del(ss_key); 145 eina_stringshare_del(ss_key);
146 } 146 }
147 147
148 return 0;
148} 149}
149 150
150EOLIAN static void 151EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c
index a8602a4..1059cef 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -115,17 +115,17 @@ _efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED,
115 efl_del(ui_view); 115 efl_del(ui_view);
116} 116}
117 117
118static void 118static Eina_Error
119_efl_ui_widget_factory_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, 119_efl_ui_widget_factory_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Widget_Factory_Data *pd,
120 const char *target, const char *property) 120 const char *target, const char *property)
121{ 121{
122 if (!strcmp(target, "style")) 122 if (!strcmp(target, "style"))
123 { 123 {
124 eina_stringshare_replace(&pd->style, property); 124 eina_stringshare_replace(&pd->style, property);
125 return ; 125 return 0;
126 } 126 }
127 127
128 efl_ui_property_bind(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS), target, property); 128 return efl_ui_property_bind(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS), target, property);
129} 129}
130 130
131#include "efl_ui_widget_factory.eo.c" 131#include "efl_ui_widget_factory.eo.c"