[at-spi2-core] Catch toolkit name/version and AT-SPI version per-application



commit a72bb4c6521304c0e5dc678ce900ba7c78a86eda
Author: Mike Gorse <mgorse novell com>
Date:   Wed May 25 10:10:10 2011 -0500

    Catch toolkit name/version and AT-SPI version per-application

 atspi/atspi-accessible.c  |   39 ++++++++++++++++++++++++---------------
 atspi/atspi-application.c |    6 ++++--
 atspi/atspi-application.h |    3 +++
 3 files changed, 31 insertions(+), 17 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 82ee43d..f1f0788 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -756,13 +756,16 @@ atspi_accessible_get_application (AtspiAccessible *obj, GError **error)
 gchar *
 atspi_accessible_get_toolkit_name (AtspiAccessible *obj, GError **error)
 {
-  gchar *ret = NULL;
-
   g_return_val_if_fail (obj != NULL, NULL);
 
-  if (!_atspi_dbus_get_property (obj, atspi_interface_application, "ToolkitName", error, "s", &ret))
-      return NULL;
-  return ret;
+  if (!obj->parent.app)
+    return NULL;
+
+  if (!obj->parent.app->toolkit_name)
+    _atspi_dbus_get_property (obj, atspi_interface_application, "ToolkitName",
+                              error, "s", &obj->parent.app->toolkit_name);
+
+  return g_strdup (obj->parent.app->toolkit_name);
 }
 
 /**
@@ -778,13 +781,16 @@ atspi_accessible_get_toolkit_name (AtspiAccessible *obj, GError **error)
 gchar *
 atspi_accessible_get_toolkit_version (AtspiAccessible *obj, GError **error)
 {
-  gchar *ret = NULL;
-
   g_return_val_if_fail (obj != NULL, NULL);
 
-  if (!_atspi_dbus_get_property (obj, atspi_interface_application, "Version", error, "s", &ret))
-      return NULL;
-  return ret;
+  if (!obj->parent.app)
+    return NULL;
+
+  if (!obj->parent.app->toolkit_version)
+    _atspi_dbus_get_property (obj, atspi_interface_application, "Version",
+                              error, "s", &obj->parent.app->toolkit_version);
+
+  return g_strdup (obj->parent.app->toolkit_version);
 }
 
 /**
@@ -801,13 +807,16 @@ atspi_accessible_get_toolkit_version (AtspiAccessible *obj, GError **error)
 gchar *
 atspi_accessible_get_atspi_version (AtspiAccessible *obj, GError **error)
 {
-  gchar *ret = NULL;
-
   g_return_val_if_fail (obj != NULL, NULL);
 
-  if (!_atspi_dbus_get_property (obj, atspi_interface_application, "AtspiVersion", error, "s", &ret))
-      return NULL;
-  return ret;
+  if (!obj->parent.app)
+    return NULL;
+
+  if (!obj->parent.app->atspi_version)
+    _atspi_dbus_get_property (obj, atspi_interface_application, "AtspiVersion",
+                              error, "s", &obj->parent.app->atspi_version);
+
+  return g_strdup (obj->parent.app->atspi_version);
 }
 
 /**
diff --git a/atspi/atspi-application.c b/atspi/atspi-application.c
index 722d8aa..49124ba 100644
--- a/atspi/atspi-application.c
+++ b/atspi/atspi-application.c
@@ -62,8 +62,10 @@ atspi_application_finalize (GObject *object)
 {
   AtspiApplication *application = ATSPI_APPLICATION (object);
 
-  if (application->bus_name)
-    g_free (application->bus_name);
+  g_free (application->bus_name);
+  g_free (application->toolkit_name);
+  g_free (application->toolkit_version);
+  g_free (application->atspi_version);
 
   G_OBJECT_CLASS (atspi_application_parent_class)->finalize (object);
 }
diff --git a/atspi/atspi-application.h b/atspi/atspi-application.h
index bb15978..f209275 100644
--- a/atspi/atspi-application.h
+++ b/atspi/atspi-application.h
@@ -45,6 +45,9 @@ struct _AtspiApplication
   DBusConnection *bus;
   struct _AtspiAccessible *root;
   AtspiCache cache;
+  gchar *toolkit_name;
+  gchar *toolkit_version;
+  gchar *atspi_version;
 };
 
 typedef struct _AtspiApplicationClass AtspiApplicationClass;



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