michael@0: /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:expandtab:shiftwidth=2:tabstop=2: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include "maiRedundantObjectFactory.h" michael@0: michael@0: static void mai_redundant_object_factory_class_init ( michael@0: maiRedundantObjectFactoryClass *klass); michael@0: michael@0: static AtkObject* mai_redundant_object_factory_create_accessible ( michael@0: GObject *obj); michael@0: static GType mai_redundant_object_factory_get_accessible_type (void); michael@0: michael@0: GType michael@0: mai_redundant_object_factory_get_type (void) michael@0: { michael@0: static GType type = 0; michael@0: michael@0: if (!type) michael@0: { michael@0: static const GTypeInfo tinfo = michael@0: { michael@0: sizeof (maiRedundantObjectFactoryClass), michael@0: (GBaseInitFunc) NULL, /* base init */ michael@0: (GBaseFinalizeFunc) NULL, /* base finalize */ michael@0: (GClassInitFunc) mai_redundant_object_factory_class_init, /* class init */ michael@0: (GClassFinalizeFunc) NULL, /* class finalize */ michael@0: NULL, /* class data */ michael@0: sizeof (maiRedundantObjectFactory), /* instance size */ michael@0: 0, /* nb preallocs */ michael@0: (GInstanceInitFunc) NULL, /* instance init */ michael@0: NULL /* value table */ michael@0: }; michael@0: type = g_type_register_static ( michael@0: ATK_TYPE_OBJECT_FACTORY, michael@0: "MaiRedundantObjectFactory" , &tinfo, 0); michael@0: } michael@0: michael@0: return type; michael@0: } michael@0: michael@0: static void michael@0: mai_redundant_object_factory_class_init (maiRedundantObjectFactoryClass *klass) michael@0: { michael@0: AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); michael@0: michael@0: class->create_accessible = mai_redundant_object_factory_create_accessible; michael@0: class->get_accessible_type = mai_redundant_object_factory_get_accessible_type; michael@0: } michael@0: michael@0: /** michael@0: * mai_redundant_object_factory_new: michael@0: * michael@0: * Creates an instance of an #AtkObjectFactory which generates primitive michael@0: * (non-functioning) #AtkObjects. michael@0: * michael@0: * Returns: an instance of an #AtkObjectFactory michael@0: **/ michael@0: AtkObjectFactory* michael@0: mai_redundant_object_factory_new () michael@0: { michael@0: GObject *factory; michael@0: michael@0: factory = g_object_new (mai_redundant_object_factory_get_type(), NULL); michael@0: michael@0: g_return_val_if_fail (factory != NULL, NULL); michael@0: return ATK_OBJECT_FACTORY (factory); michael@0: } michael@0: michael@0: static AtkObject* michael@0: mai_redundant_object_factory_create_accessible (GObject *obj) michael@0: { michael@0: AtkObject *accessible; michael@0: michael@0: g_return_val_if_fail (obj != NULL, NULL); michael@0: michael@0: accessible = g_object_new (ATK_TYPE_OBJECT, NULL); michael@0: g_return_val_if_fail (accessible != NULL, NULL); michael@0: michael@0: accessible->role = ATK_ROLE_REDUNDANT_OBJECT; michael@0: michael@0: return accessible; michael@0: } michael@0: michael@0: static GType michael@0: mai_redundant_object_factory_get_accessible_type () michael@0: { michael@0: return mai_redundant_object_factory_get_type(); michael@0: }