TeplAbstractFactoryVala: Tepl 4 Reference Manual

## TeplAbstractFactoryVala TeplAbstractFactoryVala — TeplAbstractFactory subclass to work-around Vala bugs |

## Functions

void | tepl_abstract_factory_vala_set_singleton_vala ()
GtkApplicationWindow * | tepl_abstract_factory_vala_create_main_window_vala ()

## Types and Values

| TeplAbstractFactoryVala
struct | TeplAbstractFactoryValaClass

## Object Hierarchy

        GObject
        ╰── TeplAbstractFactory
            ╰── TeplAbstractFactoryVala

## Includes

    #include <tepl/tepl.h>

## Description

TeplAbstractFactoryVala is a subclass of TeplAbstractFactory to work-around Vala bugs.

There are two bugs:

- See `tepl_abstract_factory_vala_set_singleton_vala()`.

- For the functions or vfuncs in TeplAbstractFactory which have a (transfer floating) return value: apparently when a Vala function returns a newly created GInitiallyUnowned object, the return value is (transfer full). Which is not correct, it should be (transfer floating) instead (i.e. equal to (transfer none)). So to be able to implement easily those vfuncs in Vala, new Vala-specific vfuncs have been added which have a (transfer full) return value. The original vfuncs are implemented by TeplAbstractFactoryVala by calling the Vala ones and transforming the strong ref into a floating ref.

It would have been possible to modify the TeplAbstractFactory API so that it's usable in Vala as well, but in that case the API would be less convenient and less natural in C. So TeplAbstractFactoryVala has been implemented as something separate, to not clutter TeplAbstractFactory.

## Functions

### tepl_abstract_factory_vala_set_singleton_vala ()

    void
    tepl_abstract_factory_vala_set_singleton_vala
                                   (TeplAbstractFactoryVala *factory_vala);

Like `tepl_abstract_factory_set_singleton()`, but with (transfer none) for the `factory_vala` parameter.

Apparently Vala doesn't support (transfer full) for the self parameter, resulting to a double unref if `tepl_abstract_factory_set_singleton()` is called in Vala...

#### Parameters

factory_vala | a TeplAbstractFactoryVala. | [transfer none]

Since: 4.0

### tepl_abstract_factory_vala_create_main_window_vala ()

    GtkApplicationWindow *
    tepl_abstract_factory_vala_create_main_window_vala
                                   (TeplAbstractFactoryVala *factory_vala,
                                    GtkApplication *app);

Like `tepl_abstract_factory_create_main_window()`, but with a (transfer full) return value.

#### Parameters

factory_vala | the TeplAbstractFactoryVala. |
app | a GtkApplication. |

#### Returns

a new main application window, or `NULL` if the vfunc is not implemented.

[transfer full][nullable]

Since: 4.0

## Types and Values

### TeplAbstractFactoryVala

    typedef struct _TeplAbstractFactoryVala TeplAbstractFactoryVala;

### struct TeplAbstractFactoryValaClass

    struct TeplAbstractFactoryValaClass {
    	TeplAbstractFactoryClass parent_class;

    	GtkApplicationWindow * (* create_main_window_vala) (TeplAbstractFactoryVala *factory_vala,
    								 GtkApplication          *app);
    };

#### Members

`create_main_window_vala` () | Virtual function pointer for `tepl_abstract_factory_vala_create_main_window_vala()`. It is not implemented by default. The TeplAbstractFactory ::create_main_window vfunc is implemented by TeplAbstractFactoryVala by calling `tepl_abstract_factory_vala_create_main_window_vala()` and adapting the ref. |