EOLIAN static void
_elm_interface_atspi_accessible_attribute_append(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd EINA_UNUSED, const char *key, const char *value)
{
- if (!key || !value)
- return;
- Elm_Atspi_Attribute *attr = calloc(1, sizeof(Elm_Atspi_Attribute));
- if (!attr)
- return;
+ Eina_List *l;
+ Elm_Atspi_Attribute *attr = NULL;
+
+ if (!key || !value) return;
+
+ /* Check existing attributes has this key */
+ EINA_LIST_FOREACH(pd->attr_list, l, attr)
+ {
+ if (!strcmp((const char *)attr->key, key))
+ {
+ eina_stringshare_replace(&attr->value, value);
+ return;
+ }
+ }
+
+ /* Add new attribute */
+ attr = calloc(1, sizeof(Elm_Atspi_Attribute));
+ if (!attr) return;
+
attr->key = eina_stringshare_add(key);
attr->value = eina_stringshare_add(value);
pd->attr_list = eina_list_append(pd->attr_list, attr);
elm_atspi_attribute_list_free(Eina_List *list)
{
Elm_Atspi_Attribute *attr;
-
EINA_LIST_FREE(list, attr)
+ {
+ eina_stringshare_del(attr->key);
+ eina_stringshare_del(attr->value);
free(attr);
-
- eina_list_free(list);
+ }
}
EOLIAN static void _elm_interface_atspi_accessible_attributes_clear(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd) {
- elm_atspi_attribute_list_free(pd->attr_list);
- pd->attr_list = NULL;
+ elm_atspi_attribute_list_free(pd->attr_list);
+ pd->attr_list = NULL;
}
EOLIAN static void