Started fixing IDL docs.
[platform/core/uifw/at-spi2-atk.git] / libspi / hypertext.c
index e9780d2..cb4f98e 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-/*
- * component.c : bonobo wrapper for accessible component implementation
- *
- */
-#include <config.h>
-#include <bonobo/Bonobo.h>
+/* hypertext.c : implements the HyperText interface */
 
+#include <config.h>
 #include <stdio.h>
+#include <libspi/hyperlink.h>
+#include <libspi/hypertext.h>
 
-/*
- * This pulls the CORBA definitions for the "Accessibility::Accessible" server
- */
-#include <libspi/Accessibility.h>
-
-/*
- * This pulls the definition of the hypertext bonobo object
- */
-#include "hypertext.h"
-
-/*
- * Static function declarations
- */
-
-static void
-hypertext_class_init (HypertextClass *klass);
-static void
-hypertext_init (Hypertext *hypertext);
-static void
-hypertext_finalize (GObject *obj);
-static CORBA_short
-impl__get_n_anchors (PortableServer_Servant _servant,
-                    CORBA_Environment * ev);
-static CORBA_string
-impl__get_uri (PortableServer_Servant _servant,
-              CORBA_Environment * ev);
-static CORBA_long
-impl__get_startIndex (PortableServer_Servant _servant,
-                     CORBA_Environment * ev);
-static CORBA_long
-impl__get_endIndex (PortableServer_Servant _servant,
-                   CORBA_Environment * ev);
-static Accessibility_Accessible
-impl_getAnchor (PortableServer_Servant _servant,
-               const CORBA_long i,
-               CORBA_Environment * ev);
-static Accessibility_Accessible
-impl_getObject (PortableServer_Servant _servant,
-               const CORBA_long i,
-               CORBA_Environment * ev);
-static CORBA_long
-impl_getNLinks (PortableServer_Servant _servant,
-               CORBA_Environment * ev);
-static Accessibility_Hyperlink
-impl_getLink (PortableServer_Servant _servant,
-             const CORBA_long linkIndex,
-             CORBA_Environment * ev);
-static CORBA_long
-impl_getLinkIndex (PortableServer_Servant _servant,
-                  const CORBA_long characterIndex,
-                  CORBA_Environment * ev);
+/* Static function declarations */
 
 static GObjectClass *parent_class;
 
-GType
-hypertext_get_type (void)
-{
-  static GType type = 0;
-
-  if (!type) {
-    static const GTypeInfo tinfo = {
-      sizeof (HypertextClass),
-      (GBaseInitFunc) NULL,
-      (GBaseFinalizeFunc) NULL,
-      (GClassInitFunc) hypertext_class_init,
-      (GClassFinalizeFunc) NULL,
-      NULL, /* class data */
-      sizeof (Hypertext),
-      0, /* n preallocs */
-      (GInstanceInitFunc) hypertext_init,
-                        NULL /* value table */
-    };
-
-    /*
-     * Bonobo_type_unique auto-generates a load of
-     * CORBA structures for us. All derived types must
-     * use bonobo_type_unique.
-     */
-    type = bonobo_type_unique (
-                              BONOBO_OBJECT_TYPE,
-                              POA_Accessibility_Hypertext__init,
-                              NULL,
-                              G_STRUCT_OFFSET (HypertextClass, epv),
-                              &tinfo,
-                              "AccessibleHypertext");
-  }
-
-  return type;
-}
-
 static void
-hypertext_class_init (HypertextClass *klass)
+spi_hypertext_finalize (GObject *obj)
 {
-  GObjectClass * object_class = (GObjectClass *) klass;
-  POA_Accessibility_Hypertext__epv *epv = &klass->epv;
-  parent_class = g_type_class_peek_parent (klass);
-
-  object_class->finalize = hypertext_finalize;
-
-  /* Initialize epv table */
-
-  epv->getNLinks = impl_getNLinks;
-  epv->getLink = impl_getLink;
-  epv->getLinkIndex = impl_getLinkIndex;
-}
-
-static void
-hypertext_init (Hypertext *hypertext)
-{
-}
-
-static void
-hypertext_finalize (GObject *obj)
-{
-  Hypertext *hypertext = HYPERTEXT(obj);
+  SpiHypertext *hypertext = SPI_HYPERTEXT(obj);
   g_object_unref (hypertext->atko);
   hypertext->atko = NULL;
   parent_class->finalize (obj);
 }
 
