diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2018-11-23 16:25:19 +0000 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2018-11-23 10:13:58 -0800 |
commit | d4d44d76f3efef4d61edb4cce7152284915a12d2 (patch) | |
tree | 502779c9047c6a8e02c8466f81ddc8616887fa50 /src/lib | |
parent | aac7d099a17d69f5989481f8999a43d4173005bd (diff) |
efl: make Efl.Model.properties_get return an Iterator<string>.
Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D7289
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ecore/efl_model_composite.c | 2 | ||||
-rw-r--r-- | src/lib/ecore/efl_model_composite_boolean.c | 19 | ||||
-rw-r--r-- | src/lib/ecore/efl_model_container.c | 14 | ||||
-rw-r--r-- | src/lib/ecore/efl_model_container_item.c | 2 | ||||
-rw-r--r-- | src/lib/ecore/efl_model_item.c | 8 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_model.eo | 2 | ||||
-rw-r--r-- | src/lib/eio/eio_model.c | 11 | ||||
-rw-r--r-- | src/lib/eldbus/eldbus_model.c | 9 | ||||
-rw-r--r-- | src/lib/eldbus/eldbus_model_arguments.c | 71 | ||||
-rw-r--r-- | src/lib/eldbus/eldbus_model_arguments_private.h | 5 | ||||
-rw-r--r-- | src/lib/eldbus/eldbus_model_method.c | 7 | ||||
-rw-r--r-- | src/lib/eldbus/eldbus_model_proxy.c | 15 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_list_view.c | 14 |
13 files changed, 59 insertions, 120 deletions
diff --git a/src/lib/ecore/efl_model_composite.c b/src/lib/ecore/efl_model_composite.c index 90cd8adc84..dfb3019cbd 100644 --- a/src/lib/ecore/efl_model_composite.c +++ b/src/lib/ecore/efl_model_composite.c | |||
@@ -69,7 +69,7 @@ _efl_model_composite_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Model | |||
69 | return efl_model_property_get(pd->source, property); | 69 | return efl_model_property_get(pd->source, property); |
70 | } | 70 | } |
71 | 71 | ||
72 | static Eina_Array * | 72 | static Eina_Iterator * |
73 | _efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd) | 73 | _efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd) |
74 | { | 74 | { |
75 | return efl_model_properties_get(pd->source); | 75 | return efl_model_properties_get(pd->source); |
diff --git a/src/lib/ecore/efl_model_composite_boolean.c b/src/lib/ecore/efl_model_composite_boolean.c index 98dbbe5bb1..ef9ec433a5 100644 --- a/src/lib/ecore/efl_model_composite_boolean.c +++ b/src/lib/ecore/efl_model_composite_boolean.c | |||
@@ -67,23 +67,20 @@ _efl_model_composite_boolean_children_efl_object_finalize(Eo *obj, | |||
67 | return obj; | 67 | return obj; |
68 | } | 68 | } |
69 | 69 | ||
70 | static Eina_Array * | 70 | static Eina_Iterator * |
71 | _efl_model_composite_boolean_children_efl_model_properties_get(const Eo *obj, | 71 | _efl_model_composite_boolean_children_efl_model_properties_get(const Eo *obj, |
72 | Efl_Model_Composite_Boolean_Children_Data *pd) | 72 | Efl_Model_Composite_Boolean_Children_Data *pd) |
73 | { | 73 | { |
74 | Eina_Iterator *it; | 74 | Eina_Iterator *its; |
75 | Eina_Stringshare *s; | 75 | Eina_Iterator *itr; |
76 | Eina_Array *r; | ||
77 | 76 | ||
78 | r = efl_model_properties_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS)); | 77 | its = efl_model_properties_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS)); |
79 | if (!r) r = eina_array_new(1); | 78 | itr = eina_hash_iterator_key_new(pd->parent->values); |
80 | 79 | ||
81 | it = eina_hash_iterator_key_new(pd->parent->values); | 80 | if (!its) return itr; |
82 | EINA_ITERATOR_FOREACH(it, s) | 81 | if (!itr) return its; |
83 | eina_array_push(r, s); | ||
84 | eina_array_push(r, "child.index"); | ||
85 | 82 | ||
86 | return r; | 83 | return eina_multi_iterator_new(its, itr); |
87 | } | 84 | } |
88 | 85 | ||
89 | static Eina_Value * | 86 | static Eina_Value * |
diff --git a/src/lib/ecore/efl_model_container.c b/src/lib/ecore/efl_model_container.c index 0832a2f0dc..5449ae4307 100644 --- a/src/lib/ecore/efl_model_container.c +++ b/src/lib/ecore/efl_model_container.c | |||
@@ -225,20 +225,10 @@ _efl_model_container_child_property_add(Eo *obj, | |||
225 | return EINA_FALSE; | 225 | return EINA_FALSE; |
226 | } | 226 | } |
227 | 227 | ||
228 | static Eina_Array * | 228 | static Eina_Iterator * |
229 | _efl_model_container_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd) | 229 | _efl_model_container_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd) |
230 | { | 230 | { |
231 | Eina_Iterator *it; | 231 | return eina_hash_iterator_key_new(sd->properties); |
232 | Eina_Array *r; | ||
233 | Eina_Stringshare *s; | ||
234 | |||
235 | r = eina_array_new(1); | ||
236 | it = eina_hash_iterator_key_new(sd->properties); | ||
237 | EINA_ITERATOR_FOREACH(it, s) | ||
238 | eina_array_push(r, eina_stringshare_ref(s)); | ||
239 | eina_iterator_free(it); | ||
240 | |||
241 | return r; | ||
242 | } | 232 | } |
243 | 233 | ||
244 | static Eina_Future * | 234 | static Eina_Future * |
diff --git a/src/lib/ecore/efl_model_container_item.c b/src/lib/ecore/efl_model_container_item.c index b87558a3b3..c3fa8d0c90 100644 --- a/src/lib/ecore/efl_model_container_item.c +++ b/src/lib/ecore/efl_model_container_item.c | |||
@@ -25,7 +25,7 @@ _efl_model_container_item_efl_object_invalidate(Eo *obj, Efl_Model_Container_Ite | |||
25 | sd->index = 0; | 25 | sd->index = 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | static Eina_Array * | 28 | static Eina_Iterator * |
29 | _efl_model_container_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd) | 29 | _efl_model_container_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd) |
30 | { | 30 | { |
31 | // FIXME: Not to sure here, shouldn't we extend a child of the parent actually ? | 31 | // FIXME: Not to sure here, shouldn't we extend a child of the parent actually ? |
diff --git a/src/lib/ecore/efl_model_item.c b/src/lib/ecore/efl_model_item.c index e5058c10ff..104125a705 100644 --- a/src/lib/ecore/efl_model_item.c +++ b/src/lib/ecore/efl_model_item.c | |||
@@ -13,7 +13,6 @@ typedef struct _Efl_Model_Item_Data Efl_Model_Item_Data; | |||
13 | struct _Efl_Model_Item_Data | 13 | struct _Efl_Model_Item_Data |
14 | { | 14 | { |
15 | Eina_Hash *properties; | 15 | Eina_Hash *properties; |
16 | Eina_Array *defined_properties; | ||
17 | Eina_List *childrens; | 16 | Eina_List *childrens; |
18 | }; | 17 | }; |
19 | 18 | ||
@@ -38,7 +37,6 @@ _efl_model_item_efl_object_constructor(Eo *obj, Efl_Model_Item_Data *sd) | |||
38 | return NULL; | 37 | return NULL; |
39 | 38 | ||
40 | sd->properties = eina_hash_stringshared_new(_item_value_free_cb); | 39 | sd->properties = eina_hash_stringshared_new(_item_value_free_cb); |
41 | sd->defined_properties = eina_array_new(8); | ||
42 | 40 | ||
43 | return obj; | 41 | return obj; |
44 | } | 42 | } |
@@ -57,15 +55,13 @@ _efl_model_item_efl_object_destructor(Eo *obj, Efl_Model_Item_Data *sd) | |||
57 | eina_hash_foreach(sd->properties, _stringshared_keys_free, NULL); | 55 | eina_hash_foreach(sd->properties, _stringshared_keys_free, NULL); |
58 | eina_hash_free(sd->properties); | 56 | eina_hash_free(sd->properties); |
59 | 57 | ||
60 | eina_array_free(sd->defined_properties); | ||
61 | |||
62 | efl_destructor(efl_super(obj, MY_CLASS)); | 58 | efl_destructor(efl_super(obj, MY_CLASS)); |
63 | } | 59 | } |
64 | 60 | ||
65 | static Eina_Array * | 61 | static Eina_Iterator * |
66 | _efl_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd) | 62 | _efl_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd) |
67 | { | 63 | { |
68 | return pd->defined_properties; | 64 | return eina_hash_iterator_key_new(pd->properties); |
69 | } | 65 | } |
70 | 66 | ||
71 | static Eina_Future * | 67 | static Eina_Future * |
diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo index 88260db317..ffe8bf4430 100644 --- a/src/lib/efl/interfaces/efl_model.eo +++ b/src/lib/efl/interfaces/efl_model.eo | |||
@@ -33,7 +33,7 @@ interface Efl.Model () | |||
33 | ]] | 33 | ]] |
34 | } | 34 | } |
35 | values { | 35 | values { |
36 | properties: array<string>; [[Array of current properties]] | 36 | properties: iterator<string> @owned; [[Array of current properties]] |
37 | } | 37 | } |
38 | } | 38 | } |
39 | @property property { | 39 | @property property { |
diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c index 62e52f46dd..ee8296a03b 100644 --- a/src/lib/eio/eio_model.c +++ b/src/lib/eio/eio_model.c | |||
@@ -631,18 +631,11 @@ static struct { | |||
631 | /** | 631 | /** |
632 | * Interfaces impl. | 632 | * Interfaces impl. |
633 | */ | 633 | */ |
634 | static Eina_Array * | 634 | static Eina_Iterator * |
635 | _eio_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, | 635 | _eio_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, |
636 | Eio_Model_Data *pd EINA_UNUSED) | 636 | Eio_Model_Data *pd EINA_UNUSED) |
637 | { | 637 | { |
638 | Eina_Array *r; | 638 | return EINA_C_ARRAY_ITERATOR_NEW(properties); |
639 | unsigned int i; | ||
640 | |||
641 | r = eina_array_new(4); | ||
642 | for (i = 0; i < EINA_C_ARRAY_LENGTH(properties); ++i) | ||
643 | eina_array_push(r, properties[i].name); | ||
644 | |||
645 | return r; | ||
646 | } | 639 | } |
647 | 640 | ||
648 | static Eina_Value * | 641 | static Eina_Value * |
diff --git a/src/lib/eldbus/eldbus_model.c b/src/lib/eldbus/eldbus_model.c index 28faa0fb24..3a2115ead0 100644 --- a/src/lib/eldbus/eldbus_model.c +++ b/src/lib/eldbus/eldbus_model.c | |||
@@ -152,16 +152,13 @@ _eldbus_model_efl_model_property_get(const Eo *obj, | |||
152 | return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND); | 152 | return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND); |
153 | } | 153 | } |
154 | 154 | ||
155 | static Eina_Array * | 155 | static Eina_Iterator * |
156 | _eldbus_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, | 156 | _eldbus_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, |
157 | Eldbus_Model_Data *pd EINA_UNUSED) | 157 | Eldbus_Model_Data *pd EINA_UNUSED) |
158 | { | 158 | { |
159 | Eina_Array *r; | 159 | char *unique[] = { UNIQUE_NAME_PROPERTY }; |
160 | 160 | ||
161 | r = eina_array_new(1); | 161 | return EINA_C_ARRAY_ITERATOR_NEW(unique); |
162 | eina_array_push(r, eina_stringshare_add(UNIQUE_NAME_PROPERTY)); | ||
163 | |||
164 | return r; | ||
165 | } | 162 | } |
166 | 163 | ||
167 | static Efl_Object * | 164 | static Efl_Object * |
diff --git a/src/lib/eldbus/eldbus_model_arguments.c b/src/lib/eldbus/eldbus_model_arguments.c index 1d22903668..4c609300e8 100644 --- a/src/lib/eldbus/eldbus_model_arguments.c +++ b/src/lib/eldbus/eldbus_model_arguments.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #define MY_CLASS ELDBUS_MODEL_ARGUMENTS_CLASS | 12 | #define MY_CLASS ELDBUS_MODEL_ARGUMENTS_CLASS |
13 | #define MY_CLASS_NAME "Eldbus_Model_Arguments" | 13 | #define MY_CLASS_NAME "Eldbus_Model_Arguments" |
14 | 14 | ||
15 | #define ARGUMENT_FORMAT "arg%u" | ||
16 | |||
17 | static void _eldbus_model_arguments_properties_load(Eldbus_Model_Arguments_Data *); | 15 | static void _eldbus_model_arguments_properties_load(Eldbus_Model_Arguments_Data *); |
18 | static void _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *); | 16 | static void _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *); |
19 | static Eina_Bool _eldbus_model_arguments_is_input_argument(Eldbus_Model_Arguments_Data *, const char *); | 17 | static Eina_Bool _eldbus_model_arguments_is_input_argument(Eldbus_Model_Arguments_Data *, const char *); |
@@ -31,8 +29,8 @@ static Efl_Object* | |||
31 | _eldbus_model_arguments_efl_object_constructor(Eo *obj, Eldbus_Model_Arguments_Data *pd) | 29 | _eldbus_model_arguments_efl_object_constructor(Eo *obj, Eldbus_Model_Arguments_Data *pd) |
32 | { | 30 | { |
33 | pd->obj = obj; | 31 | pd->obj = obj; |
34 | pd->properties_array = NULL; | 32 | // We do keep strings here as some of our API are looking for arg%u as a key instead of just indexes. |
35 | pd->properties_hash = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_arguments_hash_free)); | 33 | pd->properties = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_arguments_hash_free)); |
36 | pd->pending_list = NULL; | 34 | pd->pending_list = NULL; |
37 | pd->proxy = NULL; | 35 | pd->proxy = NULL; |
38 | pd->arguments = NULL; | 36 | pd->arguments = NULL; |
@@ -72,7 +70,7 @@ _eldbus_model_arguments_efl_object_destructor(Eo *obj, Eldbus_Model_Arguments_Da | |||
72 | { | 70 | { |
73 | _eldbus_model_arguments_unload(pd); | 71 | _eldbus_model_arguments_unload(pd); |
74 | 72 | ||
75 | eina_hash_free(pd->properties_hash); | 73 | eina_hash_free(pd->properties); |
76 | 74 | ||
77 | eina_stringshare_del(pd->name); | 75 | eina_stringshare_del(pd->name); |
78 | eldbus_proxy_unref(pd->proxy); | 76 | eldbus_proxy_unref(pd->proxy); |
@@ -80,14 +78,14 @@ _eldbus_model_arguments_efl_object_destructor(Eo *obj, Eldbus_Model_Arguments_Da | |||
80 | efl_destructor(efl_super(obj, MY_CLASS)); | 78 | efl_destructor(efl_super(obj, MY_CLASS)); |
81 | } | 79 | } |
82 | 80 | ||
83 | static Eina_Array * | 81 | static Eina_Iterator * |
84 | _eldbus_model_arguments_efl_model_properties_get(const Eo *obj EINA_UNUSED, | 82 | _eldbus_model_arguments_efl_model_properties_get(const Eo *obj EINA_UNUSED, |
85 | Eldbus_Model_Arguments_Data *pd) | 83 | Eldbus_Model_Arguments_Data *pd) |
86 | { | 84 | { |
87 | EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL); | 85 | EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL); |
88 | 86 | ||
89 | _eldbus_model_arguments_properties_load(pd); | 87 | _eldbus_model_arguments_properties_load(pd); |
90 | return pd->properties_array; | 88 | return eina_hash_iterator_key_new(pd->properties); |
91 | } | 89 | } |
92 | 90 | ||
93 | static void | 91 | static void |
@@ -96,30 +94,25 @@ _eldbus_model_arguments_properties_load(Eldbus_Model_Arguments_Data *pd) | |||
96 | unsigned int arguments_count; | 94 | unsigned int arguments_count; |
97 | unsigned int i; | 95 | unsigned int i; |
98 | 96 | ||
99 | if (pd->properties_array) | 97 | if (eina_hash_population(pd->properties) > 0) |
100 | return; | 98 | return ; |
101 | 99 | ||
102 | arguments_count = eina_list_count(pd->arguments); | 100 | arguments_count = eina_list_count(pd->arguments); |
103 | 101 | ||
104 | pd->properties_array = eina_array_new(arguments_count); | ||
105 | EINA_SAFETY_ON_NULL_RETURN(pd->properties_array); | ||
106 | |||
107 | for (i = 0; i < arguments_count; ++i) | 102 | for (i = 0; i < arguments_count; ++i) |
108 | { | 103 | { |
109 | Eldbus_Introspection_Argument *arg; | 104 | Eldbus_Introspection_Argument *arg; |
110 | const Eina_Value_Type *type; | 105 | const Eina_Value_Type *type; |
111 | Eina_Stringshare *name; | 106 | Eina_Slstr *name; |
112 | Eina_Value *value; | 107 | Eina_Value *value; |
113 | 108 | ||
114 | name = eina_stringshare_printf(ARGUMENT_FORMAT, i); | 109 | name = eina_slstr_printf(ARGUMENT_FORMAT, i); |
115 | if (!name) continue; | 110 | if (!name) continue; |
116 | 111 | ||
117 | eina_array_push(pd->properties_array, name); | ||
118 | |||
119 | arg = eina_list_nth(pd->arguments, i); | 112 | arg = eina_list_nth(pd->arguments, i); |
120 | type = _dbus_type_to_eina_value_type(arg->type[0]); | 113 | type = _dbus_type_to_eina_value_type(arg->type[0]); |
121 | value = eina_value_new(type); | 114 | value = eina_value_new(type); |
122 | eina_hash_add(pd->properties_hash, name, value); | 115 | eina_hash_add(pd->properties, name, value); |
123 | } | 116 | } |
124 | } | 117 | } |
125 | 118 | ||
@@ -144,7 +137,7 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj, | |||
144 | if (!ret) goto on_error; | 137 | if (!ret) goto on_error; |
145 | 138 | ||
146 | err = EFL_MODEL_ERROR_NOT_FOUND; | 139 | err = EFL_MODEL_ERROR_NOT_FOUND; |
147 | prop_value = eina_hash_find(pd->properties_hash, property); | 140 | prop_value = eina_hash_find(pd->properties, property); |
148 | if (!prop_value) goto on_error; | 141 | if (!prop_value) goto on_error; |
149 | 142 | ||
150 | eina_value_flush(prop_value); | 143 | eina_value_flush(prop_value); |
@@ -168,7 +161,7 @@ _eldbus_model_arguments_efl_model_property_get(const Eo *obj, Eldbus_Model_Argum | |||
168 | 161 | ||
169 | _eldbus_model_arguments_properties_load(pd); | 162 | _eldbus_model_arguments_properties_load(pd); |
170 | 163 | ||
171 | value = eina_hash_find(pd->properties_hash, property); | 164 | value = eina_hash_find(pd->properties, property); |
172 | if (!value) return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND); | 165 | if (!value) return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND); |
173 | 166 | ||
174 | ret = _eldbus_model_arguments_is_output_argument(pd, property); | 167 | ret = _eldbus_model_arguments_is_output_argument(pd, property); |
@@ -193,19 +186,7 @@ _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *pd) | |||
193 | EINA_LIST_FREE(pd->pending_list, pending) | 186 | EINA_LIST_FREE(pd->pending_list, pending) |
194 | eldbus_pending_cancel(pending); | 187 | eldbus_pending_cancel(pending); |
195 | 188 | ||
196 | if (pd->properties_array) | 189 | eina_hash_free_buckets(pd->properties); |
197 | { | ||
198 | Eina_Stringshare *property; | ||
199 | Eina_Array_Iterator it; | ||
200 | unsigned int i; | ||
201 | |||
202 | EINA_ARRAY_ITER_NEXT(pd->properties_array, i, property, it) | ||
203 | eina_stringshare_del(property); | ||
204 | eina_array_free(pd->properties_array); | ||
205 | pd->properties_array = NULL; | ||
206 | } | ||
207 | |||
208 | eina_hash_free_buckets(pd->properties_hash); | ||
209 | } | 190 | } |
210 | 191 | ||
211 | Eina_Bool | 192 | Eina_Bool |
@@ -219,6 +200,7 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd, | |||
219 | Eina_Value *value_struct; | 200 | Eina_Value *value_struct; |
220 | Eina_Array *changed_properties; | 201 | Eina_Array *changed_properties; |
221 | unsigned int i = 0; | 202 | unsigned int i = 0; |
203 | Eina_Stringshare *property; | ||
222 | Eina_Bool result = EINA_FALSE; | 204 | Eina_Bool result = EINA_FALSE; |
223 | 205 | ||
224 | _eldbus_model_arguments_properties_load(pd); | 206 | _eldbus_model_arguments_properties_load(pd); |
@@ -244,16 +226,14 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd, | |||
244 | { | 226 | { |
245 | if (ELDBUS_INTROSPECTION_ARGUMENT_DIRECTION_IN != argument->direction) | 227 | if (ELDBUS_INTROSPECTION_ARGUMENT_DIRECTION_IN != argument->direction) |
246 | { | 228 | { |
247 | Eina_Stringshare *property; | ||
248 | Eina_Bool ret; | 229 | Eina_Bool ret; |
249 | 230 | ||
250 | property = eina_array_data_get(pd->properties_array, i); | 231 | property = eina_stringshare_printf(ARGUMENT_FORMAT, i); |
251 | EINA_SAFETY_ON_NULL_GOTO(property, on_error); | ||
252 | 232 | ||
253 | ret = _eldbus_model_arguments_property_set(pd, value_struct, property); | 233 | ret = eina_array_push(changed_properties, property); |
254 | EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); | 234 | EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); |
255 | 235 | ||
256 | ret = eina_array_push(changed_properties, property); | 236 | ret = _eldbus_model_arguments_property_set(pd, value_struct, property); |
257 | EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); | 237 | EINA_SAFETY_ON_FALSE_GOTO(ret, on_error); |
258 | } | 238 | } |
259 | 239 | ||
@@ -269,6 +249,8 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd, | |||
269 | result = EINA_TRUE; | 249 | result = EINA_TRUE; |
270 | 250 | ||
271 | on_error: | 251 | on_error: |
252 | while (property = eina_array_pop(changed_properties)) | ||
253 | eina_stringshare_del(property); | ||
272 | eina_array_free(changed_properties); | 254 | eina_array_free(changed_properties); |
273 | eina_value_free(value_struct); | 255 | eina_value_free(value_struct); |
274 | 256 | ||
@@ -286,7 +268,7 @@ _eldbus_model_arguments_property_set(Eldbus_Model_Arguments_Data *pd, | |||
286 | 268 | ||
287 | _eldbus_model_arguments_properties_load(pd); | 269 | _eldbus_model_arguments_properties_load(pd); |
288 | 270 | ||
289 | prop_value = eina_hash_find(pd->properties_hash, property); | 271 | prop_value = eina_hash_find(pd->properties, property); |
290 | EINA_SAFETY_ON_NULL_RETURN_VAL(prop_value, EINA_FALSE); | 272 | EINA_SAFETY_ON_NULL_RETURN_VAL(prop_value, EINA_FALSE); |
291 | 273 | ||
292 | ret = eina_value_struct_value_get(value_struct, "arg0", &value); | 274 | ret = eina_value_struct_value_get(value_struct, "arg0", &value); |
@@ -311,7 +293,7 @@ _eldbus_model_arguments_is(Eldbus_Model_Arguments_Data *pd, | |||
311 | _eldbus_model_arguments_properties_load(pd); | 293 | _eldbus_model_arguments_properties_load(pd); |
312 | 294 | ||
313 | i = _eldbus_model_arguments_argument_index_get(pd, argument); | 295 | i = _eldbus_model_arguments_argument_index_get(pd, argument); |
314 | if (i >= eina_array_count(pd->properties_array)) | 296 | if (i >= eina_hash_population(pd->properties)) |
315 | { | 297 | { |
316 | WRN("Argument not found: %s", argument); | 298 | WRN("Argument not found: %s", argument); |
317 | return false; | 299 | return false; |
@@ -342,15 +324,10 @@ _eldbus_model_arguments_argument_index_get(Eldbus_Model_Arguments_Data *pd, cons | |||
342 | Eina_Stringshare *name; | 324 | Eina_Stringshare *name; |
343 | Eina_Array_Iterator it; | 325 | Eina_Array_Iterator it; |
344 | unsigned int i = 0; | 326 | unsigned int i = 0; |
345 | _eldbus_model_arguments_properties_load(pd); | ||
346 | |||
347 | EINA_ARRAY_ITER_NEXT(pd->properties_array, i, name, it) | ||
348 | { | ||
349 | if (strcmp(name, argument) == 0) | ||
350 | return i; | ||
351 | } | ||
352 | 327 | ||
353 | return ++i; | 328 | if (sscanf(argument, ARGUMENT_FORMAT, &i) > 0) |
329 | return i; | ||
330 | return eina_hash_population(pd->properties); | ||
354 | } | 331 | } |
355 | 332 | ||
356 | #include "eldbus_model_arguments.eo.c" | 333 | #include "eldbus_model_arguments.eo.c" |
diff --git a/src/lib/eldbus/eldbus_model_arguments_private.h b/src/lib/eldbus/eldbus_model_arguments_private.h index 06aa1aed9c..83d55dd643 100644 --- a/src/lib/eldbus/eldbus_model_arguments_private.h +++ b/src/lib/eldbus/eldbus_model_arguments_private.h | |||
@@ -14,8 +14,7 @@ struct _Eldbus_Model_Arguments_Data | |||
14 | { | 14 | { |
15 | Eo *obj; | 15 | Eo *obj; |
16 | Eldbus_Proxy *proxy; | 16 | Eldbus_Proxy *proxy; |
17 | Eina_Array *properties_array; | 17 | Eina_Hash *properties; |
18 | Eina_Hash *properties_hash; | ||
19 | Eina_Stringshare *name; | 18 | Eina_Stringshare *name; |
20 | Eina_List *pending_list; | 19 | Eina_List *pending_list; |
21 | const Eina_List *arguments; | 20 | const Eina_List *arguments; |
@@ -24,4 +23,6 @@ struct _Eldbus_Model_Arguments_Data | |||
24 | 23 | ||
25 | Eina_Bool eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *, const Eldbus_Message *, Eldbus_Pending *); | 24 | Eina_Bool eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *, const Eldbus_Message *, Eldbus_Pending *); |
26 | 25 | ||
26 | #define ARGUMENT_FORMAT "arg%u" | ||
27 | |||
27 | #endif | 28 | #endif |
diff --git a/src/lib/eldbus/eldbus_model_method.c b/src/lib/eldbus/eldbus_model_method.c index 8e7e87bf27..dbdbdde831 100644 --- a/src/lib/eldbus/eldbus_model_method.c +++ b/src/lib/eldbus/eldbus_model_method.c | |||
@@ -69,7 +69,7 @@ _eldbus_model_method_call(Eo *obj EINA_UNUSED, Eldbus_Model_Method_Data *pd EINA | |||
69 | 69 | ||
70 | EINA_LIST_FOREACH(data->arguments, it, argument) | 70 | EINA_LIST_FOREACH(data->arguments, it, argument) |
71 | { | 71 | { |
72 | Eina_Stringshare *name; | 72 | Eina_Slstr *name; |
73 | const Eina_Value *value; | 73 | const Eina_Value *value; |
74 | const char *signature; | 74 | const char *signature; |
75 | Eina_Bool ret; | 75 | Eina_Bool ret; |
@@ -77,11 +77,10 @@ _eldbus_model_method_call(Eo *obj EINA_UNUSED, Eldbus_Model_Method_Data *pd EINA | |||
77 | if (ELDBUS_INTROSPECTION_ARGUMENT_DIRECTION_IN != argument->direction) | 77 | if (ELDBUS_INTROSPECTION_ARGUMENT_DIRECTION_IN != argument->direction) |
78 | continue; | 78 | continue; |
79 | 79 | ||
80 | name = eina_array_data_get(data->properties_array, i); | 80 | name = eina_slstr_printf(ARGUMENT_FORMAT, i); |
81 | if (!name) continue; | ||
82 | EINA_SAFETY_ON_NULL_GOTO(name, on_error); | 81 | EINA_SAFETY_ON_NULL_GOTO(name, on_error); |
83 | 82 | ||
84 | value = eina_hash_find(data->properties_hash, name); | 83 | value = eina_hash_find(data->properties, name); |
85 | EINA_SAFETY_ON_NULL_GOTO(value, on_error); | 84 | EINA_SAFETY_ON_NULL_GOTO(value, on_error); |
86 | 85 | ||
87 | signature = argument->type; | 86 | signature = argument->type; |
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c index c1ab3b2565..a159ecd16b 100644 --- a/src/lib/eldbus/eldbus_model_proxy.c +++ b/src/lib/eldbus/eldbus_model_proxy.c | |||
@@ -190,22 +190,11 @@ _eldbus_model_proxy_efl_object_destructor(Eo *obj, Eldbus_Model_Proxy_Data *pd) | |||
190 | efl_destructor(efl_super(obj, MY_CLASS)); | 190 | efl_destructor(efl_super(obj, MY_CLASS)); |
191 | } | 191 | } |
192 | 192 | ||
193 | static Eina_Array * | 193 | static Eina_Iterator * |
194 | _eldbus_model_proxy_efl_model_properties_get(const Eo *obj EINA_UNUSED, | 194 | _eldbus_model_proxy_efl_model_properties_get(const Eo *obj EINA_UNUSED, |
195 | Eldbus_Model_Proxy_Data *pd) | 195 | Eldbus_Model_Proxy_Data *pd) |
196 | { | 196 | { |
197 | Eina_Iterator *it; | 197 | return eina_hash_iterator_key_new(pd->properties); |
198 | Eina_Array *r; | ||
199 | Eina_Stringshare *property; | ||
200 | |||
201 | r = eina_array_new(4); | ||
202 | |||
203 | it = eina_hash_iterator_key_new(pd->properties); | ||
204 | EINA_ITERATOR_FOREACH(it, property) | ||
205 | eina_array_push(r, property); | ||
206 | eina_iterator_free(it); | ||
207 | |||
208 | return r; | ||
209 | } | 198 | } |
210 | 199 | ||
211 | #define PROPERTY_EXIST 1 | 200 | #define PROPERTY_EXIST 1 |
diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c index e76ce05067..e15081f4d5 100644 --- a/src/lib/elementary/efl_ui_list_view.c +++ b/src/lib/elementary/efl_ui_list_view.c | |||
@@ -141,25 +141,25 @@ _efl_ui_list_view_efl_ui_scrollable_interactive_viewport_geometry_get(const Eo * | |||
141 | static Eina_Bool | 141 | static Eina_Bool |
142 | _efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind) | 142 | _efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind) |
143 | { | 143 | { |
144 | const Eina_Array *properties; | 144 | Eina_Iterator *properties; |
145 | Eina_Array_Iterator iter_prop; | 145 | const char *property; |
146 | Eina_Stringshare *property; | ||
147 | Eina_Bool ret = EINA_FALSE; | 146 | Eina_Bool ret = EINA_FALSE; |
148 | unsigned i = 0; | ||
149 | 147 | ||
150 | EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE); | 148 | EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE); |
151 | EINA_SAFETY_ON_NULL_RETURN_VAL(propfind, EINA_FALSE); | 149 | EINA_SAFETY_ON_NULL_RETURN_VAL(propfind, EINA_FALSE); |
152 | 150 | ||
153 | properties = efl_model_properties_get(model); | 151 | properties = efl_model_properties_get(model); |
154 | 152 | EINA_ITERATOR_FOREACH(properties, property) | |
155 | EINA_ARRAY_ITER_NEXT(properties, i, property, iter_prop) | ||
156 | { | 153 | { |
157 | if (property == propfind) | 154 | if (property == propfind || |
155 | !strcmp(property, propfind)) | ||
158 | { | 156 | { |
159 | ret = EINA_TRUE; | 157 | ret = EINA_TRUE; |
160 | break; | 158 | break; |
161 | } | 159 | } |
162 | } | 160 | } |
161 | eina_iterator_free(properties); | ||
162 | |||
163 | return ret; | 163 | return ret; |
164 | } | 164 | } |
165 | 165 | ||