return g_strdup (obj->name);
}
+
+/**
+ * atspi_accessible_get_unique_id:
+ * @obj: a pointer to the #AtspiAccessible object on which to operate.
+ *
+ * Gets the identificator, uniquely identifying object, or NULL if an error occured.
+ *
+ * Returns: a UTF-8 string describing the #AtspiAccessible object
+ * or NULL on exception or NULL object passed.
+ **/
+gchar *
+atspi_accessible_get_unique_id(AtspiAccessible *obj, GError **error)
+{
+ if (!obj) {
+ g_set_error(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "argument is null");
+ return NULL;
+ }
+
+ gchar *id = NULL;
+ gchar *bus_name = atspi_accessible_get_bus_name(obj, error);
+ if (bus_name && bus_name[0]) {
+ gchar *path = atspi_accessible_get_path(obj, error);
+ if (path && path[0])
+ id = g_strdup_printf("%s:%s", bus_name, path);
+ else
+ g_set_error(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "failed to get path");
+ g_free(path);
+ }
+ else
+ g_set_error(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "failed to get bus name");
+ g_free(bus_name);
+ return id;
+}
+
+/**
+ * atspi_accessible_get_bus_name:
+ * @obj: a pointer to the #AtspiAccessible object on which to operate.
+ *
+ * Gets the bus name, where object belongs.
+ *
+ * Returns: a UTF-8 string describing the #AtspiAccessible object's
+ * bus name or empty string on exception or NULL object passed.
+ **/
+gchar *
+atspi_accessible_get_bus_name(AtspiAccessible *obj, GError **error)
+{
+ if (!obj || !obj->parent.app)
+ return g_strdup("");
+ return g_strdup (obj->parent.app->bus_name);
+}
+
/**
* atspi_accessible_get_path:
* @obj: a pointer to the #AtspiAccessible object on which to operate.
*
- * Gets the path, uniquely identifying object.
+ * Gets the path, uniquely identifying object over its bus name.
*
* Returns: a UTF-8 string describing the #AtspiAccessible object
* or empty string on exception or NULL object passed.
gchar * atspi_accessible_get_path (AtspiAccessible *obj, GError **error);
+gchar * atspi_accessible_get_bus_name (AtspiAccessible *obj, GError **error);
+
+gchar * atspi_accessible_get_unique_id (AtspiAccessible *obj, GError **error);
+
AtspiAccessible * atspi_accessible_get_parent (AtspiAccessible *obj, GError **error);
gint atspi_accessible_get_child_count (AtspiAccessible *obj, GError **error);
g_array_free(relations, TRUE);
- return ret ? atspi_accessible_get_path(ret, NULL) : g_strdup("");
+ return ret ? atspi_accessible_get_unique_id(ret, NULL) : g_strdup("");
}
static char *_get_info(AtspiAccessible *node, int length_limit)
char *node_name = atspi_accessible_get_name(node, NULL);
char *node_role_name = atspi_accessible_get_role_name(node, NULL);
- char *path = atspi_accessible_get_path(node, NULL);
+ char *unique_id = atspi_accessible_get_unique_id(node, NULL);
char *attributes = _get_attributes(node, length_limit);
Box_Size *box_size = _get_box_size(node);
char result[SAFE_BUFFER_SIZE];
int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%s],[%s,%s,%s,%s],[%s],[%s],[%s,%s]]",
- path,
+ unique_id,
node_role_name,
attributes,
box_size->x,
free(node_name);
free(node_role_name);
- free(path);
+ free(unique_id);
free(attributes);
if (box_size) {
free(box_size->width);
else
snprintf(parent_status, NUMBER_WIDTH, "%d", parent_index);
- char *parent_path = atspi_accessible_get_path(parent, NULL);
- char *parent_candidate_path = atspi_accessible_get_path(parent_candidate, NULL);
+ char *parent_unique_id = atspi_accessible_get_unique_id(parent, NULL);
+ char *parent_candidate_unique_id = atspi_accessible_get_unique_id(parent_candidate, NULL);
snprintf(output, CHECK_OUTPUT_WIDTH, "[FAIL<%d,%s><%s,%s>]", parent_candidate_index, parent_status,
- parent_candidate_path, parent_path);
- free(parent_path);
- free(parent_candidate_path);
+ parent_candidate_unique_id, parent_unique_id);
+ free(parent_unique_id);
+ free(parent_candidate_unique_id);
} else {
snprintf(output, CHECK_OUTPUT_WIDTH, "[OK]");