Registry

For this example we will assume there is an object called GTK_TYPE_MYTYPE. The ATK implementation will be called MYATKIMP_TYPE_MYTYPE. A factory will be needed which will be called MYATKIMP_TYPE_MYTYPE_FACTORY.

To register an ATK implementation of a GTK object, these steps must be followed in the module's gtk_module_init() function:

  1. Access the default registry:

    default_registry = atk_get_default_registry();
    
  2. Register the ATK object in the gtk_module_init() function of this module by making this function call:

    atk_registry_set_factory_type (default_registry, GTK_TYPE_MYTYPE, 
    MYATKIMP_TYPE_MYTYPE_FACTORY); 
    

This will register the AtkObject implementation of GTK_TYPE_MYTYPE to MYATKIMP_TYPE_MYTYPE_FACTORY. This factory will be implemented so that it knows how to build objects of type MYATKIMP_TYPE_MYTYPE.