2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 /* component.c : bonobo wrapper for accessible component implementation */
27 #include <libspi/action.h>
30 * Static function declarations
34 spi_action_class_init (SpiActionClass *klass);
36 spi_action_init (SpiAction *action);
38 spi_action_finalize (GObject *obj);
40 impl__get_nActions(PortableServer_Servant servant,
41 CORBA_Environment * ev);
43 impl_getDescription (PortableServer_Servant servant,
44 const CORBA_long index,
45 CORBA_Environment * ev);
47 impl_doAction (PortableServer_Servant servant,
48 const CORBA_long index, CORBA_Environment * ev);
50 impl_getName (PortableServer_Servant servant,
51 const CORBA_long index,
52 CORBA_Environment * ev);
54 impl_getKeyBinding (PortableServer_Servant servant,
55 const CORBA_long index,
56 CORBA_Environment * ev);
58 static GObjectClass *parent_class;
60 BONOBO_TYPE_FUNC_FULL (SpiAction,
66 spi_action_class_init (SpiActionClass *klass)
68 GObjectClass * object_class = (GObjectClass *) klass;
69 POA_Accessibility_Action__epv *epv = &klass->epv;
70 parent_class = g_type_class_peek_parent (klass);
72 object_class->finalize = spi_action_finalize;
75 /* Initialize epv table */
77 epv->_get_nActions = impl__get_nActions;
78 epv->doAction = impl_doAction;
79 epv->getDescription = impl_getDescription;
80 epv->getName = impl_getName;
81 epv->getKeyBinding = impl_getKeyBinding;
85 spi_action_init (SpiAction *action)
90 spi_action_finalize (GObject *obj)
92 SpiAction *action = SPI_ACTION (obj);
93 g_object_unref (action->atko);
95 parent_class->finalize (obj);
99 spi_action_interface_new (AtkObject *obj)
101 SpiAction *new_action =
102 SPI_ACTION(g_object_new (SPI_ACTION_TYPE, NULL));
103 new_action->atko = obj;
109 impl__get_nActions(PortableServer_Servant servant,
110 CORBA_Environment * ev)
112 SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
113 return (CORBA_long) atk_action_get_n_actions (ATK_ACTION(action->atko));
117 impl_doAction (PortableServer_Servant servant,
118 const CORBA_long index, CORBA_Environment * ev)
120 SpiAction *action = SPI_ACTION (bonobo_object_from_servant (servant));
121 return (CORBA_boolean) atk_action_do_action (ATK_ACTION(action->atko), (gint) index);
126 impl_getDescription (PortableServer_Servant servant,
127 const CORBA_long index,
128 CORBA_Environment * ev)
130 SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
133 rv = atk_action_get_description (ATK_ACTION(action->atko), (gint) index);
135 return CORBA_string_dup (rv);
137 return CORBA_string_dup ("");
142 impl_getName (PortableServer_Servant servant,
143 const CORBA_long index,
144 CORBA_Environment * ev)
146 SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
149 rv = atk_action_get_name (ATK_ACTION(action->atko), (gint) index);
151 return CORBA_string_dup (rv);
153 return CORBA_string_dup ("");
157 impl_getKeyBinding (PortableServer_Servant servant,
158 const CORBA_long index,
159 CORBA_Environment * ev)
161 SpiAction *action = SPI_ACTION (bonobo_object_from_servant(servant));
164 rv = atk_action_get_keybinding (ATK_ACTION(action->atko), (gint) index);
166 return CORBA_string_dup (rv);
168 return CORBA_string_dup ("");