X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libspi%2Faction.c;h=a60af4276e7d76975e6bdd5bb6c557475e4b9d7e;hb=59568fcca2ea754f1ebb7133f29e1e0908e2af4a;hp=0268330bf2f57e9df9a9e7f19879f45daed41fc4;hpb=f546ac72097fabd106a0cf277d4db389b811014c;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/libspi/action.c b/libspi/action.c index 0268330..a60af42 100644 --- a/libspi/action.c +++ b/libspi/action.c @@ -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 @@ -25,6 +26,7 @@ #include #include #include +#include /* * Static function declarations @@ -34,8 +36,6 @@ static void spi_action_class_init (SpiActionClass *klass); static void spi_action_init (SpiAction *action); -static void -spi_action_finalize (GObject *obj); static CORBA_long impl__get_nActions(PortableServer_Servant servant, CORBA_Environment * ev); @@ -55,22 +55,15 @@ impl_getKeyBinding (PortableServer_Servant servant, const CORBA_long index, CORBA_Environment * ev); -static GObjectClass *parent_class; - BONOBO_TYPE_FUNC_FULL (SpiAction, Accessibility_Action, - BONOBO_TYPE_OBJECT, - spi_action); + SPI_TYPE_BASE, + spi_action) static void 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 = spi_action_finalize; - /* Initialize epv table */ @@ -86,67 +79,66 @@ spi_action_init (SpiAction *action) { } -static void -spi_action_finalize (GObject *obj) -{ - SpiAction *action = SPI_ACTION (obj); - g_object_unref (action->atko); - action->atko = NULL; - parent_class->finalize (obj); -} - SpiAction * spi_action_interface_new (AtkObject *obj) { - SpiAction *new_action = - SPI_ACTION(g_object_new (SPI_ACTION_TYPE, NULL)); - new_action->atko = obj; - g_object_ref (obj); + SpiAction *new_action = g_object_new (SPI_ACTION_TYPE, NULL); + + spi_base_construct (SPI_BASE (new_action), G_OBJECT(obj)); + return new_action; } +static AtkAction * +get_action_from_servant (PortableServer_Servant servant) +{ + 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 -impl__get_nActions(PortableServer_Servant servant, - CORBA_Environment * ev) +impl__get_nActions (PortableServer_Servant servant, + CORBA_Environment *ev) { - SpiAction *action = SPI_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 atk_action_get_n_actions (action); } static CORBA_boolean impl_doAction (PortableServer_Servant servant, const CORBA_long index, CORBA_Environment * ev) { - SpiAction *action = SPI_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 atk_action_do_action (action, (gint) index); } - static CORBA_string impl_getDescription (PortableServer_Servant servant, const CORBA_long index, CORBA_Environment * ev) { - SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant)); + 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, 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) { - SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant)); + 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, index); if (rv) return CORBA_string_dup (rv); else @@ -158,10 +150,10 @@ impl_getKeyBinding (PortableServer_Servant servant, const CORBA_long index, CORBA_Environment * ev) { - SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant)); + 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, index); if (rv) return CORBA_string_dup (rv); else