summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-26 10:29:05 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-29 10:49:17 +0900
commit76ef772d0a26463ba240718183195d61002587bf (patch)
tree95afd71ce72b3738f397dd6acb4fc2c7d2dca9a8
parent3cc8bc21739ab5ab5c09fec3934176aa3b53bea8 (diff)
edje: Unify load error types for image and edje (EO)
Most of the values were the same, with edje having just a couple more error codes. Not entirely sure the prefix Efl.Image is correct for this type. Maybe just Efl.Load.Error?
-rw-r--r--src/lib/edje/Edje_Common.h16
-rw-r--r--src/lib/edje/Edje_Legacy.h51
-rw-r--r--src/lib/edje/edje_load.c26
-rw-r--r--src/lib/edje/edje_object.eo26
-rw-r--r--src/lib/edje/edje_smart.c4
-rw-r--r--src/lib/edje/edje_types.eot15
-rw-r--r--src/lib/efl/interfaces/efl_gfx_types.eot7
-rw-r--r--src/lib/elementary/elm_layout.c4
8 files changed, 93 insertions, 56 deletions
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index 414820c..4152251 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1839,22 +1839,6 @@ EAPI void edje_file_collection_list_free (Eina_List *lst);
1839EAPI Eina_Bool edje_file_group_exists (const char *file, const char *glob); 1839EAPI Eina_Bool edje_file_group_exists (const char *file, const char *glob);
1840 1840
1841/** 1841/**
1842 * @brief Converts the given Edje file load error code into a string
1843 * describing it in English.
1844 *
1845 * @param error the error code, a value in ::Edje_Load_Error.
1846 * @return Always returns a valid string. If the given @p error is not
1847 * supported, <code>"Unknown error"</code> is returned.
1848 *
1849 * edje_object_file_set() is a function which sets an error value,
1850 * afterwards, which can be fetched with
1851 * edje_object_load_error_get(). The function in question is meant
1852 * to be used in conjunction with the latter, for pretty-printing any
1853 * possible error cause.
1854 */
1855EAPI const char *edje_load_error_str (Edje_Load_Error error);
1856
1857/**
1858 * @} 1842 * @}
1859 */ 1843 */
1860 1844
diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h
index 7bfeb9b..f122bb7 100644
--- a/src/lib/edje/Edje_Legacy.h
+++ b/src/lib/edje/Edje_Legacy.h
@@ -97,6 +97,57 @@ EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char
97 */ 97 */
98EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); 98EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
99 99
100/** Edje file loading error codes one can get - see edje_load_error_str() too. */
101typedef enum
102{
103 EDJE_LOAD_ERROR_NONE = 0, /**< No error happened, the loading was successful */
104 EDJE_LOAD_ERROR_GENERIC = 1, /**< A generic error happened during the loading */
105 EDJE_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< The file pointed to did not exist */
106 EDJE_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission to read the given file was denied */
107 EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Resource allocation failed during the loading */
108 EDJE_LOAD_ERROR_CORRUPT_FILE = 5, /**< The file pointed to was corrupt */
109 EDJE_LOAD_ERROR_UNKNOWN_FORMAT = 6, /**< The file pointed to had an unknown format */
110 EDJE_LOAD_ERROR_INCOMPATIBLE_FILE = 7, /**< The file pointed to is incompatible, i.e., it doesn't
111 * match the library's current version's format */
112 EDJE_LOAD_ERROR_UNKNOWN_COLLECTION = 8, /**< The group/collection set to load
113 * from was not found in the file */
114 EDJE_LOAD_ERROR_RECURSIVE_REFERENCE = 9 /**< The group/collection set to load from had
115 * <b>recursive references</b> on its components */
116} Edje_Load_Error;
117
118/**
119 * @brief Gets the (last) file loading error for a given Edje object
120 *
121 * This function is meant to be used after an Edje EDJ file loading, what takes
122 * place with the edje_object_file_set() function. If that function does not
123 * return @c true, one should check for the reason of failure with this one.
124 *
125 * @ref edje_load_error_str()
126 *
127 * @return The Edje loading error, one of: - #EDJE_LOAD_ERROR_NONE -
128 * #EDJE_LOAD_ERROR_GENERIC - #EDJE_LOAD_ERROR_DOES_NOT_EXIST -
129 * #EDJE_LOAD_ERROR_PERMISSION_DENIED -
130 * #EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED - #EDJE_LOAD_ERROR_CORRUPT_FILE
131 * - #EDJE_LOAD_ERROR_UNKNOWN_FORMAT - #EDJE_LOAD_ERROR_INCOMPATIBLE_FILE -
132 * #EDJE_LOAD_ERROR_UNKNOWN_COLLECTION - #EDJE_LOAD_ERROR_RECURSIVE_REFERENCE
133 */
134EAPI Edje_Load_Error edje_object_load_error_get(const Evas_Object *obj);
135
136/**
137 * @brief Converts the given Edje file load error code into a string
138 * describing it in English.
139 *
140 * @param error the error code, a value in ::Edje_Load_Error.
141 * @return Always returns a valid string. If the given @p error is not
142 * supported, <code>"Unknown error"</code> is returned.
143 *
144 * edje_object_file_set() is a function which sets an error value,
145 * afterwards, which can be fetched with
146 * edje_object_load_error_get(). The function in question is meant
147 * to be used in conjunction with the latter, for pretty-printing any
148 * possible error cause.
149 */
150EAPI const char *edje_load_error_str (Edje_Load_Error error);
100 151
101/** 152/**
102 * @ingroup Edje_Object_Communication_Interface_Message 153 * @ingroup Edje_Object_Communication_Interface_Message
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 630228e..7ced4ca 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -167,9 +167,32 @@ _edje_object_efl_file_file_get(Eo *obj EINA_UNUSED, Edje *ed, const char **file,
167 if (group) *group = ed->group; 167 if (group) *group = ed->group;
168} 168}
169 169
170EOLIAN Edje_Load_Error 170EOLIAN Efl_Image_Load_Error
171_edje_object_load_error_get(Eo *obj EINA_UNUSED, Edje *ed) 171_edje_object_load_error_get(Eo *obj EINA_UNUSED, Edje *ed)
172{ 172{
173 switch (ed->load_error)
174 {
175 case EDJE_LOAD_ERROR_NONE: return EFL_IMAGE_LOAD_ERROR_NONE;
176 case EDJE_LOAD_ERROR_GENERIC: return EFL_IMAGE_LOAD_ERROR_GENERIC;
177 case EDJE_LOAD_ERROR_DOES_NOT_EXIST: return EFL_IMAGE_LOAD_ERROR_DOES_NOT_EXIST;
178 case EDJE_LOAD_ERROR_PERMISSION_DENIED: return EFL_IMAGE_LOAD_ERROR_PERMISSION_DENIED;
179 case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: return EFL_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
180 case EDJE_LOAD_ERROR_CORRUPT_FILE: return EFL_IMAGE_LOAD_ERROR_CORRUPT_FILE;
181 case EDJE_LOAD_ERROR_UNKNOWN_FORMAT: return EFL_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT;
182 case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: return EFL_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE;
183 case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: return EFL_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION;
184 case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: return EFL_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE;
185 default: return EFL_IMAGE_LOAD_ERROR_GENERIC;
186 }
187}
188
189EAPI Edje_Load_Error
190edje_object_load_error_get(const Eo *obj)
191{
192 Edje *ed;
193
194 ed = _edje_fetch(obj);
195 if (!ed) return EDJE_LOAD_ERROR_GENERIC;
173 return ed->load_error; 196 return ed->load_error;
174} 197}
175 198
@@ -3098,4 +3121,3 @@ _edje_svg_node_free(Svg_Node *node)
3098 } 3121 }
3099 free(node); 3122 free(node);
3100} 3123}
3101
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index a9e3694..64a27d8 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -302,23 +302,15 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
302 [[Gets the (last) file loading error for a given Edje object 302 [[Gets the (last) file loading error for a given Edje object
303 303
304 This function is meant to be used after an Edje EDJ file 304 This function is meant to be used after an Edje EDJ file
305 loading, what takes place with the edje_object_file_set() 305 loading, what takes place with the $file_set() function. If that
306 function. If that function does not return $true, one should 306 function does not return $true, one should check for the reason
307 check for the reason of failure with this one. 307 of failure with this one.
308 308 ]]
309 \@ref edje_load_error_str()]] 309 legacy: null;
310 return: Edje.Load_Error; [[The Edje loading error, one of: 310 }
311 - #EDJE_LOAD_ERROR_NONE 311 values {
312 - #EDJE_LOAD_ERROR_GENERIC 312 error: Efl.Image.Load.Error(Efl.Image.Load.Error.generic);
313 - #EDJE_LOAD_ERROR_DOES_NOT_EXIST 313 [[The load error code.]]
314 - #EDJE_LOAD_ERROR_PERMISSION_DENIED
315 - #EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED
316 - #EDJE_LOAD_ERROR_CORRUPT_FILE
317 - #EDJE_LOAD_ERROR_UNKNOWN_FORMAT
318 - #EDJE_LOAD_ERROR_INCOMPATIBLE_FILE
319 - #EDJE_LOAD_ERROR_UNKNOWN_COLLECTION
320 - #EDJE_LOAD_ERROR_RECURSIVE_REFERENCE]]
321
322 } 314 }
323 } 315 }
324 size_min_calc { 316 size_min_calc {
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index c14aed1..bd72769 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -67,14 +67,14 @@ _edje_object_efl_object_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Efl_Dbg_
67{ 67{
68 efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root); 68 efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root);
69 Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); 69 Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
70 Edje_Load_Error error;
70 71
71 const char *file, *edje_group; 72 const char *file, *edje_group;
72 efl_file_get(eo_obj, &file, &edje_group); 73 efl_file_get(eo_obj, &file, &edje_group);
73 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); 74 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
74 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); 75 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
75 76
76 Edje_Load_Error error = EDJE_LOAD_ERROR_NONE; 77 error = edje_object_load_error_get(eo_obj);
77 error = edje_obj_load_error_get(eo_obj);
78 if (error != EDJE_LOAD_ERROR_NONE) 78 if (error != EDJE_LOAD_ERROR_NONE)
79 { 79 {
80 EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING, 80 EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING,
diff --git a/src/lib/edje/edje_types.eot b/src/lib/edje/edje_types.eot
index 2237b40..9345af8 100644
--- a/src/lib/edje/edje_types.eot
+++ b/src/lib/edje/edje_types.eot
@@ -17,21 +17,6 @@ enum Edje.Drag_Dir {
17 xy = 3 [[X and Y dragable value]] 17 xy = 3 [[X and Y dragable value]]
18} 18}
19 19
20enum Edje.Load_Error {
21 [[Edje file loading error codes one can get - see edje_load_error_str() too.]]
22
23 none = 0, [[No error happened, the loading was successful]]
24 generic = 1, [[A generic error happened during the loading]]
25 does_not_exist = 2, [[The file pointed to did not exist]]
26 permission_denied = 3, [[Permission to read the given file was denied]]
27 resource_allocation_failed = 4, [[Resource allocation failed during the loading]]
28 corrupt_file = 5, [[The file pointed to was corrupt]]
29 unknown_format = 6, [[The file pointed to had an unknown format]]
30 incompatible_file = 7, [[The file pointed to is incompatible, i.e., it doesn't match the library's current version's format]]
31 unknown_collection = 8, [[The group/collection set to load from was not found in the file]]
32 recursive_reference = 9 [[The group/collection set to load from had <b>recursive references</b> on its components]]
33}
34
35enum Edje.Text.Autocapital_Type { 20enum Edje.Text.Autocapital_Type {
36 [[All Text auto capital mode type values]] 21 [[All Text auto capital mode type values]]
37 none, [[None mode value]] 22 none, [[None mode value]]
diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot
index 8f72bb6..cbfb04f 100644
--- a/src/lib/efl/interfaces/efl_gfx_types.eot
+++ b/src/lib/efl/interfaces/efl_gfx_types.eot
@@ -183,7 +183,7 @@ enum Efl.Gfx.Size.Hint.Aspect
183 183
184enum Efl.Image.Load.Error 184enum Efl.Image.Load.Error
185{ 185{
186 [[Image load error type]] 186 [[Image or Edje load error type]]
187 none = 0, [[No error on load]] 187 none = 0, [[No error on load]]
188 generic = 1, [[A non-specific error occurred]] 188 generic = 1, [[A non-specific error occurred]]
189 does_not_exist = 2, [[File (or file path) does not exist]] 189 does_not_exist = 2, [[File (or file path) does not exist]]
@@ -191,7 +191,10 @@ enum Efl.Image.Load.Error
191 resource_allocation_failed = 4, [[Allocation of resources failure prevented load]] 191 resource_allocation_failed = 4, [[Allocation of resources failure prevented load]]
192 corrupt_file = 5, [[File corrupt (but was detected as a known format)]] 192 corrupt_file = 5, [[File corrupt (but was detected as a known format)]]
193 unknown_format = 6, [[File is not a known format]] 193 unknown_format = 6, [[File is not a known format]]
194 cancelled = 7 [[Reading operation has been cancelled during decoding]] 194 cancelled = 7, [[Reading operation has been cancelled during decoding]]
195 incompatible_file = 8, [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]]
196 unknown_collection = 9, [[(Edje only) The group/collection set to load from was not found in the file]]
197 recursive_reference = 10 [[(Edje only) The group/collection set to load from had recursive references on its components]]
195} 198}
196 199
197enum Efl.Gfx.Size.Hint.Mode { 200enum Efl.Gfx.Size.Hint.Mode {
diff --git a/src/lib/elementary/elm_layout.c b/src/lib/elementary/elm_layout.c
index c11b6f3..d63b015 100644
--- a/src/lib/elementary/elm_layout.c
+++ b/src/lib/elementary/elm_layout.c
@@ -1898,13 +1898,13 @@ _elm_layout_efl_object_dbg_info_get(Eo *eo_obj, Elm_Layout_Smart_Data *_pd EINA_
1898 Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); 1898 Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
1899 const char *file, *edje_group; 1899 const char *file, *edje_group;
1900 Evas_Object *edje_obj = wd->resize_obj; 1900 Evas_Object *edje_obj = wd->resize_obj;
1901 Edje_Load_Error error;
1901 1902
1902 efl_file_get(edje_obj, &file, &edje_group); 1903 efl_file_get(edje_obj, &file, &edje_group);
1903 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); 1904 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
1904 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); 1905 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
1905 1906
1906 Edje_Load_Error error = EDJE_LOAD_ERROR_GENERIC; 1907 error = edje_object_load_error_get(edje_obj);
1907 error = edje_obj_load_error_get(edje_obj);
1908 if (error != EDJE_LOAD_ERROR_NONE) 1908 if (error != EDJE_LOAD_ERROR_NONE)
1909 { 1909 {
1910 EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING, 1910 EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING,