# 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.
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 | run (int argc, char** argv)
| Starts the application.
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.

## 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

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.

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

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

const GApplication* Gio::Application::gobj | ( |  | ) | const`[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.

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

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

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::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:

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.