# Gio::Application Class Reference

TODO. More...

`#include <giomm/application.h>`

Inheritance diagram for Gio::Application:
[legend]

List of all members.

## Public Member Functions

virtual | ~Application ()
GApplication* | gobj ()
| Provides access to the underlying C GObject.
const GApplication* | gobj () const
| Provides access to the underlying C GObject.
GApplication* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::ustring | get_id () const
void | set_id (const Glib::ustring& application_id)
guint | get_inactivity_timeout () const
void | set_inactivity_timeout (guint inactivity_timeout)
ApplicationFlags | get_flags () const
void | set_flags (ApplicationFlags flags)
void | set_action_group (const Glib::RefPtr< ActionGroup >& action_group)
bool | is_registered () const
bool | is_remote () const
bool | register_application (const Glib::RefPtr< Gio::Cancellable >& cancellable)
| By default, Application ensures process uniqueness when initialized, but this behavior is controlled by the GApplication:register property.
void | hold ()
void | release ()
void | activate ()
void | run (int argc, char** argv)
| Starts the application.
Glib::PropertyProxy_WriteOnly < Glib::RefPtr< ActionGroup > > | property_action_group ()
| The group of actions that the application exports.
Glib::PropertyProxy < Glib::ustring > | property_application_id ()
| The unique identifier for the application.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_application_id () const
| The unique identifier for the application.
Glib::PropertyProxy < ApplicationFlags > | property_flags ()
| Flags specifying the behaviour of the application.
Glib::PropertyProxy_ReadOnly < ApplicationFlags > | property_flags () const
| Flags specifying the behaviour of the application.
Glib::PropertyProxy< guint > | property_inactivity_timeout ()
| Iime (ms) to stay alive after becoming idle.
Glib::PropertyProxy_ReadOnly < guint > | property_inactivity_timeout () const
| Iime (ms) to stay alive after becoming idle.
Glib::PropertyProxy_ReadOnly < bool > | property_is_registered () const
| If g_application_register() has been called.
Glib::PropertyProxy_ReadOnly < bool > | property_is_remote () const
| If this application instance is remote.
Glib::SignalProxy0< void > | signal_startup ()
Glib::SignalProxy0< void > | signal_activate ()

## Static Public Member Functions

static Glib::RefPtr< Application > | create (const Glib::ustring& appid, ApplicationFlags flags=APPLICATION_FLAGS_NONE)
| Create a new Application.
static bool | is_valid (const Glib::ustring& application_id)

## Protected Member Functions

