[at-spi2-core] Add GError setter in atspi_accessible_get_process_id function



commit b62063e1fe017b7db94bdec212d0896de536abe3
Author: Michal Jagiello <m jagiello samsung com>
Date:   Mon Apr 14 12:26:08 2014 +0200

    Add GError setter in atspi_accessible_get_process_id function

 atspi/atspi-accessible.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 4ce89e3..ccf1484 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -1651,12 +1651,13 @@ atspi_accessible_clear_cache (AtspiAccessible *accessible)
 /**
  * atspi_accessible_get_process_id:
  * @accessible: The #AtspiAccessible to query.
+ * @error: a pointer to a %NULL #GError pointer
  *
  * Returns the process id associated with the given accessible.  Mainly
  * added for debugging; it is a shortcut to explicitly querying the
  * accessible's app->bus_name and then calling GetConnectionUnixProcessID.
  *
- * Returns: The process ID, or -1 if defunct.
+ * Returns: The process ID or undetermined value if @error is set.
  **/
 guint
 atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error)
@@ -1667,7 +1668,10 @@ atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error)
   DBusError d_error;
 
   if (!accessible->parent.app || !accessible->parent.app->bus_name)
-    return -1;
+    {
+      g_set_error_literal(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "Process is defunct");
+      return -1;
+    }
 
   message = dbus_message_new_method_call ("org.freedesktop.DBus",
                                           "/org/freedesktop/DBus",
@@ -1687,7 +1691,7 @@ atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error)
   }
   if (dbus_error_is_set (&d_error))
     {
-      g_warning ("GetConnectionUnixProcessID failed: %s", d_error.message);
+      g_set_error_literal(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "Process is defunct");
       dbus_error_free (&d_error);
     }
   return pid;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]