2007-12-03 Li Yuan <li.yuan@sun.com>
[platform/core/uifw/at-spi2-atk.git] / libspi / action.c
index 3154464..a60af42 100644 (file)
@@ -2,7 +2,8 @@
  * AT-SPI - Assistive Technology Service Provider Interface
  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
  *
- * Copyright 2001 Sun Microsystems Inc.
+ * 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
@@ -57,7 +58,7 @@ impl_getKeyBinding (PortableServer_Servant servant,
 BONOBO_TYPE_FUNC_FULL (SpiAction,
                       Accessibility_Action,
                       SPI_TYPE_BASE,
-                      spi_action);
+                      spi_action)
 
 static void
 spi_action_class_init (SpiActionClass *klass)
@@ -83,7 +84,7 @@ spi_action_interface_new (AtkObject *obj)
 {
   SpiAction *new_action = g_object_new (SPI_ACTION_TYPE, NULL);
 
-  spi_base_construct (SPI_BASE (new_action), obj);
+  spi_base_construct (SPI_BASE (new_action), G_OBJECT(obj));
 
   return new_action;
 }
@@ -91,8 +92,11 @@ spi_action_interface_new (AtkObject *obj)
 static AtkAction *
 get_action_from_servant (PortableServer_Servant servant)
 {
-  SpiBase *object = SPI_BASE (servant);
-  return ATK_ACTION (object->atko);
+  SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
+  g_return_val_if_fail (object != NULL, NULL);
+  /* the convention of making hyperlinks actionable breaks the assertion below */
+  /* g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); */
+  return ATK_ACTION (object->gobj);
 }
 
 static CORBA_long
@@ -100,7 +104,7 @@ impl__get_nActions (PortableServer_Servant servant,
                    CORBA_Environment     *ev)
 {
   AtkAction *action = get_action_from_servant (servant);
-  return (CORBA_long) atk_action_get_n_actions (action);
+  return atk_action_get_n_actions (action);
 }
 
 static CORBA_boolean
@@ -108,7 +112,7 @@ impl_doAction (PortableServer_Servant servant,
               const CORBA_long index, CORBA_Environment * ev)
 {
   AtkAction *action = get_action_from_servant (servant);
-  return (CORBA_boolean) atk_action_do_action (action, (gint) index);
+  return atk_action_do_action (action, (gint) index);
 }
 
 static CORBA_string
@@ -119,7 +123,7 @@ impl_getDescription (PortableServer_Servant servant,
   AtkAction *action = get_action_from_servant (servant);
   const gchar *rv;
   
-  rv = atk_action_get_description (action, (gint) index);
+  rv = atk_action_get_description (action, index);
   if (rv)
     return CORBA_string_dup (rv);
   else
@@ -134,7 +138,7 @@ impl_getName (PortableServer_Servant servant,
   AtkAction *action = get_action_from_servant (servant);
   const gchar *rv;
   
-  rv = atk_action_get_name (action, (gint) index);
+  rv = atk_action_get_name (action, index);
   if (rv)
     return CORBA_string_dup (rv);
   else
@@ -149,7 +153,7 @@ impl_getKeyBinding (PortableServer_Servant servant,
   AtkAction *action = get_action_from_servant (servant);
   const gchar *rv;
   
-  rv = atk_action_get_keybinding (action, (gint) index);
+  rv = atk_action_get_keybinding (action, index);
   if (rv)
     return CORBA_string_dup (rv);
   else