Added docs and C bindings for AccessibleStateSet and AccessibleRelationSet.
[platform/core/uifw/at-spi2-atk.git] / libspi / action.c
index a3e0ddb..d4dc70d 100644 (file)
@@ -35,7 +35,7 @@
 #include <libspi/Accessibility.h>
 
 /*
- * This pulls the definition of the Action bonobo object
+ * This pulls the definition of the SpiAction bonobo object
  */
 #include "action.h"
 
  */
 
 static void
-action_class_init (ActionClass *klass);
+spi_action_class_init (SpiActionClass *klass);
 static void
-action_init (Action *action);
+spi_action_init (SpiAction *action);
 static void
-action_finalize (GObject *obj);
+spi_action_finalize (GObject *obj);
 static CORBA_long
 impl__get_nActions(PortableServer_Servant servant,
                 CORBA_Environment * ev);
@@ -71,21 +71,21 @@ impl_getKeyBinding (PortableServer_Servant servant,
 static GObjectClass *parent_class;
 
 GType
-action_get_type (void)
+spi_action_get_type (void)
 {
   static GType type = 0;
 
   if (!type) {
     static const GTypeInfo tinfo = {
-      sizeof (ActionClass),
+      sizeof (SpiActionClass),
       (GBaseInitFunc) NULL,
       (GBaseFinalizeFunc) NULL,
-      (GClassInitFunc) action_class_init,
+      (GClassInitFunc) spi_action_class_init,
       (GClassFinalizeFunc) NULL,
       NULL, /* class data */
-      sizeof (Action),
+      sizeof (SpiAction),
       0, /* n preallocs */
-      (GInstanceInitFunc) action_init,
+      (GInstanceInitFunc) spi_action_init,
                         NULL /* value table */
     };
 
@@ -98,22 +98,22 @@ action_get_type (void)
                               BONOBO_OBJECT_TYPE,
                               POA_Accessibility_Action__init,
                               NULL,
-                              G_STRUCT_OFFSET (ActionClass, epv),
+                              G_STRUCT_OFFSET (SpiActionClass, epv),
                               &tinfo,
-                              "AccessibleAction");
+                              "SpiAccessibleAction");
   }
 
   return type;
 }
 
 static void
-action_class_init (ActionClass *klass)
+spi_action_class_init (SpiActionClass *klass)
 {
   GObjectClass * object_class = (GObjectClass *) klass;
   POA_Accessibility_Action__epv *epv = &klass->epv;
   parent_class = g_type_class_peek_parent (klass);
 
-  object_class->finalize = action_finalize;
+  object_class->finalize = spi_action_finalize;
 
 
   /* Initialize epv table */
@@ -126,24 +126,26 @@ action_class_init (ActionClass *klass)
 }
 
 static void
-action_init (Action *action)
+spi_action_init (SpiAction *action)
 {
 }
 
 static void
-action_finalize (GObject *obj)
+spi_action_finalize (GObject *obj)
 {
-  Action *action = ACTION (obj);
-  action->atk_action = NULL;
+  SpiAction *action = SPI_ACTION (obj);
+  g_object_unref (action->atko);
+  action->atko = NULL;
   parent_class->finalize (obj);
 }
 
-Action *
-action_new (AtkAction *action)
+SpiAction *
+spi_action_interface_new (AtkObject *obj)
 {
-  Action *new_action = 
-    ACTION(g_object_new (ACTION_TYPE, NULL));
-  new_action->atk_action = action;
+  SpiAction *new_action = 
+    SPI_ACTION(g_object_new (SPI_ACTION_TYPE, NULL));
+  new_action->atko = obj;
+  g_object_ref (obj);
   return new_action;
 }
 
@@ -151,16 +153,16 @@ static CORBA_long
 impl__get_nActions(PortableServer_Servant servant,
            CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  return (CORBA_long) atk_action_get_n_actions (action->atk_action);
+  SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
+  return (CORBA_long) atk_action_get_n_actions (ATK_ACTION(action->atko));
 }
 
 static CORBA_boolean
 impl_doAction (PortableServer_Servant servant,
               const CORBA_long index, CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant (servant));
-  return (CORBA_boolean) atk_action_do_action (action->atk_action, (gint) index);
+  SpiAction *action = SPI_ACTION (bonobo_object_from_servant (servant));
+  return (CORBA_boolean) atk_action_do_action (ATK_ACTION(action->atko), (gint) index);
 }
 
 
@@ -169,8 +171,14 @@ impl_getDescription (PortableServer_Servant servant,
                const CORBA_long index,
                CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  return CORBA_string_dup (atk_action_get_description (action->atk_action, (gint) index));
+  SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
+  const gchar *rv;
+  
+  rv = atk_action_get_description (ATK_ACTION(action->atko), (gint) index);
+  if (rv)
+    return CORBA_string_dup (rv);
+  else
+    return CORBA_string_dup ("");
 }
 
 
@@ -179,8 +187,14 @@ impl_getName (PortableServer_Servant servant,
                const CORBA_long index,
                CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  return CORBA_string_dup (atk_action_get_name (action->atk_action, (gint) index));
+  SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
+  const gchar *rv;
+  
+  rv = atk_action_get_name (ATK_ACTION(action->atko), (gint) index);
+  if (rv)
+    return CORBA_string_dup (rv);
+  else
+    return CORBA_string_dup ("");
 }
 
 static CORBA_string
@@ -188,6 +202,12 @@ impl_getKeyBinding (PortableServer_Servant servant,
                    const CORBA_long index,
                    CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  return CORBA_string_dup (atk_action_get_keybinding (action->atk_action, (gint) index));
+  SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
+  const gchar *rv;
+  
+  rv = atk_action_get_keybinding (ATK_ACTION(action->atko), (gint) index);
+  if (rv)
+    return CORBA_string_dup (rv);
+  else
+    return CORBA_string_dup ("");
 }