2008-07-21 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_hypertext.c
index 7b0af7f..e6f7a7b 100644 (file)
@@ -1,3 +1,26 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 #include <cspi/spi-private.h>
 
 /**
@@ -44,12 +67,11 @@ AccessibleHypertext_unref (AccessibleHypertext *obj)
 long
 AccessibleHypertext_getNLinks (AccessibleHypertext *obj)
 {
-  long retval;
+  dbus_int32_t retval;
 
   cspi_return_val_if_fail (obj != NULL, FALSE);
 
-  retval =
-    Accessibility_Hypertext_getNLinks (CSPI_OBJREF (obj), cspi_ev ());
+  cspi_dbus_call (obj, spi_interface_hypertext, "getNLinks", NULL, "=>i", &retval);
 
   cspi_return_val_if_ev ("getNLinks", -1);
 
@@ -69,17 +91,19 @@ AccessibleHyperlink *
 AccessibleHypertext_getLink (AccessibleHypertext *obj,
                              long int             linkIndex)
 {
+  dbus_int32_t d_linkIndex = linkIndex;
+  char *path;
   AccessibleHyperlink *retval;
        
-  cspi_return_val_if_fail (obj != NULL, FALSE);
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
+  cspi_dbus_call (obj, spi_interface_hypertext, "getLink", NULL, "i=>o", d_linkIndex, &path);
 
-  retval = cspi_object_add (
-    Accessibility_Hypertext_getLink (CSPI_OBJREF (obj),
-                                    (CORBA_long) linkIndex,
-                                    cspi_ev ()));
-  
   cspi_return_val_if_ev ("getLink", NULL); 
 
+  retval = cspi_ref_related_accessible (obj, path);
+  g_free (path);
+  
   return retval;
 }
 
@@ -99,14 +123,12 @@ long
 AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
                                   long int             characterOffset)
 {
-  long retval;
+  dbus_int32_t d_characterOffset = characterOffset;
+  dbus_int32_t retval;
 
   cspi_return_val_if_fail (obj != NULL, -1);
 
-  retval = 
-    Accessibility_Hypertext_getLinkIndex (CSPI_OBJREF (obj),
-                                         (CORBA_long) characterOffset,
-                                         cspi_ev ());
+  cspi_dbus_call (obj, spi_interface_hypertext, "getLinkIndex", NULL, "i=>i", d_characterOffset, &retval);
 
   cspi_return_val_if_ev ("getLinkIndex", -1);