65b4102f3c697d3beac96c937f960c00fac8413d
[platform/core/uifw/at-spi2-atk.git] / libspi / application.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001 Sun Microsystems Inc.
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 /*
24  * application.c: implements Application.idl
25  *
26  */
27 #include <config.h>
28 #include <bonobo/Bonobo.h>
29 #include "atksimpleobject.h"
30
31 /*
32  * This pulls the CORBA definitions for the "Accessibility::Accessible" server
33  */
34 #include "Desktop.h"
35
36 /*
37  * This pulls the definition for the BonoboObject (GObject Type)
38  */
39 #include "application.h"
40
41 /*
42  * Our parent Gtk object type
43  */
44 #define PARENT_TYPE ACCESSIBLE_TYPE
45
46 static void
47 application_class_init (ApplicationClass *klass)
48 {
49   ;
50 }
51
52 static void
53 application_init (Application  *application)
54 {
55   ACCESSIBLE (application)->atko = atk_simple_object_new();
56 }
57
58 GType
59 application_get_type (void)
60 {
61         static GType type = 0;
62
63         if (!type) {
64                 static const GTypeInfo tinfo = {
65                         sizeof (ApplicationClass),
66                         (GBaseInitFunc) NULL,
67                         (GBaseFinalizeFunc) NULL,
68                         (GClassInitFunc) application_class_init,
69                         (GClassFinalizeFunc) NULL,
70                         NULL, /* class data */
71                         sizeof (Application),
72                         0, /* n preallocs */
73                         (GInstanceInitFunc) application_init,
74                         NULL /* value table */
75                 };
76                 /*
77                  *   Here we use bonobo_x_type_unique instead of
78                  * gtk_type_unique, this auto-generates a load of
79                  * CORBA structures for us. All derived types must
80                  * use bonobo_x_type_unique.
81                  */
82                 type = bonobo_x_type_unique (
83                         PARENT_TYPE,
84                         POA_Accessibility_Application__init,
85                         NULL,
86                         G_STRUCT_OFFSET (ApplicationClass, epv),
87                         &tinfo,
88                         "Application");
89         }
90
91         return type;
92 }
93
94 Application *
95 application_new (char *name, char *desc, char *id)
96 {
97     Application *retval =
98                APPLICATION (g_object_new (application_get_type (), NULL));
99     atk_object_set_name (ACCESSIBLE (retval)->atko, CORBA_string_dup (name));
100     atk_object_set_description (ACCESSIBLE (retval)->atko, CORBA_string_dup (desc));
101     retval->id = CORBA_string_dup (id);
102     return retval;
103 }