Initial revision
[platform/core/uifw/at-spi2-atk.git] / libspi / application.c
1 /*
2  * application.c: implements Application.idl
3  *
4  */
5 #include <config.h>
6 #include <bonobo/Bonobo.h>
7 #include "atksimpleobject.h"
8
9 /*
10  * This pulls the CORBA definitions for the "Accessibility::Accessible" server
11  */
12 #include "Desktop.h"
13
14 /*
15  * This pulls the definition for the BonoboObject (GObject Type)
16  */
17 #include "application.h"
18
19 /*
20  * Our parent Gtk object type
21  */
22 #define PARENT_TYPE ACCESSIBLE_TYPE
23
24 static void
25 application_class_init (ApplicationClass *klass)
26 {
27   ;
28 }
29
30 static void
31 application_init (Application  *application)
32 {
33   ACCESSIBLE (application)->atko = atk_simple_object_new();
34 }
35
36 GType
37 application_get_type (void)
38 {
39         static GType type = 0;
40
41         if (!type) {
42                 static const GTypeInfo tinfo = {
43                         sizeof (ApplicationClass),
44                         (GBaseInitFunc) NULL,
45                         (GBaseFinalizeFunc) NULL,
46                         (GClassInitFunc) application_class_init,
47                         (GClassFinalizeFunc) NULL,
48                         NULL, /* class data */
49                         sizeof (Application),
50                         0, /* n preallocs */
51                         (GInstanceInitFunc) application_init,
52                         NULL /* value table */
53                 };
54                 /*
55                  *   Here we use bonobo_x_type_unique instead of
56                  * gtk_type_unique, this auto-generates a load of
57                  * CORBA structures for us. All derived types must
58                  * use bonobo_x_type_unique.
59                  */
60                 type = bonobo_x_type_unique (
61                         PARENT_TYPE,
62                         POA_Accessibility_Application__init,
63                         NULL,
64                         G_STRUCT_OFFSET (ApplicationClass, epv),
65                         &tinfo,
66                         "Application");
67         }
68
69         return type;
70 }
71
72 Application *
73 application_new (char *name, char *desc, char *id)
74 {
75     Application *retval =
76                APPLICATION (g_object_new (application_get_type (), NULL));
77     atk_object_set_name (ACCESSIBLE (retval)->atko, CORBA_string_dup (name));
78     atk_object_set_description (ACCESSIBLE (retval)->atko, CORBA_string_dup (desc));
79     retval->id = CORBA_string_dup (id);
80     return retval;
81 }