summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-16 21:50:37 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-16 22:01:07 -0300
commit8e4f383d61188020d5ceeee691fd7df761f10202 (patch)
treeb747603d70956b51d2ba719a3c4cfb710904bbb4 /src/lib/eldbus
parent52e2774523209655e868d1244f0e2dd3b2d44491 (diff)
efl: Move promise parameter to return in data model
Summary: Instead of: efl_model_property_get("name", &promise); now: promise = efl_model_property_get("name"); Reviewers: stefan_schmidt, cedric Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D4038
Diffstat (limited to 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_model_arguments.c37
-rw-r--r--src/lib/eldbus/eldbus_model_connection.c44
-rw-r--r--src/lib/eldbus/eldbus_model_object.c38
-rw-r--r--src/lib/eldbus/eldbus_model_private.h4
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c55
5 files changed, 100 insertions, 78 deletions
diff --git a/src/lib/eldbus/eldbus_model_arguments.c b/src/lib/eldbus/eldbus_model_arguments.c
index 05f3ce9eea..fd6cb7c539 100644
--- a/src/lib/eldbus/eldbus_model_arguments.c
+++ b/src/lib/eldbus/eldbus_model_arguments.c
@@ -123,17 +123,17 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj EINA_UNUSED,
123 Eina_Value *prop_value; 123 Eina_Value *prop_value;
124 Eina_Value *promise_value; 124 Eina_Value *promise_value;
125 125
126 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 126 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE, );
127 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 127 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_INCORRECT_VALUE, );
128 DBG("(%p): property=%s", obj, property); 128 DBG("(%p): property=%s", obj, property);
129 129
130 _eldbus_model_arguments_properties_load(pd); 130 _eldbus_model_arguments_properties_load(pd);
131 131
132 Eina_Bool ret = _eldbus_model_arguments_is_input_argument(pd, property); 132 Eina_Bool ret = _eldbus_model_arguments_is_input_argument(pd, property);
133 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY); 133 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY, );
134 134
135 prop_value = eina_hash_find(pd->properties_hash, property); 135 prop_value = eina_hash_find(pd->properties_hash, property);
136 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(prop_value, promise, EFL_MODEL_ERROR_NOT_FOUND); 136 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(prop_value, promise, EFL_MODEL_ERROR_NOT_FOUND, );
137 137
138 eina_value_flush(prop_value); 138 eina_value_flush(prop_value);
139 eina_value_copy(value, prop_value); 139 eina_value_copy(value, prop_value);
@@ -143,29 +143,30 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj EINA_UNUSED,
143 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free); 143 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
144} 144}
145 145
146static void 146static Eina_Promise*
147_eldbus_model_arguments_efl_model_property_get(Eo *obj EINA_UNUSED, 147_eldbus_model_arguments_efl_model_property_get(Eo *obj EINA_UNUSED,
148 Eldbus_Model_Arguments_Data *pd, 148 Eldbus_Model_Arguments_Data *pd,
149 const char *property, 149 const char *property)
150 Eina_Promise_Owner *promise)
151{ 150{
151 Eina_Promise_Owner *promise = eina_promise_add();
152 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
152 Eina_Value *promise_value; 153 Eina_Value *promise_value;
153 EINA_SAFETY_ON_NULL_RETURN(promise);
154 154
155 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 155 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE, rpromise);
156 DBG("(%p): property=%s", obj, property); 156 DBG("(%p): property=%s", obj, property);
157 157
158 _eldbus_model_arguments_properties_load(pd); 158 _eldbus_model_arguments_properties_load(pd);
159 159
160 Eina_Value* value = eina_hash_find(pd->properties_hash, property); 160 Eina_Value* value = eina_hash_find(pd->properties_hash, property);
161 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_NOT_FOUND); 161 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
162 162
163 Eina_Bool ret = _eldbus_model_arguments_is_output_argument(pd, property); 163 Eina_Bool ret = _eldbus_model_arguments_is_output_argument(pd, property);
164 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_PERMISSION_DENIED); 164 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_PERMISSION_DENIED, rpromise);
165 165
166 promise_value = eina_value_new(eina_value_type_get(value)); 166 promise_value = eina_value_new(eina_value_type_get(value));
167 eina_value_copy(value, promise_value); 167 eina_value_copy(value, promise_value);
168 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free); 168 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
169 return rpromise;
169} 170}
170 171
171static Eo * 172static Eo *
@@ -181,24 +182,26 @@ _eldbus_model_arguments_efl_model_child_del(Eo *obj EINA_UNUSED,
181{ 182{
182} 183}
183 184
184static void 185static Eina_Promise*
185_eldbus_model_arguments_efl_model_children_slice_get(Eo *obj EINA_UNUSED, 186_eldbus_model_arguments_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
186 Eldbus_Model_Arguments_Data *pd EINA_UNUSED, 187 Eldbus_Model_Arguments_Data *pd EINA_UNUSED,
187 unsigned start EINA_UNUSED, 188 unsigned start EINA_UNUSED,
188 unsigned count EINA_UNUSED, 189 unsigned count EINA_UNUSED)
189 Eina_Promise_Owner *promise)
190{ 190{
191 Eina_Promise_Owner *promise = eina_promise_add();
191 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_NOT_SUPPORTED); 192 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_NOT_SUPPORTED);
193 return eina_promise_owner_promise_get(promise);
192} 194}
193 195
194static void 196static Eina_Promise*
195_eldbus_model_arguments_efl_model_children_count_get(Eo *obj EINA_UNUSED, 197_eldbus_model_arguments_efl_model_children_count_get(Eo *obj EINA_UNUSED,
196 Eldbus_Model_Arguments_Data *pd EINA_UNUSED, 198 Eldbus_Model_Arguments_Data *pd EINA_UNUSED)
197 Eina_Promise_Owner *promise)
198{ 199{
200 Eina_Promise_Owner *promise = eina_promise_add();
199 unsigned *count = malloc(sizeof(unsigned)); 201 unsigned *count = malloc(sizeof(unsigned));
200 *count = 0; 202 *count = 0;
201 eina_promise_owner_value_set(promise, count, free); 203 eina_promise_owner_value_set(promise, count, free);
204 return eina_promise_owner_promise_get(promise);
202} 205}
203 206
204static const char * 207static const char *
diff --git a/src/lib/eldbus/eldbus_model_connection.c b/src/lib/eldbus/eldbus_model_connection.c
index e29eeb5116..d0ba9394a7 100644
--- a/src/lib/eldbus/eldbus_model_connection.c
+++ b/src/lib/eldbus/eldbus_model_connection.c
@@ -87,36 +87,38 @@ _eldbus_model_connection_efl_model_property_set(Eo *obj EINA_UNUSED,
87 Eina_Value const* value EINA_UNUSED, 87 Eina_Value const* value EINA_UNUSED,
88 Eina_Promise_Owner *promise) 88 Eina_Promise_Owner *promise)
89{ 89{
90 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND); 90 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND, );
91 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_READ_ONLY); 91 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_READ_ONLY);
92} 92}
93 93
94static void 94static Eina_Promise*
95_eldbus_model_connection_efl_model_property_get(Eo *obj EINA_UNUSED, 95_eldbus_model_connection_efl_model_property_get(Eo *obj EINA_UNUSED,
96 Eldbus_Model_Connection_Data *pd, 96 Eldbus_Model_Connection_Data *pd,
97 const char *property, 97 const char *property)
98 Eina_Promise_Owner *promise)
99{ 98{
100 EINA_SAFETY_ON_NULL_RETURN(promise); 99 Eina_Promise_Owner *promise = eina_promise_add();
100 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
101
101 DBG("(%p): property=%s", obj, property); 102 DBG("(%p): property=%s", obj, property);
102 103
103 if (!pd->connection) 104 if (!pd->connection)
104 _eldbus_model_connection_connect(pd); 105 _eldbus_model_connection_connect(pd);
105 106
106 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND); 107 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
107 108
108 if (pd->unique_name == NULL) 109 if (pd->unique_name == NULL)
109 { 110 {
110 const char *unique_name; 111 const char *unique_name;
111 112
112 unique_name = eldbus_connection_unique_name_get(pd->connection); 113 unique_name = eldbus_connection_unique_name_get(pd->connection);
113 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(unique_name, promise, EFL_MODEL_ERROR_NOT_FOUND); 114 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(unique_name, promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
114 pd->unique_name = strdup(unique_name); 115 pd->unique_name = strdup(unique_name);
115 } 116 }
116 117
117 Eina_Value* v = eina_value_new(EINA_VALUE_TYPE_STRING); 118 Eina_Value* v = eina_value_new(EINA_VALUE_TYPE_STRING);
118 eina_value_set(v, pd->unique_name); 119 eina_value_set(v, pd->unique_name);
119 eina_promise_owner_value_set(promise, v, (Eina_Promise_Free_Cb)&eina_value_free); 120 eina_promise_owner_value_set(promise, v, (Eina_Promise_Free_Cb)&eina_value_free);
121 return rpromise;
120} 122}
121 123
122static Eo * 124static Eo *
@@ -132,16 +134,20 @@ _eldbus_model_connection_efl_model_child_del(Eo *obj EINA_UNUSED,
132{ 134{
133} 135}
134 136
135static void 137static Eina_Promise*
136_eldbus_model_connection_efl_model_children_slice_get(Eo *obj EINA_UNUSED, 138_eldbus_model_connection_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
137 Eldbus_Model_Connection_Data *pd, 139 Eldbus_Model_Connection_Data *pd,
138 unsigned start, 140 unsigned int start,
139 unsigned count, 141 unsigned int count)
140 Eina_Promise_Owner *promise)
141{ 142{
143 Eina_Promise_Owner *promise;
144 Eina_Promise *rpromise;
142 _Eldbus_Children_Slice_Promise* data; 145 _Eldbus_Children_Slice_Promise* data;
143 Eldbus_Pending *pending; 146 Eldbus_Pending *pending;
144 147
148 promise = eina_promise_add();
149 rpromise = eina_promise_owner_promise_get(promise);
150
145 if (!pd->connection) 151 if (!pd->connection)
146 _eldbus_model_connection_connect(pd); 152 _eldbus_model_connection_connect(pd);
147 153
@@ -149,11 +155,11 @@ _eldbus_model_connection_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
149 { 155 {
150 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count); 156 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count);
151 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free); 157 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
152 return; 158 return eina_promise_owner_promise_get(promise);
153 } 159 }
154 160
155 data = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise)); 161 data = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise));
156 EINA_SAFETY_ON_NULL_RETURN(data); 162 EINA_SAFETY_ON_NULL_RETURN_VAL(data, rpromise);
157 data->promise = promise; 163 data->promise = promise;
158 data->start = start; 164 data->start = start;
159 data->count = count; 165 data->count = count;
@@ -165,14 +171,17 @@ _eldbus_model_connection_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
165 pending = eldbus_names_list(pd->connection, &_eldbus_model_connection_names_list_cb, pd); 171 pending = eldbus_names_list(pd->connection, &_eldbus_model_connection_names_list_cb, pd);
166 pd->pending_list = eina_list_append(pd->pending_list, pending); 172 pd->pending_list = eina_list_append(pd->pending_list, pending);
167 } 173 }
174 return rpromise;
168} 175}
169 176
170static void 177static Eina_Promise*
171_eldbus_model_connection_efl_model_children_count_get(Eo *obj EINA_UNUSED, 178_eldbus_model_connection_efl_model_children_count_get(Eo *obj EINA_UNUSED,
172 Eldbus_Model_Connection_Data *pd, 179 Eldbus_Model_Connection_Data *pd)
173 Eina_Promise_Owner *promise)
174{ 180{
181 Eina_Promise_Owner *promise;
175 Eldbus_Pending *pending; 182 Eldbus_Pending *pending;
183
184 promise = eina_promise_add();
176 if (!pd->connection) 185 if (!pd->connection)
177 _eldbus_model_connection_connect(pd); 186 _eldbus_model_connection_connect(pd);
178 187
@@ -181,7 +190,7 @@ _eldbus_model_connection_efl_model_children_count_get(Eo *obj EINA_UNUSED,
181 unsigned int *c = calloc(sizeof(unsigned int), 1); 190 unsigned int *c = calloc(sizeof(unsigned int), 1);
182 *c = eina_list_count(pd->children_list); 191 *c = eina_list_count(pd->children_list);
183 eina_promise_owner_value_set(promise, c, free); 192 eina_promise_owner_value_set(promise, c, free);
184 return; 193 return eina_promise_owner_promise_get(promise);
185 } 194 }
186 195
187 pd->count_promises = eina_list_prepend(pd->count_promises, promise); 196 pd->count_promises = eina_list_prepend(pd->count_promises, promise);
@@ -190,6 +199,7 @@ _eldbus_model_connection_efl_model_children_count_get(Eo *obj EINA_UNUSED,
190 pending = eldbus_names_list(pd->connection, &_eldbus_model_connection_names_list_cb, pd); 199 pending = eldbus_names_list(pd->connection, &_eldbus_model_connection_names_list_cb, pd);
191 pd->pending_list = eina_list_append(pd->pending_list, pending); 200 pd->pending_list = eina_list_append(pd->pending_list, pending);
192 } 201 }
202 return eina_promise_owner_promise_get(promise);
193} 203}
194 204
195static const char * 205static const char *
diff --git a/src/lib/eldbus/eldbus_model_object.c b/src/lib/eldbus/eldbus_model_object.c
index d3cd86a0f6..ba6530b15f 100644
--- a/src/lib/eldbus/eldbus_model_object.c
+++ b/src/lib/eldbus/eldbus_model_object.c
@@ -120,38 +120,39 @@ _eldbus_model_object_efl_model_property_set(Eo *obj EINA_UNUSED,
120 const Eina_Value *value EINA_UNUSED, 120 const Eina_Value *value EINA_UNUSED,
121 Eina_Promise_Owner *promise) 121 Eina_Promise_Owner *promise)
122{ 122{
123 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND); 123 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND, );
124 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_READ_ONLY); 124 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_READ_ONLY);
125} 125}
126 126
127static void 127static Eina_Promise*
128_eldbus_model_object_efl_model_property_get(Eo *obj EINA_UNUSED, 128_eldbus_model_object_efl_model_property_get(Eo *obj EINA_UNUSED,
129 Eldbus_Model_Object_Data *pd, 129 Eldbus_Model_Object_Data *pd,
130 const char *property, 130 const char *property)
131 Eina_Promise_Owner *promise)
132{ 131{
133 EINA_SAFETY_ON_NULL_RETURN(promise); 132 Eina_Promise_Owner *promise = eina_promise_add();
133 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
134 134
135 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 135 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE, rpromise);
136 DBG("(%p): property=%s", obj, property); 136 DBG("(%p): property=%s", obj, property);
137 137
138 if (!pd->connection) 138 if (!pd->connection)
139 _eldbus_model_object_connect(pd); 139 _eldbus_model_object_connect(pd);
140 140
141 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND); 141 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET((strcmp(property, UNIQUE_NAME_PROPERTY) == 0), promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
142 142
143 if (pd->unique_name == NULL) 143 if (pd->unique_name == NULL)
144 { 144 {
145 const char *unique_name; 145 const char *unique_name;
146 146
147 unique_name = eldbus_connection_unique_name_get(pd->connection); 147 unique_name = eldbus_connection_unique_name_get(pd->connection);
148 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(unique_name, promise, EFL_MODEL_ERROR_NOT_FOUND); 148 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(unique_name, promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
149 pd->unique_name = strdup(unique_name); 149 pd->unique_name = strdup(unique_name);
150 } 150 }
151 151
152 Eina_Value* v = eina_value_new(EINA_VALUE_TYPE_STRING); 152 Eina_Value* v = eina_value_new(EINA_VALUE_TYPE_STRING);
153 eina_value_set(v, pd->unique_name); 153 eina_value_set(v, pd->unique_name);
154 eina_promise_owner_value_set(promise, v, (Eina_Promise_Free_Cb)&eina_value_free); 154 eina_promise_owner_value_set(promise, v, (Eina_Promise_Free_Cb)&eina_value_free);
155 return eina_promise_owner_promise_get(promise);
155} 156}
156 157
157static Eo * 158static Eo *
@@ -167,14 +168,15 @@ _eldbus_model_object_efl_model_child_del(Eo *obj EINA_UNUSED,
167{ 168{
168} 169}
169 170
170static void 171static Eina_Promise*
171_eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED, 172_eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
172 Eldbus_Model_Object_Data *pd, 173 Eldbus_Model_Object_Data *pd,
173 unsigned start, 174 unsigned start,
174 unsigned count, 175 unsigned count)
175 Eina_Promise_Owner *promise)
176{ 176{
177 _Eldbus_Children_Slice_Promise* p; 177 _Eldbus_Children_Slice_Promise* p;
178 Eina_Promise_Owner *promise = eina_promise_add();
179 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
178 180
179 if (!pd->connection) 181 if (!pd->connection)
180 _eldbus_model_object_connect(pd); 182 _eldbus_model_object_connect(pd);
@@ -183,11 +185,11 @@ _eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
183 { 185 {
184 Eina_Accessor* ac = efl_model_list_slice(pd->children_list, start, count); 186 Eina_Accessor* ac = efl_model_list_slice(pd->children_list, start, count);
185 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free); 187 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
186 return; 188 return eina_promise_owner_promise_get(promise);
187 } 189 }
188 190
189 p = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise)); 191 p = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise));
190 EINA_SAFETY_ON_NULL_RETURN(p); 192 EINA_SAFETY_ON_NULL_RETURN_VAL(p, rpromise);
191 p->promise = promise; 193 p->promise = promise;
192 p->start = start; 194 p->start = start;
193 p->count = count; 195 p->count = count;
@@ -195,13 +197,14 @@ _eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
195 pd->children_promises = eina_list_prepend(pd->children_promises, p); 197 pd->children_promises = eina_list_prepend(pd->children_promises, p);
196 if (pd->pending_list == NULL) 198 if (pd->pending_list == NULL)
197 _eldbus_model_object_introspect(pd, pd->bus, pd->path); 199 _eldbus_model_object_introspect(pd, pd->bus, pd->path);
200 return rpromise;
198} 201}
199 202
200static void 203static Eina_Promise*
201_eldbus_model_object_efl_model_children_count_get(Eo *obj EINA_UNUSED, 204_eldbus_model_object_efl_model_children_count_get(Eo *obj EINA_UNUSED,
202 Eldbus_Model_Object_Data *pd, 205 Eldbus_Model_Object_Data *pd)
203 Eina_Promise_Owner *promise)
204{ 206{
207 Eina_Promise_Owner *promise = eina_promise_add();
205 if (!pd->connection) 208 if (!pd->connection)
206 _eldbus_model_object_connect(pd); 209 _eldbus_model_object_connect(pd);
207 210
@@ -210,12 +213,13 @@ _eldbus_model_object_efl_model_children_count_get(Eo *obj EINA_UNUSED,
210 unsigned int *c = calloc(sizeof(unsigned int), 1); 213 unsigned int *c = calloc(sizeof(unsigned int), 1);
211 *c = eina_list_count(pd->children_list); 214 *c = eina_list_count(pd->children_list);
212 eina_promise_owner_value_set(promise, c, free); 215 eina_promise_owner_value_set(promise, c, free);
213 return; 216 return eina_promise_owner_promise_get(promise);
214 } 217 }
215 218
216 pd->count_promises = eina_list_prepend(pd->count_promises, promise); 219 pd->count_promises = eina_list_prepend(pd->count_promises, promise);
217 if (pd->pending_list == NULL) 220 if (pd->pending_list == NULL)
218 _eldbus_model_object_introspect(pd, pd->bus, pd->path); 221 _eldbus_model_object_introspect(pd, pd->bus, pd->path);
222 return eina_promise_owner_promise_get(promise);
219} 223}
220 224
221static const char * 225static const char *
diff --git a/src/lib/eldbus/eldbus_model_private.h b/src/lib/eldbus/eldbus_model_private.h
index eed5deb234..b4fb49b5ba 100644
--- a/src/lib/eldbus/eldbus_model_private.h
+++ b/src/lib/eldbus/eldbus_model_private.h
@@ -26,13 +26,13 @@ struct _Eldbus_Property_Promise
26/* logging support */ 26/* logging support */
27extern int eldbus_model_log_dom; 27extern int eldbus_model_log_dom;
28 28
29#define ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(exp, promise, err) \ 29#define ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(exp, promise, err, v) \
30 do \ 30 do \
31 { \ 31 { \
32 if (EINA_UNLIKELY(!(exp))) \ 32 if (EINA_UNLIKELY(!(exp))) \
33 { \ 33 { \
34 eina_promise_owner_error_set(promise, err); \ 34 eina_promise_owner_error_set(promise, err); \
35 return; \ 35 return v; \
36 } \ 36 } \
37 } \ 37 } \
38 while(0) 38 while(0)
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index 1c75a8f7a1..43a3779cef 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -116,23 +116,23 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
116 Eldbus_Pending *pending; 116 Eldbus_Pending *pending;
117 Eina_Bool ret; 117 Eina_Bool ret;
118 118
119 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 119 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE, );
120 120
121 DBG("(%p): property=%s", obj, property); 121 DBG("(%p): property=%s", obj, property);
122 ret = _eldbus_model_proxy_load(pd); 122 ret = _eldbus_model_proxy_load(pd);
123 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED); 123 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED, );
124 124
125 ret = _eldbus_model_proxy_has_property(pd, property); 125 ret = _eldbus_model_proxy_has_property(pd, property);
126 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_NOT_FOUND); 126 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_NOT_FOUND, );
127 127
128 ret = _eldbus_model_proxy_is_property_writeable(pd, property); 128 ret = _eldbus_model_proxy_is_property_writeable(pd, property);
129 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY); 129 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY, );
130 130
131 signature = _eldbus_model_proxy_property_type_get(pd, property); 131 signature = _eldbus_model_proxy_property_type_get(pd, property);
132 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(signature, promise, EFL_MODEL_ERROR_UNKNOWN); 132 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(signature, promise, EFL_MODEL_ERROR_UNKNOWN, );
133 133
134 data = _eldbus_model_proxy_property_set_data_new(pd, property, value, promise); 134 data = _eldbus_model_proxy_property_set_data_new(pd, property, value, promise);
135 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(data, promise, EFL_MODEL_ERROR_UNKNOWN); 135 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(data, promise, EFL_MODEL_ERROR_UNKNOWN, );
136 136
137 if (!pd->is_loaded) 137 if (!pd->is_loaded)
138 { 138 {
@@ -156,29 +156,29 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
156 pd->pending_list = eina_list_append(pd->pending_list, pending); 156 pd->pending_list = eina_list_append(pd->pending_list, pending);
157} 157}
158 158
159static void 159static Eina_Promise*
160_eldbus_model_proxy_efl_model_property_get(Eo *obj EINA_UNUSED, 160_eldbus_model_proxy_efl_model_property_get(Eo *obj EINA_UNUSED,
161 Eldbus_Model_Proxy_Data *pd, 161 Eldbus_Model_Proxy_Data *pd,
162 const char *property, 162 const char *property)
163 Eina_Promise_Owner *promise)
164{ 163{
165 Eina_Bool ret; 164 Eina_Bool ret;
166 Eina_Value *promise_value; 165 Eina_Value *promise_value;
167 EINA_SAFETY_ON_NULL_RETURN(promise); 166 Eina_Promise_Owner *promise = eina_promise_add();
167 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
168 168
169 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 169 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE, rpromise);
170 170
171 ret = _eldbus_model_proxy_load(pd); 171 ret = _eldbus_model_proxy_load(pd);
172 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED); 172 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED, rpromise);
173 173
174 ret = _eldbus_model_proxy_has_property(pd, property); 174 ret = _eldbus_model_proxy_has_property(pd, property);
175 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_NOT_FOUND); 175 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
176 176
177 if (!pd->is_loaded) 177 if (!pd->is_loaded)
178 { 178 {
179 Eldbus_Pending *pending; 179 Eldbus_Pending *pending;
180 _Eldbus_Property_Promise *p = calloc(1, sizeof(_Eldbus_Property_Promise)); 180 _Eldbus_Property_Promise *p = calloc(1, sizeof(_Eldbus_Property_Promise));
181 EINA_SAFETY_ON_NULL_RETURN(p); 181 EINA_SAFETY_ON_NULL_RETURN_VAL(p, rpromise);
182 182
183 p->promise = promise; 183 p->promise = promise;
184 p->property = strdup(property); 184 p->property = strdup(property);
@@ -189,18 +189,19 @@ _eldbus_model_proxy_efl_model_property_get(Eo *obj EINA_UNUSED,
189 pending = eldbus_proxy_property_get_all(pd->proxy, _eldbus_model_proxy_property_get_all_cb, pd); 189 pending = eldbus_proxy_property_get_all(pd->proxy, _eldbus_model_proxy_property_get_all_cb, pd);
190 pd->pending_list = eina_list_append(pd->pending_list, pending); 190 pd->pending_list = eina_list_append(pd->pending_list, pending);
191 } 191 }
192 return; 192 return rpromise;
193 } 193 }
194 194
195 Eina_Value* value = eina_hash_find(pd->properties_hash, property); 195 Eina_Value* value = eina_hash_find(pd->properties_hash, property);
196 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_NOT_FOUND); 196 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_NOT_FOUND, rpromise);
197 197
198 ret = _eldbus_model_proxy_is_property_writeable(pd, property); 198 ret = _eldbus_model_proxy_is_property_writeable(pd, property);
199 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY); 199 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY, rpromise);
200 200
201 promise_value = eina_value_new(eina_value_type_get(value)); 201 promise_value = eina_value_new(eina_value_type_get(value));
202 eina_value_copy(value, promise_value); 202 eina_value_copy(value, promise_value);
203 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free); 203 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
204 return rpromise;
204} 205}
205 206
206static Eo * 207static Eo *
@@ -217,15 +218,16 @@ _eldbus_model_proxy_efl_model_child_del(Eo *obj EINA_UNUSED,
217{ 218{
218} 219}
219 220
220static void 221static Eina_Promise*
221_eldbus_model_proxy_efl_model_children_slice_get(Eo *obj EINA_UNUSED, 222_eldbus_model_proxy_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
222 Eldbus_Model_Proxy_Data *pd, 223 Eldbus_Model_Proxy_Data *pd,
223 unsigned start, 224 unsigned start,
224 unsigned count, 225 unsigned count)
225 Eina_Promise_Owner *promise)
226{ 226{
227 Eina_Bool ret = _eldbus_model_proxy_load(pd); 227 Eina_Bool ret = _eldbus_model_proxy_load(pd);
228 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED); 228 Eina_Promise_Owner *promise = eina_promise_add();
229 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
230 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED, rpromise);
229 231
230 if (!pd->is_listed) 232 if (!pd->is_listed)
231 { 233 {
@@ -236,15 +238,17 @@ _eldbus_model_proxy_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
236 238
237 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count); 239 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count);
238 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free); 240 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
241 return rpromise;
239} 242}
240 243
241static void 244static Eina_Promise*
242_eldbus_model_proxy_efl_model_children_count_get(Eo *obj EINA_UNUSED, 245_eldbus_model_proxy_efl_model_children_count_get(Eo *obj EINA_UNUSED,
243 Eldbus_Model_Proxy_Data *pd, 246 Eldbus_Model_Proxy_Data *pd)
244 Eina_Promise_Owner *promise)
245{ 247{
246 Eina_Bool ret = _eldbus_model_proxy_load(pd); 248 Eina_Bool ret = _eldbus_model_proxy_load(pd);
247 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED); 249 Eina_Promise_Owner *promise = eina_promise_add();
250 Eina_Promise *rpromise = eina_promise_owner_promise_get(promise);
251 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_INIT_FAILED, rpromise);
248 252
249 if (!pd->is_listed) 253 if (!pd->is_listed)
250 { 254 {
@@ -256,6 +260,7 @@ _eldbus_model_proxy_efl_model_children_count_get(Eo *obj EINA_UNUSED,
256 unsigned int *c = calloc(sizeof(unsigned int), 1); 260 unsigned int *c = calloc(sizeof(unsigned int), 1);
257 *c = eina_list_count(pd->children_list); 261 *c = eina_list_count(pd->children_list);
258 eina_promise_owner_value_set(promise, c, free); 262 eina_promise_owner_value_set(promise, c, free);
263 return eina_promise_owner_promise_get(promise);
259} 264}
260 265
261static void 266static void