AgsApplicationContext

AgsApplicationContext — the application context

Stability Level

Stable, unless otherwise indicated

Functions

Properties

GObject * config Read / Write
GObject * file Read / Write
GObject * main-loop Read / Write
GObject * task-launcher Read / Write

Signals

void load-config Run Last
void prepare Run Last
void quit Run Last
void register-types Run Last
void setup Run Last

Types and Values

Object Hierarchy

    GFlags
    ╰── AgsApplicationContextFlags
    GObject
    ╰── AgsApplicationContext
        ├── AgsServerApplicationContext
        ╰── AgsThreadApplicationContext

Includes

#include <ags/object/ags_application_context.h>

Description

AgsApplicationContext is a context provider is your and libraries entry point to the application. You might subtype it to implement your own contices. Thus you should consider to create a provider interface for reusability.

Use this code to retrieve application context:

1
AgsApplicationContext *application_context = ags_application_context_get_instance();

AgsApplicationContext itself doesn't implement any provider interfaces, so you need to instantiate a specific application context first, before you get the singleton.

For example with AgsThreadApplicationContext implementing AgsConcurrencyProvider:

1
2
3
4
5
6
7
8
9
AgsThread *main_loop;

AgsApplicationContext *application_context;

ags_thread_application_context_new();

application_context = ags_application_context_get_instance();

main_loop = ags_concurrency_provider_get_main_loop(AGS_CONCURRENCY_PROVIDER(application_context));

Functions

AGS_APPLICATION_CONTEXT_GET_OBJ_MUTEX()

#define AGS_APPLICATION_CONTEXT_GET_OBJ_MUTEX(obj) (&(((AgsApplicationContext *) obj)->obj_mutex))

ags_application_context_test_flags ()

gboolean
ags_application_context_test_flags (AgsApplicationContext *application_context,
                                    AgsApplicationContextFlags flags);

Test flags to be set on application_context .

Parameters

application_context

the AgsApplicationContext

 

flags

the flags

 

Returns

TRUE if flags are set, else FALSE

Since: 3.0.0


ags_application_context_set_flags ()

void
ags_application_context_set_flags (AgsApplicationContext *application_context,
                                   AgsApplicationContextFlags flags);

Enable a feature of AgsApplicationContext.

Parameters

application_context

the AgsApplicationContext

 

flags

see enum AgsApplicationContextFlags

 

Since: 3.0.0


ags_application_context_unset_flags ()

void
ags_application_context_unset_flags (AgsApplicationContext *application_context,
                                     AgsApplicationContextFlags flags);

Disable a feature of AgsApplicationContext.

Parameters

application_context

the AgsApplicationContext

 

flags

see enum AgsApplicationContextFlags

 

Since: 3.0.0


ags_application_context_load_config ()

void
ags_application_context_load_config (AgsApplicationContext *application_context);

Signal to load and parse configuration.

Parameters

application_context

the AgsApplicationContext

 

Since: 3.0.0


ags_application_context_prepare ()

void
ags_application_context_prepare (AgsApplicationContext *application_context);

Prepare application_context .

Parameters

application_context

the AgsApplicationContext

 

Since: 3.0.0


ags_application_context_setup ()

void
ags_application_context_setup (AgsApplicationContext *application_context);

Setup application_context .

Parameters

application_context

the AgsApplicationContext

 

Since: 3.0.0


ags_application_context_register_types ()

void
ags_application_context_register_types
                               (AgsApplicationContext *application_context);

Notification to register your types.

Parameters

application_context

the AgsApplicationContext

 

Since: 3.0.0


ags_application_context_quit ()

void
ags_application_context_quit (AgsApplicationContext *application_context);

Calls exit()

Parameters

application_context

the AgsApplicationContext

 

Since: 3.0.0


ags_application_context_get_instance ()

AgsApplicationContext *
ags_application_context_get_instance ();

Get your application context instance.

Returns

the AgsApplicationContext instance.

[transfer none]

Since: 3.0.0


ags_application_context_new ()

AgsApplicationContext *
ags_application_context_new (GObject *main_loop,
                             AgsConfig *config);

Create a new instance of AgsApplicationContext

Parameters

main_loop

the AgsMainLoop.

[nullable]

config

the AgsConfig.

[nullable]

Returns

the AgsApplicationContext instance

Since: 3.0.0

Types and Values

AGS_VERSION

#define AGS_VERSION "6.3.0"

AGS_BUILD_ID

#define AGS_BUILD_ID "Wed Jan 10 08:49:34 UTC 2024"

AGS_DEFAULT_DIRECTORY

#define AGS_DEFAULT_DIRECTORY ".gsequencer"

AGS_DEFAULT_CONFIG

#define AGS_DEFAULT_CONFIG "ags.conf"

AGS_DEFAULT_BUNDLE_ID

#define AGS_DEFAULT_BUNDLE_ID "org.nongnu.gsequencer.gsequencer"

enum AgsApplicationContextFlags

Enum values to control the behavior or indicate internal state of AgsApplicationContext by enable/disable as flags.

Members

AGS_APPLICATION_CONTEXT_TYPES_REGISTERED

indicates the types have been registered

 

Property Details

The “config” property

  “config”                   GObject *

The assigned config.

Owner: AgsApplicationContext

Flags: Read / Write

Since: 3.0.0


The “file” property

  “file”                     GObject *

The assigned file.

Owner: AgsApplicationContext

Flags: Read / Write

Since: 3.0.0


The “main-loop” property

  “main-loop”                GObject *

The assigned main-loop.

Owner: AgsApplicationContext

Flags: Read / Write

Since: 3.0.0


The “task-launcher” property

  “task-launcher”            GObject *

The assigned task launcher.

Owner: AgsApplicationContext

Flags: Read / Write

Since: 3.0.0

Signal Details

The “load-config” signal

void
user_function (AgsApplicationContext *application_context,
               gpointer               user_data)

The ::load-config notifies to load configuration.

Parameters

application_context

the AgsApplicationContext

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0


The “prepare” signal

void
user_function (AgsApplicationContext *application_context,
               gpointer               user_data)

The ::prepare signal should be implemented to prepare your application context.

Parameters

application_context

the AgsApplicationContext

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0


The “quit” signal

void
user_function (AgsApplicationContext *application_context,
               gpointer               user_data)

The ::quit notifies to load configuration.

Parameters

application_context

the AgsApplicationContext

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0


The “register-types” signal

void
user_function (AgsApplicationContext *application_context,
               gpointer               user_data)

The ::register-types signal should be implemented to load your types.

Parameters

application_context

the AgsApplicationContext

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0


The “setup” signal

void
user_function (AgsApplicationContext *application_context,
               gpointer               user_data)

The ::setup signal should be implemented to setup your application context.

Parameters

application_context

the AgsApplicationContext

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0