document: add support to current page and page count
authorAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 28 Nov 2013 18:28:09 +0000 (19:28 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Mon, 2 Dec 2013 17:47:02 +0000 (18:47 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=719508

atspi/atspi-document.c
atspi/atspi-document.h
xml/Document.xml

index f95925b..bd3ac4c 100644 (file)
@@ -133,6 +133,48 @@ atspi_document_get_document_attributes (AtspiDocument *obj, GError **error)
   return _atspi_dbus_return_hash_from_message (message);
 }
 
+/**
+ * atspi_document_get_page_count:
+ * @obj: a pointer to the #AtspiDocument object to query.
+ *
+ * Gets the page count of an #AccessibleDocument object.
+ *
+ * Returns: a #gint indicating the page count of an
+ * #AccessibleDocument object.
+ **/
+gint
+atspi_document_get_page_count (AtspiDocument *obj, GError **error)
+{
+  dbus_int32_t retval = 0;
+
+  g_return_val_if_fail (obj != NULL, -1);
+
+  _atspi_dbus_get_property (obj, atspi_interface_document, "PageCount", error, "i", &retval);
+
+  return retval;
+}
+
+/**
+ * atspi_document_get_current_page_number:
+ * @obj: a pointer to the #AtspiDocument object to query.
+ *
+ * Gets the current page number of an #AccessibleDocument object.
+ *
+ * Returns: a #gint indicating the current page number in the
+ * #AccessibleDocument object.
+ **/
+gint
+atspi_document_get_current_page_number (AtspiDocument *obj, GError **error)
+{
+  dbus_int32_t retval = 0;
+
+  g_return_val_if_fail (obj != NULL, -1);
+
+  _atspi_dbus_get_property (obj, atspi_interface_document, "CurrentPageNumber", error, "i", &retval);
+
+  return retval;
+}
+
 static void
 atspi_document_base_init (AtspiDocument *klass)
 {
index cb6f966..f326d89 100644 (file)
@@ -59,6 +59,10 @@ GHashTable * atspi_document_get_attributes (AtspiDocument *obj, GError **error);
 
 GHashTable * atspi_document_get_document_attributes (AtspiDocument *obj, GError **error);
 
+gint atspi_document_get_page_count (AtspiDocument *obj, GError **error);
+gint atspi_document_get_current_page_number (AtspiDocument *obj, GError **error);
+
+
 G_END_DECLS
 
 #endif /* _ATSPI_DOCUMENT_H_ */
index 28b205d..d12a306 100644 (file)
@@ -2,6 +2,10 @@
 <node name="/node">
 <interface name="org.a11y.atspi.Document">
 
+  <property name="CurrentPageNumber" type="i" access="read"/>
+
+  <property name="PageCount" type="i" access="read"/>
+
   <method name="GetLocale">
     <arg direction="out" type="s"/>
   </method>