Initial revision
[platform/core/uifw/at-spi2-atk.git] / libspi / atksimpleobject.c
1 #include "atksimpleobject.h"
2
3 static void atk_simple_object_class_init (AtkSimpleObjectClass *klass);
4
5 static gpointer parent_class = NULL;
6
7 GType
8 atk_simple_object_get_type (void)
9 {
10   static GType type = 0;
11
12   if (!type)
13   {
14     static const GTypeInfo tinfo =
15     {
16       sizeof (AtkSimpleObjectClass),
17       (GBaseInitFunc) NULL, /* base init */
18       (GBaseFinalizeFunc) NULL, /* base finalize */
19       (GClassInitFunc) atk_simple_object_class_init, /* class init */
20       (GClassFinalizeFunc) NULL, /* class finalize */
21       NULL, /* class data */
22       sizeof (AtkSimpleObject), /* instance size */
23       0, /* nb preallocs */
24       (GInstanceInitFunc) NULL, /* instance init */
25       NULL /* value table */
26     };
27
28     type = g_type_register_static (ATK_TYPE_OBJECT,
29                                     "AtkSimpleObject", &tinfo, 0);
30   }
31   return type;
32 }
33
34 static void
35 atk_simple_object_set_name (AtkObject *o, const gchar *name)
36 {
37   printf("set name to %s\n", name);
38   o->name = name;
39 }
40
41 static G_CONST_RETURN gchar *
42 atk_simple_object_get_name (AtkObject *o)
43 {
44   printf("get name: %s\n", o->name);
45   return (o->name);
46 }
47
48
49 static void
50 atk_simple_object_set_description (AtkObject *o, const gchar *desc)
51 {
52   printf("set description to %s\n", desc);
53   o->description = desc;
54 }
55
56 static G_CONST_RETURN gchar *
57 atk_simple_object_get_description (AtkObject *o)
58 {
59   printf("get description: %s\n", o->description);
60   return (o->description);
61 }
62
63 static void
64 atk_simple_object_class_init (AtkSimpleObjectClass *klass)
65 {
66   AtkObjectClass *oc = ATK_OBJECT_CLASS (klass);
67   parent_class = g_type_class_ref (ATK_TYPE_OBJECT);
68   oc->set_name = atk_simple_object_set_name;
69   oc->get_name = atk_simple_object_get_name;
70   oc->set_description = atk_simple_object_set_description;
71   oc->get_description = atk_simple_object_get_description;
72 }
73
74 AtkObject*
75 atk_simple_object_new ()
76 {
77   GObject *object;
78   AtkObject* accessible;
79
80   object = g_object_new (ATK_TYPE_SIMPLE_OBJECT, NULL);
81   accessible = ATK_OBJECT (object);
82
83   return accessible;
84 }
85