summaryrefslogtreecommitdiff
path: root/legacy/edbus/src/examples/complex_types_client_eina_value.c
diff options
context:
space:
mode:
authorJosé Roberto de Souza <zehortigoza@profusion.mobi>2012-12-11 19:51:12 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-12-11 19:51:12 +0000
commit2391dcf48191cac20fd338715b45edf2b67cbf0c (patch)
tree642880cc8a76792133347e6ef2dd24db102fd72c /legacy/edbus/src/examples/complex_types_client_eina_value.c
parent3a4cbf1e4ca7a320524160ef3b8bfb78fdf801cb (diff)
edbus: Add example for reading str array inside a variant using eina_value
Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 80700
Diffstat (limited to '')
-rw-r--r--legacy/edbus/src/examples/complex_types_client_eina_value.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/legacy/edbus/src/examples/complex_types_client_eina_value.c b/legacy/edbus/src/examples/complex_types_client_eina_value.c
index 10e8f72663..5f7fa48313 100644
--- a/legacy/edbus/src/examples/complex_types_client_eina_value.c
+++ b/legacy/edbus/src/examples/complex_types_client_eina_value.c
@@ -148,6 +148,35 @@ on_plus_one(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
148} 148}
149 149
150static void 150static void
151receive_variant_cb(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
152{
153 Eina_Value *v, variant, array;
154 unsigned i;
155
156 printf("4 - receive a variant with an array of strings\n");
157 if (edbus_message_error_get(msg, NULL, NULL))
158 {
159 printf("Message error\n\n");
160 return;
161 }
162
163 v = edbus_message_to_eina_value(msg);
164
165 eina_value_struct_value_get(v, "arg0", &variant);
166 eina_value_struct_value_get(&variant, "arg0", &array);
167 for (i = 0; i < eina_value_array_count(&array); i++)
168 {
169 const char *txt;
170 eina_value_array_get(&array, i, &txt);
171 printf("\t%s\n", txt);
172 }
173
174 eina_value_flush(&array);
175 eina_value_flush(&variant);
176 eina_value_free(v);
177}
178
179static void
151_property_removed(void *data, EDBus_Proxy *proxy, void *event_info) 180_property_removed(void *data, EDBus_Proxy *proxy, void *event_info)
152{ 181{
153 EDBus_Proxy_Event_Property_Removed *event = event_info; 182 EDBus_Proxy_Event_Property_Removed *event = event_info;
@@ -280,6 +309,8 @@ main(void)
280 edbus_proxy_properties_monitor(proxy, EINA_TRUE); 309 edbus_proxy_properties_monitor(proxy, EINA_TRUE);
281 ecore_timer_add(10, _read_cache, proxy); 310 ecore_timer_add(10, _read_cache, proxy);
282 311
312 edbus_proxy_call(proxy, "ReceiveVariantData", receive_variant_cb, NULL, -1, "");
313
283 ecore_main_loop_begin(); 314 ecore_main_loop_begin();
284 315
285 edbus_proxy_event_callback_del(proxy, EDBUS_PROXY_EVENT_PROPERTY_CHANGED, 316 edbus_proxy_event_callback_del(proxy, EDBUS_PROXY_EVENT_PROPERTY_CHANGED,