widget/gtk/maiRedundantObjectFactory.c

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:8ade7181d7a4
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8 #include <atk/atk.h>
9 #include "maiRedundantObjectFactory.h"
10
11 static void mai_redundant_object_factory_class_init (
12 maiRedundantObjectFactoryClass *klass);
13
14 static AtkObject* mai_redundant_object_factory_create_accessible (
15 GObject *obj);
16 static GType mai_redundant_object_factory_get_accessible_type (void);
17
18 GType
19 mai_redundant_object_factory_get_type (void)
20 {
21 static GType type = 0;
22
23 if (!type)
24 {
25 static const GTypeInfo tinfo =
26 {
27 sizeof (maiRedundantObjectFactoryClass),
28 (GBaseInitFunc) NULL, /* base init */
29 (GBaseFinalizeFunc) NULL, /* base finalize */
30 (GClassInitFunc) mai_redundant_object_factory_class_init, /* class init */
31 (GClassFinalizeFunc) NULL, /* class finalize */
32 NULL, /* class data */
33 sizeof (maiRedundantObjectFactory), /* instance size */
34 0, /* nb preallocs */
35 (GInstanceInitFunc) NULL, /* instance init */
36 NULL /* value table */
37 };
38 type = g_type_register_static (
39 ATK_TYPE_OBJECT_FACTORY,
40 "MaiRedundantObjectFactory" , &tinfo, 0);
41 }
42
43 return type;
44 }
45
46 static void
47 mai_redundant_object_factory_class_init (maiRedundantObjectFactoryClass *klass)
48 {
49 AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
50
51 class->create_accessible = mai_redundant_object_factory_create_accessible;
52 class->get_accessible_type = mai_redundant_object_factory_get_accessible_type;
53 }
54
55 /**
56 * mai_redundant_object_factory_new:
57 *
58 * Creates an instance of an #AtkObjectFactory which generates primitive
59 * (non-functioning) #AtkObjects.
60 *
61 * Returns: an instance of an #AtkObjectFactory
62 **/
63 AtkObjectFactory*
64 mai_redundant_object_factory_new ()
65 {
66 GObject *factory;
67
68 factory = g_object_new (mai_redundant_object_factory_get_type(), NULL);
69
70 g_return_val_if_fail (factory != NULL, NULL);
71 return ATK_OBJECT_FACTORY (factory);
72 }
73
74 static AtkObject*
75 mai_redundant_object_factory_create_accessible (GObject *obj)
76 {
77 AtkObject *accessible;
78
79 g_return_val_if_fail (obj != NULL, NULL);
80
81 accessible = g_object_new (ATK_TYPE_OBJECT, NULL);
82 g_return_val_if_fail (accessible != NULL, NULL);
83
84 accessible->role = ATK_ROLE_REDUNDANT_OBJECT;
85
86 return accessible;
87 }
88
89 static GType
90 mai_redundant_object_factory_get_accessible_type ()
91 {
92 return mai_redundant_object_factory_get_type();
93 }

mercurial