Merge "Add atspi_accessible_get_default_label_info" into tizen_4.0 accepted/tizen/4.0/unified/20170929.075914 submit/tizen_4.0/20170928.043352 tizen_4.0.IoT.p1_release
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 27 Sep 2017 01:57:49 +0000 (01:57 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 27 Sep 2017 01:57:49 +0000 (01:57 +0000)
1  2 
atspi/atspi-accessible.c

diff --combined atspi/atspi-accessible.c
@@@ -346,12 -346,7 +346,12 @@@ atspi_accessible_get_navigable_at_poin
    g_return_val_if_fail (root != NULL, NULL);
    do {
      reply = _atspi_dbus_call_partial (root, atspi_interface_accessible, "GetNavigableAtPoint", error, "iiu", d_x, d_y, d_ctype);
 -
 +    // call failed, error is set, so we bail out
 +    if (!reply) {
 +      if (deputy) g_object_unref(deputy);
 +      if (return_value) g_object_unref(return_value);
 +      return NULL;
 +    }
      _ATSPI_DBUS_CHECK_SIG (reply, "(so)y(so)", NULL, NULL);
  
      dbus_message_iter_init (reply, &iter);
@@@ -565,6 -560,54 +565,54 @@@ atspi_accessible_get_reading_material (
    return reading_material;
  }
  
+ /**
+  * atspi_accessible_get_default_label_info:
+  * @obj: a pointer to the #AtspiAccessible object would be window.
+  *
+  * Gets default label information
+  *
+  * Returns: default label information to be used screen-reader side.
+  * This is not stable. And this depends on toolkit side UI definition.
+  * The candidate of default label object could be changed by UI definition.
+  * You have to handle all alocated memory as below on screen-reader side.
+  *
+  * AtspiAccessibleDefaultLabelInfo *dli
+  * g_object_unref(dli->obj);
+  * free(dli);
+  **/
+ AtspiAccessibleDefaultLabelInfo *
+ atspi_accessible_get_default_label_info (AtspiAccessible *obj, GError **error)
+ {
+   AtspiAccessibleDefaultLabelInfo *default_label_info = NULL;
+   AtspiAccessible *default_label_object;
+   dbus_uint32_t role;
+   DBusMessage *reply;
+   DBusMessageIter iter;
+   g_return_val_if_fail (obj != NULL, NULL);
+   reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, "GetDefaultLabelInfo", error, "");
+   _ATSPI_DBUS_CHECK_SIG (reply, "(so)u", NULL, NULL);
+   default_label_info = calloc(1, sizeof(AtspiAccessibleDefaultLabelInfo));
+   if (!default_label_info)
+   {
+     return default_label_info;
+   }
+   dbus_message_iter_init (reply, &iter);
+   default_label_object =  _atspi_dbus_return_accessible_from_iter (&iter);
+   default_label_info->obj = default_label_object;
+   dbus_message_iter_get_basic (&iter, &role);
+   default_label_info->role = role;
+   dbus_message_iter_next (&iter);
+   return default_label_info;
+ }
  static unsigned char are_objects_on_the_same_bus(AtspiAccessible *obj1, AtspiAccessible *obj2)
  {
    const char *bus_name_1 = obj1->parent.app->bus_name;
@@@ -621,8 -664,6 +669,8 @@@ atspi_accessible_get_neighbor (AtspiAcc
    while(1) {
      const char *path = are_objects_on_the_same_bus(root, start) ? root_path : "";
      DBusMessage *reply = _atspi_dbus_call_partial (start, atspi_interface_accessible, "GetNeighbor", error, "sii", path, (int)direction, (int)search_mode);
 +    // call failed, error is set, so we bail out
 +    if (!reply) break;
  
      _ATSPI_DBUS_CHECK_SIG (reply, "(so)y", error, NULL);
      dbus_message_iter_init (reply, &iter);
  
      // nothing found
      g_object_unref(start);
 -    return_value = NULL;
      break;
    }
    while(!g_queue_is_empty(children_root_stack))