Removed po directory from Makefile.am for now.
[platform/core/uifw/at-spi2-atk.git] / libspi / action.c
index 0027dfb..3154464 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-/*
- * component.c : bonobo wrapper for accessible component implementation
- *
- */
-#include <config.h>
-#include <bonobo/Bonobo.h>
+/* component.c : bonobo wrapper for accessible component implementation */
 
+#include <config.h>
 #include <stdio.h>
-
-/*
- * This pulls the CORBA definitions for the "Accessibility::Accessible" server
- */
-#include <libspi/Accessibility.h>
-
-/*
- * This pulls the definition of the Action bonobo object
- */
-#include "action.h"
+#include <libspi/action.h>
+#include <atk/atkaction.h>
 
 /*
  * Static function declarations
  */
 
 static void
-action_class_init (ActionClass *klass);
-static void
-action_init (Action *action);
+spi_action_class_init (SpiActionClass *klass);
 static void
-action_finalize (GObject *obj);
+spi_action_init (SpiAction *action);
 static CORBA_long
 impl__get_nActions(PortableServer_Servant servant,
                 CORBA_Environment * ev);
@@ -68,53 +54,15 @@ impl_getKeyBinding (PortableServer_Servant servant,
                    const CORBA_long index,
                    CORBA_Environment * ev);
 
-static GObjectClass *parent_class;
-
-GType
-action_get_type (void)
-{
-  static GType type = 0;
-
-  if (!type) {
-    static const GTypeInfo tinfo = {
-      sizeof (ActionClass),
-      (GBaseInitFunc) NULL,
-      (GBaseFinalizeFunc) NULL,
-      (GClassInitFunc) action_class_init,
-      (GClassFinalizeFunc) NULL,
-      NULL, /* class data */
-      sizeof (Action),
-      0, /* n preallocs */
-      (GInstanceInitFunc) action_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_Action__init,
-                              NULL,
-                              G_STRUCT_OFFSET (ActionClass, epv),
-                              &tinfo,
-                              "AccessibleAction");
-  }
-
-  return type;
-}
+BONOBO_TYPE_FUNC_FULL (SpiAction,
+                      Accessibility_Action,
+                      SPI_TYPE_BASE,
+                      spi_action);
 
 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;
-
 
   /* Initialize epv table */
 
@@ -126,71 +74,67 @@ action_class_init (ActionClass *klass)
 }
 
 static void
-action_init (Action *action)
+spi_action_init (SpiAction *action)
 {
 }
 
-static void
-action_finalize (GObject *obj)
+SpiAction *
+spi_action_interface_new (AtkObject *obj)
 {
-  Action *action = ACTION (obj);
-  g_object_unref (action->atko);
-  action->atko = NULL;
-  parent_class->finalize (obj);
+  SpiAction *new_action = g_object_new (SPI_ACTION_TYPE, NULL);
+
+  spi_base_construct (SPI_BASE (new_action), obj);
+
+  return new_action;
 }
 
-Action *
-action_interface_new (AtkObject *obj)
+static AtkAction *
+get_action_from_servant (PortableServer_Servant servant)
 {
-  Action *new_action = 
-    ACTION(g_object_new (ACTION_TYPE, NULL));
-  new_action->atko = obj;
-  g_object_ref (obj);
-  return new_action;
+  SpiBase *object = SPI_BASE (servant);
+  return ATK_ACTION (object->atko);
 }
 
 static CORBA_long
-impl__get_nActions(PortableServer_Servant servant,
-           CORBA_Environment * ev)
+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 (ATK_ACTION(action->atko));
+  AtkAction *action = get_action_from_servant (servant);
+  return (CORBA_long) atk_action_get_n_actions (action);
 }
 
 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 (ATK_ACTION(action->atko), (gint) index);
+  AtkAction *action = get_action_from_servant (servant);
+  return (CORBA_boolean) atk_action_do_action (action, (gint) index);
 }
 
-
 static CORBA_string
 impl_getDescription (PortableServer_Servant servant,
                const CORBA_long index,
                CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  CORBA_char *rv;
+  AtkAction *action = get_action_from_servant (servant);
+  const gchar *rv;
   
-  rv = atk_action_get_description (ATK_ACTION(action->atko), (gint) index);
+  rv = atk_action_get_description (action, (gint) index);
   if (rv)
     return CORBA_string_dup (rv);
   else
     return CORBA_string_dup ("");
 }
 
-
 static CORBA_string
 impl_getName (PortableServer_Servant servant,
                const CORBA_long index,
                CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  CORBA_char *rv;
+  AtkAction *action = get_action_from_servant (servant);
+  const gchar *rv;
   
-  rv = atk_action_get_name (ATK_ACTION(action->atko), (gint) index);
+  rv = atk_action_get_name (action, (gint) index);
   if (rv)
     return CORBA_string_dup (rv);
   else
@@ -202,10 +146,10 @@ impl_getKeyBinding (PortableServer_Servant servant,
                    const CORBA_long index,
                    CORBA_Environment * ev)
 {
-  Action *action = ACTION (bonobo_object_from_servant(servant));
-  CORBA_char *rv;
+  AtkAction *action = get_action_from_servant (servant);
+  const gchar *rv;
   
-  rv = atk_action_get_keybinding (ATK_ACTION(action->atko), (gint) index);
+  rv = atk_action_get_keybinding (action, (gint) index);
   if (rv)
     return CORBA_string_dup (rv);
   else