-Hypertext *
-hypertext_interface_new (AtkObject *obj)
+SpiHypertext *
+spi_hypertext_interface_new (AtkObject *obj)
 {
-  Hypertext *new_hypertext = 
-    HYPERTEXT(g_object_new (HYPERTEXT_TYPE, NULL));
+  SpiHypertext *new_hypertext = g_object_new (SPI_HYPERTEXT_TYPE, NULL);
   new_hypertext->atko = obj;
   g_object_ref (obj);
   return new_hypertext;
@@ -165,7 +55,7 @@ static CORBA_long
 impl_getNLinks (PortableServer_Servant _servant,
                CORBA_Environment * ev)
 {
-  Hypertext *hypertext = HYPERTEXT(bonobo_object_from_servant(_servant));
+  SpiHypertext *hypertext = SPI_HYPERTEXT(bonobo_object_from_servant(_servant));
   return (CORBA_long)
     atk_hypertext_get_n_links (ATK_HYPERTEXT(hypertext->atko));
 }
@@ -173,17 +63,22 @@ impl_getNLinks (PortableServer_Servant _servant,
 
 
 static Accessibility_Hyperlink
-impl_getLink (PortableServer_Servant _servant,
-             const CORBA_long linkIndex,
-                                         CORBA_Environment * ev)
+impl_getLink (PortableServer_Servant servant,
+             const CORBA_long       linkIndex,
+             CORBA_Environment     *ev)
 {
   AtkHyperlink *link;
-  Hypertext *hypertext = HYPERTEXT(bonobo_object_from_servant(_servant));
+  SpiHypertext *hypertext;
   Accessibility_Hyperlink rv;
   
-  link = atk_hypertext_get_link (ATK_HYPERTEXT(hypertext->atko),
-                                (gint) linkIndex);
-  rv = bonobo_object_corba_objref (BONOBO_OBJECT(hyperlink_interface_new(ATK_OBJECT(link))));
+  hypertext = SPI_HYPERTEXT (bonobo_object_from_servant (servant));
+
+  link = atk_hypertext_get_link (
+         ATK_HYPERTEXT (hypertext->atko), linkIndex);
+
+  rv = bonobo_object_corba_objref (BONOBO_OBJECT (
+         spi_hyperlink_new (ATK_OBJECT (link))));
+
   return rv;
 }
 
@@ -194,9 +89,34 @@ impl_getLinkIndex (PortableServer_Servant _servant,
                   const CORBA_long characterIndex,
                                  CORBA_Environment * ev)
 {
-  Hypertext *hypertext = HYPERTEXT(bonobo_object_from_servant(_servant));
+  SpiHypertext *hypertext = SPI_HYPERTEXT(bonobo_object_from_servant(_servant));
   return (CORBA_long)
     atk_hypertext_get_link_index (ATK_HYPERTEXT(hypertext->atko),
                                  (gint) characterIndex);
 }
 
+static void
+spi_hypertext_class_init (SpiHypertextClass *klass)
+{
+  GObjectClass * object_class = (GObjectClass *) klass;
+  POA_Accessibility_Hypertext__epv *epv = &klass->epv;
+  parent_class = g_type_class_peek_parent (klass);
+
+  object_class->finalize = spi_hypertext_finalize;
+
+  /* Initialize epv table */
+
+  epv->getNLinks = impl_getNLinks;
+  epv->getLink = impl_getLink;
+  epv->getLinkIndex = impl_getLinkIndex;
+}
+
+static void
+spi_hypertext_init (SpiHypertext *hypertext)
+{
+}
+
+BONOBO_TYPE_FUNC_FULL (SpiHypertext,
+                      Accessibility_Hypertext,
+                      BONOBO_TYPE_OBJECT,
+                      spi_hypertext);