summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2018-01-23 21:24:38 +0900
committerShinwoo Kim <cinoo.kim@samsung.com>2018-01-23 21:24:38 +0900
commitbf0e226c7eb01d7d2659ab2c06f503931b6a72b8 (patch)
treec5468ffa8884c73d8871cfe586e23cf2c4907ec0
parent5e532745a39101a20fa76116c17a4e3919089ce6 (diff)
Show accessible action information
-rw-r--r--atspi_viewer.c60
-rw-r--r--atspi_viewer.edc13
2 files changed, 71 insertions, 2 deletions
diff --git a/atspi_viewer.c b/atspi_viewer.c
index 0795d05..4a488f4 100644
--- a/atspi_viewer.c
+++ b/atspi_viewer.c
@@ -252,6 +252,39 @@ _highlight_show(AtspiRect *rect)
252} 252}
253 253
254static void 254static void
255_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
256{
257 const char *name;
258 AtspiAction *action;
259 AtspiAccessible *accessible = data;
260
261 name = elm_object_text_get(obj);
262 if (!name) return;
263
264 action = atspi_accessible_get_action_iface(accessible);
265 if (action)
266 {
267 int a;
268 int n_actions = atspi_action_get_n_actions(action, NULL);
269
270 for (a = 0; a < n_actions; a++)
271 {
272 char *action_name = atspi_action_get_action_name(action, a, NULL);
273 if (!action_name) return;
274
275 if (!strcmp(name, action_name))
276 {
277 atspi_action_do_action(action, a, NULL);
278 g_free(action_name);
279 break;
280 }
281 g_free(action_name);
282 }
283 g_object_unref(action);
284 }
285}
286
287static void
255gl4_sel(void *data EINA_UNUSED, Evas_Object *obj, void *event_info) 288gl4_sel(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
256{ 289{
257 Elm_Object_Item *glit = event_info; 290 Elm_Object_Item *glit = event_info;
@@ -322,6 +355,30 @@ gl4_sel(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
322 if (ifaces) 355 if (ifaces)
323 g_array_free(ifaces, FALSE); 356 g_array_free(ifaces, FALSE);
324 357
358 Evas_Object *hbx = elm_box_add(obj);
359 elm_box_horizontal_set(hbx, EINA_TRUE);
360
361 AtspiAction *action = NULL;
362 action = atspi_accessible_get_action_iface(accessible);
363 if (action)
364 {
365 snprintf(txt, sizeof(txt), "<br/>[Actions]<br/>");
366 eina_strbuf_append_length(buf, txt, strlen(txt));
367
368 int n_actions = atspi_action_get_n_actions(action, NULL);
369 for (a = 0; a < n_actions; a++)
370 {
371 char *action_name = atspi_action_get_action_name(action, a, NULL);
372 Evas_Object *bt = elm_button_add(obj);
373 elm_object_text_set(bt, action_name);
374 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, accessible);
375 evas_object_show(bt);
376 elm_box_pack_end(hbx, bt);
377 g_free(action_name);
378 }
379 g_object_unref(action);
380 }
381
325 char *ret = eina_strbuf_string_steal(buf); 382 char *ret = eina_strbuf_string_steal(buf);
326 eina_strbuf_free(buf); 383 eina_strbuf_free(buf);
327 Evas_Object *ly = evas_object_data_get(obj, "detail_view_layout"); 384 Evas_Object *ly = evas_object_data_get(obj, "detail_view_layout");
@@ -329,9 +386,8 @@ gl4_sel(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
329 elm_object_text_set(lb, ret); 386 elm_object_text_set(lb, ret);
330 free(ret); 387 free(ret);
331 388
332 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
333 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
334 elm_object_part_content_set(ly, "swallow.detail.label", lb); 389 elm_object_part_content_set(ly, "swallow.detail.label", lb);
390 elm_object_part_content_set(ly, "swallow.action.box", hbx);
335} 391}
336 392
337static void 393static void
diff --git a/atspi_viewer.edc b/atspi_viewer.edc
index 40f3c54..4a4fd7a 100644
--- a/atspi_viewer.edc
+++ b/atspi_viewer.edc
@@ -21,6 +21,19 @@ collections {
21 } 21 }
22 } 22 }
23 23
24 part { name: "swallow.action.box"; type: SWALLOW;
25 description { state: "default" 0.0;
26 rel1 {
27 to: "base";
28 relative: 0.01 0.5;
29 }
30 rel2 {
31 to: "base";
32 relative: 0.99 0.6;
33 }
34 }
35 }
36
24 } 37 }
25 } 38 }
26} 39}