| Application ()
virtual void | on_startup ()
virtual void | on_activate ()

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gio::Application > | wrap (GApplication* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

TODO.

Since glibmm 2.26:

## Constructor & Destructor Documentation

virtual Gio::Application::~Application | ( |  | ) | `[virtual]`

Gio::Application::Application | ( |  | ) | `[protected]`

## Member Function Documentation

void Gio::Application::activate | ( |  | ) |

static Glib::RefPtr<Application> Gio::Application::create | ( | const Glib::ustring& | appid,
|  | ApplicationFlags | flags = `APPLICATION_FLAGS_NONE` |
| ) |  |  | `[static]`

Create a new Application.

This uses a platform-specific mechanism to ensure the current process is the unique owner of the application (as defined by the appid). If successful, the Application:is-remote property will be `false`, and it is safe to continue creating other resources such as graphics windows.

If the given appid is already running in another process, the the GApplication::activate_with_data signal will be emitted in the remote process, with the data from argv and other platform-specific data available. Subsequently the Application:default-quit property will be evaluated. If it's `true`, then the current process will terminate. If `false`, then the application remains in the Application:is-remote state, and you can e.g. call Glib::application_invoke_action(). Note that proxy instances should not call Glib::application_add_action().

This function may do synchronous I/O to obtain unique ownership of the application id, and will block the calling thread in this case.

If the environment does not support the basic functionality of Application, this function will invoke Glib::error(), which by default is a fatal operation. This may arise for example on UNIX systems using D-Bus when the session bus is not available.

As a convenience, this function is defined to call Glib::type_init() as its very first action.

Since glibmm 2.26:

Parameters:

  | appid | System-dependent application identifier.
  | argc | Number of arguments in argv.
  | argv | Argument vector, usually from the <parameter>argv</parameter> parameter of main().

Returns:
  An application instance.

ApplicationFlags Gio::Application::get_flags | ( |  | ) | const

Glib::ustring Gio::Application::get_id | ( |  | ) | const

guint Gio::Application::get_inactivity_timeout | ( |  | ) | const

const GApplication* Gio::Application::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GApplication* Gio::Application::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GApplication* Gio::Application::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

void Gio::Application::hold | ( |  | ) |

bool Gio::Application::is_registered | ( |  | ) | const

bool Gio::Application::is_remote | ( |  | ) | const

static bool Gio::Application::is_valid | ( | const Glib::ustring& | application_id | ) | `[static]`

virtual void Gio::Application::on_activate | ( |  | ) | `[protected, virtual]`

virtual void Gio::Application::on_startup | ( |  | ) | `[protected, virtual]`

Glib::PropertyProxy_WriteOnly< Glib::RefPtr<ActionGroup> > Gio::Application::property_action_group | ( |  | ) |

The group of actions that the application exports.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gio::Application::property_application_id | ( |  | ) |

The unique identifier for the application.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gio::Application::property_application_id | ( |  | ) | const

The unique identifier for the application.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<ApplicationFlags> Gio::Application::property_flags | ( |  | ) | const

Flags specifying the behaviour of the application.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<ApplicationFlags> Gio::Application::property_flags | ( |  | ) |

Flags specifying the behaviour of the application.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<guint> Gio::Application::property_inactivity_timeout | ( |  | ) |

Iime (ms) to stay alive after becoming idle.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gio::Application::property_inactivity_timeout | ( |  | ) | const

Iime (ms) to stay alive after becoming idle.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::Application::property_is_registered | ( |  | ) | const

If g_application_register() has been called.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::Application::property_is_remote | ( |  | ) | const

If this application instance is remote.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

bool Gio::Application::register_application | ( | const Glib::RefPtr< Gio::Cancellable >& | cancellable | ) |

By default, Application ensures process uniqueness when initialized, but this behavior is controlled by the GApplication:register property.

If it was given as `false` at construction time, this function allows you to later attempt to ensure uniqueness. Note that the GApplication:default-quit property no longer applies at this point; if this function returns `false`, platform activation will occur, but the current process will not be terminated.

It is an error to call this function more than once. It is also an error to call this function if the GApplication:register property was `true` at construction time.

Returns:
  `true` if registration was successful.

void Gio::Application::release | ( |  | ) |

void Gio::Application::run | ( | int | argc,
|  | char ** | argv |
| ) |  |  |

Starts the application.

The default implementation of this virtual function will simply run a main loop.

It is an error to call this function if application is a proxy for a remote application.

Since glibmm 2.26:

void Gio::Application::set_action_group | ( | const Glib::RefPtr< ActionGroup >& | action_group | ) |

void Gio::Application::set_flags | ( | ApplicationFlags | flags | ) |

void Gio::Application::set_id | ( | const Glib::ustring& | application_id | ) |

void Gio::Application::set_inactivity_timeout | ( | guint | inactivity_timeout | ) |

Glib::SignalProxy0< void > Gio::Application::signal_activate | ( |  | ) |

Prototype:
  `void on_my_activate()`

Glib::SignalProxy0< void > Gio::Application::signal_startup | ( |  | ) |

Prototype:
  `void on_my_startup()`

## Friends And Related Function Documentation

Glib::RefPtr< Gio::Application > wrap | ( | GApplication * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.