Backport atspi_value_get_text() from 2.46 79/291479/2
authorArtur Świgoń <a.swigon@samsung.com>
Wed, 12 Apr 2023 10:21:50 +0000 (12:21 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Mon, 17 Apr 2023 09:16:23 +0000 (11:16 +0200)
This API provides a string value from the Value interface, customizable by the
application, which can be read as-is by the ScreenReader.

Change-Id: I054cc7253deac9d6ca9629fc2e813f7a5af24709

atspi/atspi-value.c
atspi/atspi-value.h

index 28acade..1f90f37 100644 (file)
@@ -152,6 +152,28 @@ atspi_value_get_minimum_increment (AtspiValue *obj, GError **error)
   return retval;
 }
 
+/**
+ * atspi_value_get_text:
+ * @obj: a pointer to the #AtspiValue implementor on which to operate.
+ *
+ * Gets the human readable text alternative associated with the value.
+ * @text is a newly created string, that must be freed by the
+ * caller. Can be NULL if no descriptor is available.
+ *
+ * Since: 2.46
+ **/
+gchar *
+atspi_value_get_text (AtspiValue *obj, GError **error)
+{
+  gchar *retval = NULL;
+
+  g_return_val_if_fail (obj != NULL, NULL);
+
+  _atspi_dbus_get_property (obj, atspi_interface_value, "Text", error, "s", &retval);
+
+  return retval;
+}
+
 static void
 atspi_value_base_init (AtspiValue *klass)
 {
index a012793..478ea95 100644 (file)
@@ -56,6 +56,7 @@ gboolean atspi_value_set_current_value (AtspiValue *obj, gdouble new_value, GErr
 
 gdouble atspi_value_get_minimum_increment (AtspiValue *obj, GError **error);
 
+gchar *atspi_value_get_text (AtspiValue *obj, GError **error);
 G_END_DECLS
 
 #endif /* _ATSPI_VALUE_H_ */