GrxApplication

GrxApplication — Linux console application class

Functions

Properties

gboolean is-active Read
gboolean quit-on-signal Read / Write / Construct

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── GApplication
        ╰── GrxApplication

Implemented Interfaces

GrxApplication implements GActionGroup, GActionMap and GInitable.

Includes

#include <grx-3.0.h>

Description

GrxApplication extends GApplication for applications using the Grx graphics library.

If there is a chance that your application will be run using the "linuxfb" video driver, you need to monitor the "is-active" property. If you draw on the screen when "is-active" FALSE, it interfere with the application on the active virtual terminal when switching consoles (e.g. ALT+CTRL+F1).

Functions

grx_application_new ()

GrxApplication *
grx_application_new (GError **error);

Create a new instance of GrxApplication. The console will be set to graphics mode or there will be an error if setting graphics mode failed.

Parameters

error

a pointer to a NULL GError, or NULL

 

Returns

New instance of GrxApplication or NULL if init() failed.

[nullable]


grx_application_new_full ()

GrxApplication *
grx_application_new_full (const gchar *id,
                          GApplicationFlags flags,
                          GError **error);

Create a new instance of GrxApplication. The console will be set to graphics mode or there will be an error if setting graphics mode failed.

Parameters

id

the application id or NULL.

[nullable]

flags

the application flags

 

error

a pointer to a NULL GError, or NULL

 

Returns

New instance of GrxApplication or NULL if init() failed.

[nullable]


grx_application_is_active ()

gboolean
grx_application_is_active (GrxApplication *application);

Gets the status of the “is-active” property

Parameters

application

a GrxApplication

 

Returns

TRUE if the application is active


grx_application_get_quit_on_signal ()

gboolean
grx_application_get_quit_on_signal (GrxApplication *application);

Gets the "quit-on-signal" property value.

Parameters

application

a GrxApplication

 

Returns

TRUE if the application will quit when SIGHUP, SIGINT or SIGTERM is received, otherwise FALSE.


grx_application_set_quit_on_signal ()

void
grx_application_set_quit_on_signal (GrxApplication *application,
                                    gboolean value);

Sets the "quit-on-signal" property value.

Parameters

application

a GrxApplication

 

value

TRUE will cause the application to queue a GRX_EVENT_TYPE_APP_QUIT event when SIGHUP, SIGINT or SIGTERM is received. FALSE will remove the signal handlers.

 

Types and Values

GRX_TYPE_APPLICATION

#define GRX_TYPE_APPLICATION grx_application_get_type()

struct GrxApplicationClass

struct GrxApplicationClass {
    GApplicationClass parent_class;
    gboolean (*event) (GrxApplication *application, GrxEvent *event);
    gpointer reserved[6];
};

Members

event ()

The default “event” signal handler. This handles all GRX_EVENT_TYPE_APP_* events and suppresses other events with the application is not active (“is-active” property is FALSE).

 

gpointer reserved[6];

for future use

 

GrxApplication

typedef struct _GrxApplication GrxApplication;

Class for managing the application lifecycle.

Property Details

The “is-active” property

  “is-active”                gboolean

Gets if the application is active. Applications should not draw to the screen when this property is FALSE.

Flags: Read

Default value: FALSE


The “quit-on-signal” property

  “quit-on-signal”           gboolean

Gets or sets if the application should queue a GRX_EVENT_TYPE_APP_QUIT event when SIGHUP, SIGINT or SIGTERM is received.

The default behavior is for an application to quit when any of these signals are received.

Flags: Read / Write / Construct

Default value: TRUE

Signal Details

The “event” signal

gboolean
user_function (GrxApplication *application,
               GrxEvent       *event,
               gpointer        user_data)

This signal is emitted when an event occurs. Handlers can return TRUE to prevent any further handlers from running.

Parameters

application

the object that received the signal

 

event

the event that triggered the signal

 

user_data

user data set when the signal handler was connected.

 

Returns

TRUE if the handler handled the event, or FALSE to continue propagating the event.

Flags: Run Last