summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-29 12:55:21 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-29 12:55:37 +0200
commit34acf3f09f00cb3b299a6753fb1e3c57eff4473b (patch)
treeea15aa436ce9c57caba6110e2f5a0be866f5ac7f
parent65bfc92ad68d45927abef9a6b7f1bc6ae76c8da8 (diff)
atspi: add org.a11y.atspi.Application interface to root object
-rw-r--r--src/lib/elm_atspi_bridge.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index 44362c573..9a5c9cb14 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -74,6 +74,7 @@ typedef struct _Elm_Atspi_Bridge_Data
74 Ecore_Event_Filter *key_flr; 74 Ecore_Event_Filter *key_flr;
75 Eldbus_Object *bus_obj; 75 Eldbus_Object *bus_obj;
76 Eina_List *pending_requests; 76 Eina_List *pending_requests;
77 int id;
77 78
78 Eina_Bool connected : 1; 79 Eina_Bool connected : 1;
79} Elm_Atspi_Bridge_Data; 80} Elm_Atspi_Bridge_Data;
@@ -2201,6 +2202,63 @@ _text_properties_get(const Eldbus_Service_Interface *interface, const char *prop
2201 return EINA_FALSE; 2202 return EINA_FALSE;
2202} 2203}
2203 2204
2205static Eldbus_Message*
2206_application_properties_set(const Eldbus_Service_Interface *iface, const char *property, Eldbus_Message_Iter *iter, const Eldbus_Message *input_msg)
2207{
2208 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2209 int value;
2210
2211 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, NULL);
2212
2213 if (!eldbus_message_iter_arguments_get(iter, "i", &value))
2214 {
2215 return eldbus_message_error_new(input_msg, "org.freedesktop.DBus.Error.InvalidArgs", "Expected value of type: int.");
2216 }
2217
2218 if (!strcmp(property, "Id"))
2219 {
2220 pd->id = value;
2221 Eldbus_Message *answer = eldbus_message_method_return_new(input_msg);
2222 eldbus_message_arguments_append(answer, "b", EINA_TRUE);
2223 eldbus_service_property_changed(iface, "Id");
2224 return answer;
2225 }
2226
2227 return NULL;
2228}
2229
2230static Eina_Bool
2231_application_properties_get(const Eldbus_Service_Interface *interface, const char *property,
2232 Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED,
2233 Eldbus_Message **error EINA_UNUSED)
2234{
2235 const char *obj_path = eldbus_service_object_path_get(interface);
2236 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2237 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2238
2239 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2240 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_FALSE);
2241
2242 if (!strcmp(property, "ToolkitName"))
2243 {
2244 eldbus_message_iter_basic_append(iter, 's', "elementary");
2245 return EINA_TRUE;
2246 }
2247 if (!strcmp(property, "Version"))
2248 {
2249 char buf[64];
2250 snprintf(buf, sizeof(buf), "%d.%d", ELM_VERSION_MAJOR, ELM_VERSION_MINOR);
2251 eldbus_message_iter_basic_append(iter, 's', buf);
2252 return EINA_TRUE;
2253 }
2254 if (!strcmp(property, "Id"))
2255 {
2256 eldbus_message_iter_basic_append(iter, 'i', pd->id);
2257 return EINA_TRUE;
2258 }
2259 return EINA_FALSE;
2260}
2261
2204static const Eldbus_Property accessible_properties[] = { 2262static const Eldbus_Property accessible_properties[] = {
2205 { "Name", "s", NULL, NULL, 0 }, 2263 { "Name", "s", NULL, NULL, 0 },
2206 { "Description", "s", NULL, NULL, 0 }, 2264 { "Description", "s", NULL, NULL, 0 },
@@ -2239,6 +2297,13 @@ static const Eldbus_Property text_properties[] = {
2239 { NULL, NULL, NULL, NULL, 0 } 2297 { NULL, NULL, NULL, NULL, 0 }
2240}; 2298};
2241 2299
2300static const Eldbus_Property application_properties[] = {
2301 { "ToolkitName", "s", NULL, NULL, 0 },
2302 { "Version", "s", NULL, NULL, 0 },
2303 { "Id", "i", NULL, NULL, 0 },
2304 { NULL, NULL, NULL, NULL, 0 }
2305};
2306
2242static const Eldbus_Service_Interface_Desc accessible_iface_desc = { 2307static const Eldbus_Service_Interface_Desc accessible_iface_desc = {
2243 ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, _event_obj_signals, accessible_properties, _accessible_property_get, NULL 2308 ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, _event_obj_signals, accessible_properties, _accessible_property_get, NULL
2244}; 2309};
@@ -2275,6 +2340,10 @@ static const Eldbus_Service_Interface_Desc editable_text_iface_desc = {
2275 ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, editable_text_methods, NULL, NULL, NULL, NULL 2340 ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, editable_text_methods, NULL, NULL, NULL, NULL
2276}; 2341};
2277 2342
2343static const Eldbus_Service_Interface_Desc application_iface_desc = {
2344 ATSPI_DBUS_INTERFACE_APPLICATION, NULL, NULL, application_properties, _application_properties_get, _application_properties_set
2345};
2346
2278static void 2347static void
2279_bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, const Eo *obj) 2348_bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, const Eo *obj)
2280{ 2349{
@@ -3528,6 +3597,13 @@ static void _bridge_object_register(Eo *bridge, Eo *obj)
3528 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge); 3597 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3529 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN), ifc)); 3598 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN), ifc));
3530 3599
3600 if (eo_isa(obj, ELM_ATSPI_APP_OBJECT_CLASS))
3601 {
3602 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &application_iface_desc);
3603 eo_key_data_set(ATSPI_DBUS_INTERFACE_APPLICATION, ifc);
3604 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3605 }
3606
3531 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &event_iface_desc); 3607 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &event_iface_desc);
3532 eo_do(obj, 3608 eo_do(obj,
3533 eo_event_callback_array_add(_events_cb(), bridge), 3609 eo_event_callback_array_add(_events_cb(), bridge),
@@ -3629,6 +3705,8 @@ static void _object_unregister(Eo *obj, void *data)
3629 if (ifc) eldbus_service_interface_unregister(ifc); 3705 if (ifc) eldbus_service_interface_unregister(ifc);
3630 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_VALUE_INTERFACE))); 3706 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_VALUE_INTERFACE)));
3631 if (ifc) eldbus_service_interface_unregister(ifc); 3707 if (ifc) eldbus_service_interface_unregister(ifc);
3708 eo_do(obj, ifc = eo_key_data_get(ATSPI_DBUS_INTERFACE_APPLICATION));
3709 if (ifc) eldbus_service_interface_unregister(ifc);
3632} 3710}
3633 3711
3634void 3712void