AmtkFactory

AmtkFactory — Factory base class

Functions

Properties

GtkApplication * application Read / Write / Construct Only
AmtkFactoryFlags default-flags Read / Write

Types and Values

Object Hierarchy

    GFlags
    ╰── AmtkFactoryFlags
    GObject
    ╰── AmtkFactory
        ╰── AmtkFactoryMenu

Includes

#include <tepl/tepl.h>

Description

AmtkFactory is a base class to create menu or toolbar items (or anything else) from AmtkActionInfo's. A factory function accesses an AmtkActionInfo from the AmtkActionInfoCentralStore.

A GtkApplication can be associated so that factory functions can call gtk_application_set_accels_for_action() with the accelerators returned by amtk_action_info_get_accels() (this erases previously set accelerators for that action, if any). Note that gtk_application_set_accels_for_action() is called by factory functions and not by amtk_action_info_store_add(), so that libraries can provide their own store and the accelerators are set to the GtkApplication only if an AmtkActionInfo is actually used.

AmtkFactoryFlags permits to control how a factory function creates the object, to ignore some steps. Factory functions should be declined in two variants: a simple form which takes the value of the “default-flags” property, and the same function with the _full suffix which takes an AmtkFactoryFlags argument and ignores the “default-flags”. See for example amtk_factory_menu_create_menu_item() and amtk_factory_menu_create_menu_item_full().

Once the objects are created, an AmtkFactory should be freed because it has a strong reference to the GtkApplication. TODO: change it to a weak ref instead so that this paragraph can be removed.

Functions

amtk_factory_get_application ()

GtkApplication *
amtk_factory_get_application (AmtkFactory *factory);

Parameters

factory

an AmtkFactory.

 

Returns

the “application”.

[transfer none]

Since: 3.0


amtk_factory_get_default_flags ()

AmtkFactoryFlags
amtk_factory_get_default_flags (AmtkFactory *factory);

Parameters

factory

an AmtkFactory.

 

Returns

the “default-flags”.

Since: 3.0


amtk_factory_set_default_flags ()

void
amtk_factory_set_default_flags (AmtkFactory *factory,
                                AmtkFactoryFlags default_flags);

Sets the “default-flags” property.

Parameters

factory

an AmtkFactory.

 

default_flags

the new value.

 

Since: 3.0

Types and Values

AmtkFactory

typedef struct _AmtkFactory AmtkFactory;

enum AmtkFactoryFlags

AmtkFactoryFlags permits to control how a factory function creates the object, to ignore some steps.

Members

AMTK_FACTORY_FLAGS_NONE

No flags.

 

AMTK_FACTORY_IGNORE_GACTION

Do not call gtk_actionable_set_action_name().

 

AMTK_FACTORY_IGNORE_ICON

Do not set an icon.

 

AMTK_FACTORY_IGNORE_LABEL

Do not set a label/short description.

 

AMTK_FACTORY_IGNORE_TOOLTIP

Do not set a tooltip/long description.

 

AMTK_FACTORY_IGNORE_ACCELS

Ignore completely the accelerators.

 

AMTK_FACTORY_IGNORE_ACCELS_FOR_DOC

Ignore the accelerators for documentation purposes only. For example do not add/configure a GtkAccelLabel.

 

AMTK_FACTORY_IGNORE_ACCELS_FOR_APP

Do not call gtk_application_set_accels_for_action().

 

Since: 3.0

Property Details

The “application” property

  “application”              GtkApplication *

The associated GtkApplication. AmtkFactory has a strong reference to the GtkApplication (which means that once the widgets are created you should free the AmtkFactory).

Flags: Read / Write / Construct Only

Since: 3.0


The “default-flags” property

  “default-flags”            AmtkFactoryFlags

The default AmtkFactoryFlags.

Flags: Read / Write

Since: 3.0