/** * atk_object_factory_invalidate: * @factory: an #AtkObjectFactory to invalidate * * Inform @factory that it is no longer being used to create * accessibles. When called, @factory may need to inform * #AtkObjects which it has created that they need to be re-instantiated. * Note: primarily used for runtime replacement of #AtkObjectFactorys * in object registries. **/ void atk_object_factory_invalidate (AtkObjectFactory *factory) { AtkObjectFactoryClass *klass; g_return_if_fail (ATK_OBJECT_FACTORY (factory)); klass = ATK_OBJECT_FACTORY_GET_CLASS (factory); if (klass->invalidate) (klass->invalidate) (factory); }
/** * atk_object_factory_get_accessible_type: * @factory: an #AtkObjectFactory * * Gets the GType of the accessible which is created by the factory. * Returns: the type of the accessible which is created by the @factory. * The value G_TYPE_INVALID is returned if no type if found. **/ GType atk_object_factory_get_accessible_type (AtkObjectFactory *factory) { AtkObjectFactoryClass *klass; g_return_val_if_fail (ATK_OBJECT_FACTORY (factory), G_TYPE_INVALID); klass = ATK_OBJECT_FACTORY_GET_CLASS (factory); if (klass->get_accessible_type) return (klass->get_accessible_type) (); else return G_TYPE_INVALID; }
/** * atk_registry_get_factory: * @registry: an #AtkRegistry * @type: a #GType with which to look up the associated #AtkObjectFactory * * Gets an #AtkObjectFactory appropriate for creating #AtkObjects * appropriate for @type. * * Returns: an #AtkObjectFactory appropriate for creating #AtkObjects * appropriate for @type. **/ AtkObjectFactory* atk_registry_get_factory (AtkRegistry *registry, GType type) { gpointer factory_pointer = NULL; GType factory_type; factory_type = atk_registry_get_factory_type (registry, type); if (factory_type == G_TYPE_INVALID) { /* Factory type has not been specified for this object type */ static AtkObjectFactory* default_factory = NULL; if (!default_factory) default_factory = atk_no_op_object_factory_new (); return default_factory; } /* ask second hashtable for instance of factory type */ factory_pointer = g_hash_table_lookup (registry->factory_singleton_cache, (gpointer) factory_type); /* if there isn't one already, create one and save it */ if (factory_pointer == NULL) { factory_pointer = g_type_create_instance (factory_type); g_hash_table_insert (registry->factory_singleton_cache, (gpointer) factory_type, factory_pointer); } return ATK_OBJECT_FACTORY (factory_pointer); }