widget/gtk/maiRedundantObjectFactory.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial