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.
24 * component.c : bonobo wrapper for accessible component implementation
28 #include <bonobo/Bonobo.h>
33 * This pulls the CORBA definitions for the "Accessibility::Accessible" server
35 #include <libspi/Accessibility.h>
38 * This pulls the definition of the Action bonobo object
43 * Static function declarations
47 action_class_init (ActionClass *klass);
49 action_init (Action *action);
51 action_finalize (GObject *obj);
53 impl__get_nActions(PortableServer_Servant servant,
54 CORBA_Environment * ev);
56 impl_getDescription (PortableServer_Servant servant,
57 const CORBA_long index,
58 CORBA_Environment * ev);
60 impl_doAction (PortableServer_Servant servant,
61 const CORBA_long index, CORBA_Environment * ev);
63 impl_getName (PortableServer_Servant servant,
64 const CORBA_long index,
65 CORBA_Environment * ev);
67 impl_getKeyBinding (PortableServer_Servant servant,
68 const CORBA_long index,
69 CORBA_Environment * ev);
71 static GObjectClass *parent_class;
74 action_get_type (void)
76 static GType type = 0;
79 static const GTypeInfo tinfo = {
82 (GBaseFinalizeFunc) NULL,
83 (GClassInitFunc) action_class_init,
84 (GClassFinalizeFunc) NULL,
85 NULL, /* class data */
88 (GInstanceInitFunc) action_init,
89 NULL /* value table */
93 * Bonobo_type_unique auto-generates a load of
94 * CORBA structures for us. All derived types must
95 * use bonobo_type_unique.
97 type = bonobo_type_unique (
99 POA_Accessibility_Action__init,
101 G_STRUCT_OFFSET (ActionClass, epv),
110 action_class_init (ActionClass *klass)
112 GObjectClass * object_class = (GObjectClass *) klass;
113 POA_Accessibility_Action__epv *epv = &klass->epv;
114 parent_class = g_type_class_peek_parent (klass);
116 object_class->finalize = action_finalize;
119 /* Initialize epv table */
121 epv->_get_nActions = impl__get_nActions;
122 epv->doAction = impl_doAction;
123 epv->getDescription = impl_getDescription;
124 epv->getName = impl_getName;
125 epv->getKeyBinding = impl_getKeyBinding;
129 action_init (Action *action)
134 action_finalize (GObject *obj)
136 Action *action = ACTION (obj);
137 g_object_unref (action->atko);
139 parent_class->finalize (obj);
143 action_interface_new (AtkObject *obj)
146 ACTION(g_object_new (ACTION_TYPE, NULL));
147 new_action->atko = obj;
153 impl__get_nActions(PortableServer_Servant servant,
154 CORBA_Environment * ev)
156 Action *action = ACTION (bonobo_object_from_servant(servant));
157 return (CORBA_long) atk_action_get_n_actions (ATK_ACTION(action->atko));
161 impl_doAction (PortableServer_Servant servant,
162 const CORBA_long index, CORBA_Environment * ev)
164 Action *action = ACTION (bonobo_object_from_servant (servant));
165 return (CORBA_boolean) atk_action_do_action (ATK_ACTION(action->atko), (gint) index);
170 impl_getDescription (PortableServer_Servant servant,
171 const CORBA_long index,
172 CORBA_Environment * ev)
174 Action *action = ACTION (bonobo_object_from_servant(servant));
175 return CORBA_string_dup (atk_action_get_description (ATK_ACTION(action->atko), (gint) index));
180 impl_getName (PortableServer_Servant servant,
181 const CORBA_long index,
182 CORBA_Environment * ev)
184 Action *action = ACTION (bonobo_object_from_servant(servant));
185 return CORBA_string_dup (atk_action_get_name (ATK_ACTION(action->atko), (gint) index));
189 impl_getKeyBinding (PortableServer_Servant servant,
190 const CORBA_long index,
191 CORBA_Environment * ev)
193 Action *action = ACTION (bonobo_object_from_servant(servant));
194 return CORBA_string_dup (atk_action_get_keybinding (ATK_ACTION(action->atko), (gint) index));