}
if (!strcmp(event->type, "object:state-changed:selected") && (attribute & ACCESSIBLE_READING_INFO_TYPE_STATE)) {
- char buf[256] = "\0";
+ char buf[256] = {0};
AtspiAccessible *parent = atspi_accessible_get_parent(event->source, NULL);
gchar *name = atspi_accessible_get_name(event->source, NULL);
if (atspi_accessible_get_role(event->source, NULL) == ATSPI_ROLE_MENU_ITEM) {
- char tab_index[16] = "\0";
- int children_count = atspi_accessible_get_child_count(parent, NULL);
- int index = atspi_accessible_get_index_in_parent(event->source, NULL);
- strncat(buf, name, sizeof(buf) - strlen(buf) - 1);
- strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
- snprintf(tab_index, sizeof(tab_index), _("IDS_ACCS_BODY_TAB_P1SD_OF_P2SD"), index + 1, children_count);
- strncat(buf, tab_index, sizeof(buf) - strlen(buf) - 1);
- strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
if (event->detail1) {
+ char tab_index[16] = {0};
+ int children_count = atspi_accessible_get_child_count(parent, NULL);
+ int index = atspi_accessible_get_index_in_parent(event->source, NULL);
+ strncat(buf, name, sizeof(buf) - strlen(buf) - 1);
+ strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
+ snprintf(tab_index, sizeof(tab_index), _("IDS_ACCS_BODY_TAB_P1SD_OF_P2SD"), index + 1, children_count);
+ strncat(buf, tab_index, sizeof(buf) - strlen(buf) - 1);
+ strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
strncat(buf, _("IDS_ACCS_BODY_SELECTED_TTS"), sizeof(buf) - strlen(buf) - 1);
+ tts_speak(buf, EINA_TRUE, tts_data);
}
- else strncat(buf, _("IDS_ACCS_BODY_DOUBLE_TAP_TO_SELECT_TTS"), sizeof(buf) - strlen(buf) - 1);
- tts_speak(buf, EINA_TRUE, tts_data);
}
- else if (atspi_accessible_get_role(event->source, NULL) == ATSPI_ROLE_LIST_ITEM && atspi_accessible_get_role(parent, NULL) == ATSPI_ROLE_TREE_TABLE) {
+ else if (atspi_accessible_get_role(event->source, NULL) == ATSPI_ROLE_LIST_ITEM || atspi_accessible_get_role(parent, NULL) == ATSPI_ROLE_TREE_TABLE) {
if (event->detail1) {
AtspiStateSet *parent_state_set = atspi_accessible_get_state_set(parent);
bool is_parent_multiselectable = atspi_state_set_contains(parent_state_set, ATSPI_STATE_MULTISELECTABLE);
- snprintf(buf, sizeof(buf), "%s, %s, ", name,_("IDS_BR_BODY_IMAGE_T_TTS"));
+ snprintf(buf, sizeof(buf) - 1, name);
AtspiStateSet *state_set = atspi_accessible_get_state_set(event->source);
gboolean is_selected = atspi_state_set_contains(state_set, ATSPI_STATE_SELECTED);
g_object_unref(state_set);
- if(is_selected)
- snprintf(buf + strlen(buf), sizeof(buf), "%s, ", _("IDS_ACCS_BODY_SELECTED_TTS"));
+ if(is_selected){
+ if (buf[0] != 0)
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1, ", ");
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) -1, _("IDS_ACCS_BODY_SELECTED_TTS"));
+ }
if(is_parent_multiselectable) {
AtspiSelection *parent_selection = atspi_accessible_get_selection(parent);
int selected_children_count = atspi_selection_get_n_selected_children(parent_selection, NULL);
- snprintf(buf + strlen(buf), sizeof(buf), _("IDS_SCR_BODY_PD_SELECTED_IN_TOTAL_TTS"), selected_children_count);
+ if (buf[0] != 0)
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1, ", ");
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1, _("IDS_SCR_BODY_PD_SELECTED_IN_TOTAL_TTS"), selected_children_count);
g_object_unref(parent_selection);
}
- else {
- snprintf(buf + strlen(buf), sizeof(buf), _("IDS_ACCS_BODY_SELECTED_TTS"));
- }
tts_speak(buf, EINA_TRUE, tts_data);
g_object_unref(parent_state_set);
}
}
- else strncat(buf, _("IDS_ACCS_BODY_DOUBLE_TAP_TO_SELECT_TTS"), sizeof(buf) - strlen(buf) - 1);
- tts_speak(buf, EINA_TRUE, tts_data);
+ else {
+ strncat(buf, _("IDS_ACCS_BODY_DOUBLE_TAP_TO_SELECT_TTS"), sizeof(buf) - strlen(buf) - 1);
+ tts_speak(buf, EINA_TRUE, tts_data);
+ }
g_free(name);
g_object_unref(parent);
}
gboolean is_selected = atspi_selection_is_child_selected(selection, index, &err);
GERROR_CHECK(err);
snprintf(ret, sizeof(ret), _("IDS_ACCS_BODY_TAB_P1SD_OF_P2SD"), index + 1, children_count);
- if (!is_selected)
+ if (is_selected)
+ snprintf(ret + strlen(ret), sizeof(ret), ", %s", _("IDS_ACCS_BODY_SELECTED_TTS"));
+ else
snprintf(ret + strlen(ret), sizeof(ret), ", %s", _("IDS_ACCS_BODY_DOUBLE_TAP_TO_SELECT_TTS"));
g_object_unref(selection);
}
AtspiRole parent_role = atspi_accessible_get_role(parent, NULL);
g_object_unref(parent);
- if (parent_role == ATSPI_ROLE_TREE_TABLE) {
+ if (parent_role == ATSPI_ROLE_TREE_TABLE || parent_role == ATSPI_ROLE_LIST) {
gboolean is_selected = atspi_state_set_contains(state_set, ATSPI_STATE_SELECTED);
if (is_selected)
break;
}
case ATSPI_ROLE_RADIO_MENU_ITEM: {
- strncpy(ret, _("IDS_ACCS_BODY_SELECTED_TTS"), sizeof(ret) - strlen(ret) - 1);
+ if (atspi_state_set_contains(state_set, ATSPI_STATE_CHECKED))
+ strncpy(ret, _("IDS_ACCS_BODY_SELECTED_TTS"), sizeof(ret) - strlen(ret) - 1);
break;
}