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 * application.c: implements Application.idl
28 #include <bonobo/Bonobo.h>
29 #include <atk/atkutil.h>
32 * This pulls the CORBA definitions for the "Accessibility::Accessible" server
34 #include <libspi/Accessibility.h>
37 * This pulls the definition for the BonoboObject (GObject Type)
39 #include "application.h"
42 * Our parent Gtk object type
44 #define PARENT_TYPE ACCESSIBLE_TYPE
47 * A pointer to our parent object class
49 static AccessibleClass *application_parent_class;
52 * Implemented GObject::finalize
55 accessible_application_finalize (GObject *object)
57 /* TODO: any necessary cleanup */
58 Accessible *accessible = ACCESSIBLE (object);
60 g_object_unref (accessible->atko);
61 accessible->atko = NULL;
63 /* TODO: chain to parent class instead */
67 impl_accessibility_application_get_toolkit_name (PortableServer_Servant servant,
68 CORBA_Environment *ev)
71 Application *application = APPLICATION (bonobo_object_from_servant (servant));
72 retval = CORBA_string_dup (atk_get_toolkit_name ());
77 impl_accessibility_application_get_version (PortableServer_Servant servant,
78 CORBA_Environment *ev)
81 Application *application = APPLICATION (bonobo_object_from_servant (servant));
82 retval = CORBA_string_dup (atk_get_toolkit_version ());
87 impl_accessibility_application_get_id (PortableServer_Servant servant,
88 CORBA_Environment *ev)
91 Application *application = APPLICATION (bonobo_object_from_servant (servant));
92 retval = CORBA_string_dup (application->id);
97 impl_accessibility_application_set_id (PortableServer_Servant servant,
99 CORBA_Environment *ev)
101 Application *application = APPLICATION (bonobo_object_from_servant (servant));
102 application->id = id;
106 application_class_init (ApplicationClass *klass)
108 GObjectClass * object_class = (GObjectClass *) klass;
109 POA_Accessibility_Application__epv *epv = &klass->epv;
111 application_parent_class = g_type_class_ref (ACCESSIBLE_TYPE);
113 object_class->finalize = accessible_application_finalize;
115 epv->_get_toolkitName = impl_accessibility_application_get_toolkit_name;
116 epv->_get_version = impl_accessibility_application_get_version;
117 epv->_get_id = impl_accessibility_application_get_id;
118 epv->_set_id = impl_accessibility_application_set_id;
122 application_init (Application *application)
124 ACCESSIBLE (application)->atko = g_object_new (atk_object_get_type(), NULL);
128 application_get_type (void)
130 static GType type = 0;
133 static const GTypeInfo tinfo = {
134 sizeof (ApplicationClass),
135 (GBaseInitFunc) NULL,
136 (GBaseFinalizeFunc) NULL,
137 (GClassInitFunc) application_class_init,
138 (GClassFinalizeFunc) NULL,
139 NULL, /* class data */
140 sizeof (Application),
142 (GInstanceInitFunc) application_init,
143 NULL /* value table */
146 * Bonobo_type_unique auto-generates a load of
147 * CORBA structures for us. All derived types must
148 * use bonobo_type_unique.
150 type = bonobo_type_unique (
152 POA_Accessibility_Application__init,
154 G_STRUCT_OFFSET (ApplicationClass, epv),
163 application_new (AtkObject *app_root)
165 Application *retval =
166 APPLICATION (g_object_new (application_get_type (), NULL));
167 ACCESSIBLE (retval)->atko = app_root;