[at-spi2-atk] document: add support for newly added AtkDocument methods and signals



commit c14c98e5292b5595178091349cdff58a920c66c2
Author: Alejandro Piñeiro <apinheiro igalia com>
Date:   Thu Nov 28 18:14:20 2013 +0100

    document: add support for newly added AtkDocument methods and signals
    
    It also bumps the atk dependency
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719508

 atk-adaptor/adaptors/document-adaptor.c |   24 +++++++++++++++++++++++-
 atk-adaptor/event.c                     |   10 +++++++++-
 configure.ac                            |    2 +-
 3 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/atk-adaptor/adaptors/document-adaptor.c b/atk-adaptor/adaptors/document-adaptor.c
index 062690a..f44f0c6 100644
--- a/atk-adaptor/adaptors/document-adaptor.c
+++ b/atk-adaptor/adaptors/document-adaptor.c
@@ -29,6 +29,22 @@
 #include "object.h"
 #include "introspection.h"
 
+static dbus_bool_t
+impl_get_CurrentPageNumber (DBusMessageIter * iter, void *user_data)
+{
+  AtkDocument *document = (AtkDocument *) user_data;
+  g_return_val_if_fail (ATK_IS_DOCUMENT (user_data), FALSE);
+  return droute_return_v_int32 (iter, atk_document_get_current_page_number (document));
+}
+
+static dbus_bool_t
+impl_get_PageCount (DBusMessageIter * iter, void *user_data)
+{
+  AtkDocument *document = (AtkDocument *) user_data;
+  g_return_val_if_fail (ATK_IS_DOCUMENT (user_data), FALSE);
+  return droute_return_v_int32 (iter, atk_document_get_page_count (document));
+}
+
 static DBusMessage *
 impl_GetLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
@@ -111,9 +127,15 @@ static DRouteMethod methods[] = {
   {NULL, NULL}
 };
 
+static DRouteProperty properties[] = {
+  {impl_get_CurrentPageNumber, NULL, "CurrentPageNumber"},
+  {impl_get_PageCount, NULL, "PageCount"},
+  {NULL, NULL, NULL}
+};
+
 void
 spi_initialize_document (DRoutePath * path)
 {
   droute_path_add_interface (path,
-                             ATSPI_DBUS_INTERFACE_DOCUMENT, spi_org_a11y_atspi_Document, methods, NULL);
+                             ATSPI_DBUS_INTERFACE_DOCUMENT, spi_org_a11y_atspi_Document, methods, 
properties);
 };
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index d8a74cc..fa7cbbd 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -686,6 +686,7 @@ window_event_listener (GSignalInvocationHint * signal_hint,
  * Gtk:AtkDocument:load-complete ->  document:load-complete
  * Gtk:AtkDocument:load-stopped  ->  document:load-stopped
  * Gtk:AtkDocument:reload        ->  document:reload
+ * Gtk:AtkDocument:page-changed  ->  document:page-changed
  */
 static gboolean
 document_event_listener (GSignalInvocationHint * signal_hint,
@@ -695,13 +696,18 @@ document_event_listener (GSignalInvocationHint * signal_hint,
   AtkObject *accessible;
   GSignalQuery signal_query;
   const gchar *name, *s;
+  gint detail1 = 0;
 
   g_signal_query (signal_hint->signal_id, &signal_query);
   name = signal_query.signal_name;
 
+  if (n_param_values > 0) // on the case of page-changed
+    if (G_VALUE_TYPE (&param_values[1]) == G_TYPE_INT)
+      detail1 = g_value_get_int (&param_values[1]);
+
   accessible = ATK_OBJECT (g_value_get_object (&param_values[0]));
   s = atk_object_get_name (accessible);
-  emit_event (accessible, ITF_EVENT_DOCUMENT, name, "", 0, 0,
+  emit_event (accessible, ITF_EVENT_DOCUMENT, name, "", detail1, 0,
               DBUS_TYPE_STRING_AS_STRING, s, append_basic);
 
   return TRUE;
@@ -1159,6 +1165,8 @@ spi_atk_register_event_listeners (void)
   add_signal_listener (document_event_listener, "Gtk:AtkDocument:reload");
   add_signal_listener (document_event_listener,
                        "Gtk:AtkDocument:load-stopped");
+  add_signal_listener (document_event_listener,
+                       "Gtk:AtkDocument:page-changed");
   /* TODO Fake this event on the client side */
   add_signal_listener (state_event_listener, "Gtk:AtkObject:state-change");
   /* TODO */
diff --git a/configure.ac b/configure.ac
index 0dc0a25..701ebc4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,7 +51,7 @@ PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.0.0])
 AC_SUBST(GMODULE_LIBS)
 AC_SUBST(GMODULE_CFLAGS)
 
-PKG_CHECK_MODULES(ATK, [atk >= 2.11.2])
+PKG_CHECK_MODULES(ATK, [atk >= 2.11.3])
 AC_SUBST(ATK_LIBS)
 AC_SUBST(ATK_CFLAGS)
 


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