1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/gtk/maiRedundantObjectFactory.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,93 @@ 1.4 +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:expandtab:shiftwidth=2:tabstop=2: 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#include <atk/atk.h> 1.12 +#include "maiRedundantObjectFactory.h" 1.13 + 1.14 +static void mai_redundant_object_factory_class_init ( 1.15 + maiRedundantObjectFactoryClass *klass); 1.16 + 1.17 +static AtkObject* mai_redundant_object_factory_create_accessible ( 1.18 + GObject *obj); 1.19 +static GType mai_redundant_object_factory_get_accessible_type (void); 1.20 + 1.21 +GType 1.22 +mai_redundant_object_factory_get_type (void) 1.23 +{ 1.24 + static GType type = 0; 1.25 + 1.26 + if (!type) 1.27 + { 1.28 + static const GTypeInfo tinfo = 1.29 + { 1.30 + sizeof (maiRedundantObjectFactoryClass), 1.31 + (GBaseInitFunc) NULL, /* base init */ 1.32 + (GBaseFinalizeFunc) NULL, /* base finalize */ 1.33 + (GClassInitFunc) mai_redundant_object_factory_class_init, /* class init */ 1.34 + (GClassFinalizeFunc) NULL, /* class finalize */ 1.35 + NULL, /* class data */ 1.36 + sizeof (maiRedundantObjectFactory), /* instance size */ 1.37 + 0, /* nb preallocs */ 1.38 + (GInstanceInitFunc) NULL, /* instance init */ 1.39 + NULL /* value table */ 1.40 + }; 1.41 + type = g_type_register_static ( 1.42 + ATK_TYPE_OBJECT_FACTORY, 1.43 + "MaiRedundantObjectFactory" , &tinfo, 0); 1.44 + } 1.45 + 1.46 + return type; 1.47 +} 1.48 + 1.49 +static void 1.50 +mai_redundant_object_factory_class_init (maiRedundantObjectFactoryClass *klass) 1.51 +{ 1.52 + AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass); 1.53 + 1.54 + class->create_accessible = mai_redundant_object_factory_create_accessible; 1.55 + class->get_accessible_type = mai_redundant_object_factory_get_accessible_type; 1.56 +} 1.57 + 1.58 +/** 1.59 + * mai_redundant_object_factory_new: 1.60 + * 1.61 + * Creates an instance of an #AtkObjectFactory which generates primitive 1.62 + * (non-functioning) #AtkObjects. 1.63 + * 1.64 + * Returns: an instance of an #AtkObjectFactory 1.65 + **/ 1.66 +AtkObjectFactory* 1.67 +mai_redundant_object_factory_new () 1.68 +{ 1.69 + GObject *factory; 1.70 + 1.71 + factory = g_object_new (mai_redundant_object_factory_get_type(), NULL); 1.72 + 1.73 + g_return_val_if_fail (factory != NULL, NULL); 1.74 + return ATK_OBJECT_FACTORY (factory); 1.75 +} 1.76 + 1.77 +static AtkObject* 1.78 +mai_redundant_object_factory_create_accessible (GObject *obj) 1.79 +{ 1.80 + AtkObject *accessible; 1.81 + 1.82 + g_return_val_if_fail (obj != NULL, NULL); 1.83 + 1.84 + accessible = g_object_new (ATK_TYPE_OBJECT, NULL); 1.85 + g_return_val_if_fail (accessible != NULL, NULL); 1.86 + 1.87 + accessible->role = ATK_ROLE_REDUNDANT_OBJECT; 1.88 + 1.89 + return accessible; 1.90 +} 1.91 + 1.92 +static GType 1.93 +mai_redundant_object_factory_get_accessible_type () 1.94 +{ 1.95 + return mai_redundant_object_factory_get_type(); 1.96 +}