move ref_accessible function to public scope 53/143553/4
authorMariusz Wachowicz <m.wachowicz@partner.samsung.com>
Thu, 10 Aug 2017 09:29:48 +0000 (11:29 +0200)
committerMariusz Wachowicz <m.wachowicz@partner.samsung.com>
Thu, 10 Aug 2017 13:14:01 +0000 (15:14 +0200)
this function is needed outside at-spi library (other projects, e.g. universal-switch),
to get AtspiAccessible object after it has been received as application name and path name

Change-Id: I51e72af3f191d4a14174cd0b4819522154e3e1ba

atspi/atspi-misc.c
atspi/atspi-misc.h

index 193257b..02eab8c 100644 (file)
@@ -260,7 +260,7 @@ get_application (const char *bus_name)
   return app;
 }
 
-static AtspiAccessible *
+AtspiAccessible *
 ref_accessible (const char *app_name, const char *path)
 {
   AtspiApplication *app;
@@ -1149,11 +1149,12 @@ out:
   process_deferred_messages ();
   if (dbus_error_is_set (&err))
   {
-    /* TODO: Set gerror */
+    g_set_error_literal(error, ATSPI_ERROR, ATSPI_ERROR_IPC, err.message);
     dbus_error_free (&err);
+    if (reply)
+      dbus_message_unref(reply);
   }
-
-  if (reply && dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
+  else if (reply && dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
   {
     const char *err_str = NULL;
     dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err_str, DBUS_TYPE_INVALID);
@@ -1162,7 +1163,6 @@ out:
     dbus_message_unref (reply);
     return NULL;
   }
-
   return reply;
 }
 
index f13596f..e39d7b8 100644 (file)
@@ -47,6 +47,9 @@ void
 atspi_set_main_context (GMainContext *cnx);
 
 gchar * atspi_role_get_name (AtspiRole role);
+
+AtspiAccessible *ref_accessible(const char *app_name, const char *path);
+
 G_END_DECLS
 
 #endif /* _ATSPI_MISC_H_ */