Updated libspi/.cvsignore.
[platform/core/uifw/at-spi2-atk.git] / libspi / atksimpleobject.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 #include <stdio.h>
24 #include "atksimpleobject.h"
25
26 static void atk_simple_object_class_init (AtkSimpleObjectClass *klass);
27
28 static gpointer parent_class = NULL;
29
30 GType
31 atk_simple_object_get_type (void)
32 {
33   static GType type = 0;
34
35   if (!type)
36   {
37     static const GTypeInfo tinfo =
38     {
39       sizeof (AtkSimpleObjectClass),
40       (GBaseInitFunc) NULL, /* base init */
41       (GBaseFinalizeFunc) NULL, /* base finalize */
42       (GClassInitFunc) atk_simple_object_class_init, /* class init */
43       (GClassFinalizeFunc) NULL, /* class finalize */
44       NULL, /* class data */
45       sizeof (AtkSimpleObject), /* instance size */
46       0, /* nb preallocs */
47       (GInstanceInitFunc) NULL, /* instance init */
48       NULL /* value table */
49     };
50
51     type = g_type_register_static (ATK_TYPE_OBJECT,
52                                     "AtkSimpleObject", &tinfo, 0);
53   }
54   return type;
55 }
56
57 static void
58 atk_simple_object_set_name (AtkObject *o, const gchar *name)
59 {
60   printf("set name to %s\n", name);
61   o->name = name;
62 }
63
64 static G_CONST_RETURN gchar *
65 atk_simple_object_get_name (AtkObject *o)
66 {
67   printf("get name: %s\n", o->name);
68   return (o->name);
69 }
70
71
72 static void
73 atk_simple_object_set_description (AtkObject *o, const gchar *desc)
74 {
75   printf("set description to %s\n", desc);
76   o->description = desc;
77 }
78
79 static G_CONST_RETURN gchar *
80 atk_simple_object_get_description (AtkObject *o)
81 {
82   printf("get description: %s\n", o->description);
83   return (o->description);
84 }
85
86 static void
87 atk_simple_object_class_init (AtkSimpleObjectClass *klass)
88 {
89   AtkObjectClass *oc = ATK_OBJECT_CLASS (klass);
90   parent_class = g_type_class_ref (ATK_TYPE_OBJECT);
91   oc->set_name = atk_simple_object_set_name;
92   oc->get_name = atk_simple_object_get_name;
93   oc->set_description = atk_simple_object_set_description;
94   oc->get_description = atk_simple_object_get_description;
95 }
96
97 AtkObject*
98 atk_simple_object_new ()
99 {
100   GObject *object;
101   AtkObject* accessible;
102
103   object = g_object_new (ATK_TYPE_SIMPLE_OBJECT, NULL);
104   accessible = ATK_OBJECT (object);
105
106   return accessible;
107 }
108