static char *spi_on_value_changed_get_text(SpiData *spi, AtspiEvent *event)
{
char *text_to_read = NULL;
-
spi->currently_focused = event->source;
-
- AtspiValue *value_interface = atspi_accessible_get_value_iface(spi->currently_focused);
-
- if (value_interface) {
- char *name = atspi_accessible_get_name(spi->currently_focused, NULL);
- DEBUG("VALUE CHANGED WIDGET: %s", name);
- g_free(name);
-
- double current_temp_value = (double)atspi_value_get_current_value(value_interface, NULL);
- //FIXME : This IDS value is not supported.
- /*if (abs(current_temp_value - atspi_value_get_maximum_value(value_interface, NULL)) < EPS) {
- DEBUG("MAX VALUE REACHED");
- if (asprintf(&text_to_read, "%.2f %s", current_temp_value, _("IDS_REACHED_MAX_VAL")) < 0) {
- ERROR(MEMORY_ERROR);
- g_object_unref(value_interface);
- return NULL;
- }
- } else if (abs(current_temp_value - atspi_value_get_minimum_value(value_interface, NULL)) < EPS) {
- DEBUG("MIN VALUE REACHED");
- if (asprintf(&text_to_read, "%.2f %s", current_temp_value, _("IDS_REACHED_MIN_VAL")) < 0) {
- ERROR(MEMORY_ERROR);
- g_object_unref(value_interface);
- return NULL;
- }
- } else {*/
- if (asprintf(&text_to_read, "%.2f", current_temp_value) < 0) {
- ERROR(MEMORY_ERROR);
- g_object_unref(value_interface);
- return NULL;
- }
- //}
- g_object_unref(value_interface);
- }
-
+ ReadingComposerData *rcd = reading_composer_data_get(spi->currently_focused);
+ text_to_read = reading_composer_percent_value_description_get(rcd);
+ reading_composer_data_free(rcd);
return text_to_read;
}