[at-spi2-core] Add atspi_accessible_get_process_id
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Add atspi_accessible_get_process_id
- Date: Mon, 27 Jun 2011 22:17:21 +0000 (UTC)
commit d72b352fc364359363b7ee16327023576ef4c4f0
Author: Mike Gorse <mgorse novell com>
Date: Mon Jun 27 17:18:05 2011 -0500
Add atspi_accessible_get_process_id
atspi/atspi-accessible.c | 37 +++++++++++++++++++++++++++++++++++++
atspi/atspi-accessible.h | 2 ++
2 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 9c21f44..7606244 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -1460,6 +1460,43 @@ atspi_accessible_clear_cache (AtspiAccessible *accessible)
}
}
+/**
+ * atspi_accessible_get_process_id:
+ * @accessible: The #AtspiAccessible to query.
+ *
+ * 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.
+ **/
+guint
+atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error)
+{
+ DBusMessage *message, *reply;
+ DBusConnection *bus = _atspi_bus ();
+ dbus_uint32_t pid = -1;
+ DBusError d_error;
+
+ if (!accessible->parent.app || !accessible->parent.app->bus_name)
+ return -1;
+
+ message = dbus_message_new_method_call ("org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "GetConnectionUnixProcessID");
+ dbus_message_append_args (message, DBUS_TYPE_STRING,
+ &accessible->parent.app->bus_name,
+ DBUS_TYPE_INVALID);
+ dbus_error_init (&d_error);
+ reply = dbus_connection_send_with_reply_and_block (bus, message, -1, &d_error);
+ dbus_message_unref (message);
+ dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID);
+ dbus_message_unref (reply);
+ dbus_error_init (&error);
+ return pid;
+}
+
AtspiCache
_atspi_accessible_get_cache_mask (AtspiAccessible *accessible)
{
diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h
index 987f696..d9deffe 100644
--- a/atspi/atspi-accessible.h
+++ b/atspi/atspi-accessible.h
@@ -134,6 +134,8 @@ void atspi_accessible_set_cache_mask (AtspiAccessible *accessible, AtspiCache ma
void atspi_accessible_clear_cache (AtspiAccessible *accessible);
+guint atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error);
+
/* private */
void _atspi_accessible_add_cache (AtspiAccessible *accessible, AtspiCache flag);
AtspiCache _atspi_accessible_get_cache_mask (AtspiAccessible *accessible);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]