glibmm 2.86.0
Gio::Application Class Reference

Application - Core application class. More...

#include <giomm/application.h>

Inheritance diagram for Gio::Application:

Public Types

enum class  Flags {
  Flags::NONE = 0x0 ,
  Flags::DEFAULT_FLAGS = 0x0 ,
  Flags::IS_SERVICE = (1 << 0) ,
  Flags::IS_LAUNCHER = (1 << 1) ,
  Flags::HANDLES_OPEN = (1 << 2) ,
  Flags::HANDLES_COMMAND_LINE = (1 << 3) ,
  Flags::SEND_ENVIRONMENT = (1 << 4) ,
  Flags::NON_UNIQUE = (1 << 5) ,
  Flags::CAN_OVERRIDE_APP_ID = (1 << 6) ,
  Flags::ALLOW_REPLACEMENT = (1 << 7) ,
  Flags::REPLACE = (1 << 8)
}
 Flags used to define the behaviour of a Application. More...
enum class  OptionType {
  OptionType::BOOL ,
  OptionType::STRING ,
  OptionType::INT ,
  OptionType::FILENAME = INT+2 ,
  OptionType::STRING_VECTOR ,
  OptionType::FILENAME_VECTOR ,
  OptionType::DOUBLE ,
  OptionType::INT64
}
 The OptionType enum values determine the expected type of a command line option. More...
using type_vec_files = std::vector< Glib::RefPtr<File> >
Public Types inherited from Glib::Object
using DestroyNotify = void (*)(gpointer data)
Public Types inherited from Gio::ActionMap
using ActivateSlot = sigc::slot<void()>
 A Slot to be called when an action has been activated, without passing a parameter to the slot.
using ActivateWithParameterSlot = sigc::slot<void(const Glib::VariantBase&)>
 A Slot to be called when an action has been activated, passing a parameter of a specified type.
using ActivateWithStringParameterSlot = sigc::slot<void(const Glib::ustring&)>
 A Slot to be called when an action has been activated.
using ActivateWithIntParameterSlot = sigc::slot<void(int)>
 A Slot to be called when an action has been activated.

Public Member Functions

 Application (Application && src) noexcept
Applicationoperator= (Application && src) noexcept
 ~Application () noexcept override
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
 Gets the unique identifier for application.
void set_id (const Glib::ustring & application_id)
 Sets the unique identifier for application.
Glib::ustring get_version () const
 Gets the version of application.
void set_version (const Glib::ustring & version)
 Sets the version number of application.
Glib::RefPtr< DBus::Connectionget_dbus_connection ()
 Gets the Gio::DBus::Connection being used by the application, or nullptr.
Glib::RefPtr< const DBus::Connectionget_dbus_connection () const
 Gets the Gio::DBus::Connection being used by the application, or nullptr.
Glib::ustring get_dbus_object_path () const
 Gets the D-Bus object path being used by the application, or nullptr.
guint get_inactivity_timeout () const
 Gets the current inactivity timeout for the application.
void set_inactivity_timeout (guint inactivity_timeout)
 Sets the current inactivity timeout for the application.
Flags get_flags () const
 Gets the flags for application.
void set_flags (Flags flags)
 Sets the flags for application.
std::string get_resource_base_path () const
 Gets the resource base path of application.
void set_resource_base_path (const std::string & resource_path)
 Sets (or unsets) the base resource path of application.
void unset_resource_base_path ()
 Disable automatic resource loading functionality.
void add_main_option_entry (OptionType arg_type, const Glib::ustring & long_name, gchar short_name='\0', const Glib::ustring & description={}, const Glib::ustring & arg_description={}, Glib::OptionEntry::Flags flags=Glib::OptionEntry::Flags::NONE)
 Adds a main option entry to be handled by the Application.
void add_main_option_entry (const Glib::OptionGroup::SlotOptionArgString & slot, const Glib::ustring & long_name, gchar short_name='\0', const Glib::ustring & description={}, const Glib::ustring & arg_description={}, Glib::OptionEntry::Flags flags=Glib::OptionEntry::Flags::NONE)
 Adds a main option entry to be handled by the Application.
void add_main_option_entry_filename (const Glib::OptionGroup::SlotOptionArgFilename & slot, const Glib::ustring & long_name, gchar short_name='\0', const Glib::ustring & description={}, const Glib::ustring & arg_description={}, Glib::OptionEntry::Flags flags=Glib::OptionEntry::Flags::NONE)
 Adds a main option entry to be handled by the Application.
void add_option_group (Glib::OptionGroup & group)
 Adds a Glib::OptionGroup to the commandline handling of the application.
void set_option_context_parameter_string (const Glib::ustring & parameter_string)
 Sets the parameter string to be used by the commandline handling of application.
void set_option_context_summary (const Glib::ustring & summary)
 Adds a summary to the application option context.
void set_option_context_description (const Glib::ustring & description)
 Adds a description to the application option context.
bool is_registered () const
 Checks if application is registered.
bool is_remote () const
 Checks if application is remote.
bool register_application (const Glib::RefPtr< Gio::Cancellable > & cancellable)
 Attempts registration of the application.
bool register_application ()
 A register_application() convenience overload.
void hold ()
 Increases the use count of application.
void release ()
 Decrease the use count of application.
void activate ()
 Activates the application.
void open (const type_vec_files & files, const Glib::ustring & hint={})
void open (const Glib::RefPtr< Gio::File > & file, const Glib::ustring & hint={})
int run (int argc, char ** argv)
 Runs the application.
void quit ()
 Immediately quits the application.
void mark_busy ()
 Increases the busy count of application.
void unmark_busy ()
 Decreases the busy count of application.
bool get_is_busy () const
 Gets the application's current busy state, as set through g_application_mark_busy() or g_application_bind_busy_property().
void send_notification (const Glib::ustring & id, const Glib::RefPtr< Notification > & notification)
 Sends a notification on behalf of application to the desktop shell.
void send_notification (const Glib::RefPtr< Notification > & notification)
 A send_notification() convenience overload.
void withdraw_notification (const Glib::ustring & id)
 Withdraws a notification that was sent with g_application_send_notification().
Glib::PropertyProxy< Glib::ustringproperty_application_id ()
 The unique identifier for the application.
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_application_id () const
 The unique identifier for the application.
Glib::PropertyProxy< Glib::ustringproperty_version ()
 The human-readable version number of the application.
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_version () const
 The human-readable version number of the application.
Glib::PropertyProxy< Flagsproperty_flags ()
 Flags specifying the behaviour of the application.
Glib::PropertyProxy_ReadOnly< Flagsproperty_flags () const
 Flags specifying the behaviour of the application.
Glib::PropertyProxy< guint > property_inactivity_timeout ()
 Time (in milliseconds) to stay alive after becoming idle.
Glib::PropertyProxy_ReadOnly< guint > property_inactivity_timeout () const
 Time (in milliseconds) to stay alive after becoming idle.
Glib::PropertyProxy_ReadOnly< bool > property_is_registered () const
 Whether Gio::Application::register() has been called.
Glib::PropertyProxy_ReadOnly< bool > property_is_remote () const
 Whether this application instance is remote.
Glib::PropertyProxy< std::stringproperty_resource_base_path ()
 The base resource path for the application.
Glib::PropertyProxy_ReadOnly< std::stringproperty_resource_base_path () const
 The base resource path for the application.
Glib::PropertyProxy_ReadOnly< bool > property_is_busy () const
 Whether the application is currently marked as busy through g_application_mark_busy() or g_application_bind_busy_property().
Glib::SignalProxy< void()> signal_startup ()
Glib::SignalProxy< void()> signal_shutdown ()
Glib::SignalProxy< void()> signal_activate ()
Glib::SignalProxy< void(const type_vec_files &, const Glib::ustring &)> signal_open ()
Glib::SignalProxy< int(const Glib::RefPtr< ApplicationCommandLine > &)> signal_command_line ()
Glib::SignalProxy< int(const Glib::RefPtr< Glib::VariantDict > &)> signal_handle_local_options ()
Glib::SignalProxy< bool()> signal_name_lost ()
Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
Objectoperator= (const Object &)=delete
 Object (Object && src) noexcept
Objectoperator= (Object && src) noexcept
void * get_data (const QueryQuark & key)
void set_data (const Quark & key, void *data)
void set_data_with_c_callback (const Quark & key, void *data, GDestroyNotify notify)
void set_data (const Quark & key, void *data, DestroyNotify notify)
 Prefer set_data_with_c_callback() with a callback with C linkage.
void remove_data (const QueryQuark & quark)
void * steal_data (const QueryQuark & quark)
Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
ObjectBaseoperator= (const ObjectBase &)=delete
void set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
 You probably want to use a specific property_*() accessor method instead.
void get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
 You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
void set_property (const Glib::ustring & property_name, const PropertyType & value)
 You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
void get_property (const Glib::ustring & property_name, PropertyType & value) const
 You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
PropertyType get_property (const Glib::ustring & property_name) const
 You probably want to use a specific property_*() accessor method instead.
sigc::connection connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> & slot)
 You can use the signal_changed() signal of the property proxy instead.
sigc::connection connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> && slot)
 You can use the signal_changed() signal of the property proxy instead.
void freeze_notify ()
 Increases the freeze count on object.
void thaw_notify ()
 Reverts the effect of a previous call to freeze_notify().
virtual void reference () const
 Increment the reference count for this object.
virtual void unreference () const
 Decrement the reference count for this object.
GObject * gobj ()
 Provides access to the underlying C GObject.
const GObject * gobj () const
 Provides access to the underlying C GObject.
GObject * gobj_copy () const
 Give a ref-ed copy to someone. Use for direct struct access.
Public Member Functions inherited from Gio::ActionGroup
 ActionGroup (ActionGroup && src) noexcept
ActionGroupoperator= (ActionGroup && src) noexcept
 ~ActionGroup () noexcept override
GActionGroup * gobj ()
 Provides access to the underlying C GObject.
const GActionGroup * gobj () const
 Provides access to the underlying C GObject.
bool has_action (const Glib::ustring & action_name) const
 Checks if the named action exists within action_group.
std::vector< Glib::ustringlist_actions () const
 Lists the actions contained within action_group.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantType & parameter_type, Glib::VariantBase & state_hint, Glib::VariantType & state_type, Glib::VariantBase & state)
 Queries all aspects of the named action within an action_group.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantType & parameter_type, Glib::VariantBase & state_hint, Glib::VariantType & state_type)
 A query_action() convenience overload.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantType & parameter_type, Glib::VariantBase & state_hint, Glib::VariantBase & state)
 A query_action() convenience overload.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantType & parameter_type, Glib::VariantBase & state_hint)
 A query_action() convenience overload.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantBase & state_hint, Glib::VariantType & state_type, Glib::VariantBase & state)
 A query_action() convenience overload.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantBase & state_hint, Glib::VariantType & state_type)
 A query_action() convenience overload.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantBase & state_hint, Glib::VariantBase & state)
 A query_action() convenience overload.
bool query_action (const Glib::ustring & action_name, bool & enabled, Glib::VariantBase & state_hint)
 A query_action() convenience overload.
bool get_action_enabled (const Glib::ustring & action_name) const
 Checks if the named action within action_group is currently enabled.
Glib::VariantType get_action_parameter_type (const Glib::ustring & action_name) const
 Queries the type of the parameter that must be given when activating the named action within action_group.
Glib::VariantType get_action_state_type (const Glib::ustring & action_name) const
 Queries the type of the state of the named action within action_group.
template<typename T_Value>
void get_action_state_hint (const Glib::ustring & action_name, T_Value & value) const
 Requests a hint about the valid range of values for the state of the named action within the action group.
Glib::VariantContainerBase get_action_state_hint_variant (const Glib::ustring & action_name) const
 Requests a hint about the valid range of values for the state of the named action within action_group.
template<typename T_Value>
void get_action_state (const Glib::ustring & action_name, T_Value & value) const
 Queries the current state of the named action within the action group.
Glib::VariantBase get_action_state_variant (const Glib::ustring & action_name) const
 Queries the current state of the named action within action_group.
void change_action_state (const Glib::ustring & action_name, const Glib::VariantBase & value)
 Request for the state of the named action within action_group to be changed to value.
void activate_action (const Glib::ustring & action_name, const Glib::VariantBase & parameter)
 Activate the named action within action_group.
void activate_action (const Glib::ustring & action_name)
 A activate_action() convenience overload.
void action_added (const Glib::ustring & action_name)
 Emits the Gio::ActionGroup::signal_action_added() signal on action_group.
void action_removed (const Glib::ustring & action_name)
 Emits the Gio::ActionGroup::signal_action_removed() signal on action_group.
void action_enabled_changed (const Glib::ustring & action_name, bool enabled)
 Emits the Gio::ActionGroup::signal_action_enabled_changed() signal on action_group.
void action_state_changed (const Glib::ustring & action_name, const Glib::VariantBase & state)
 Emits the Gio::ActionGroup::signal_action_state_changed() signal on action_group.
Glib::SignalProxyDetailed< void(const Glib::ustring &)> signal_action_added (const Glib::ustring & action_name={})
Glib::SignalProxyDetailed< void(const Glib::ustring &, bool)> signal_action_enabled_changed (const Glib::ustring & action_name={})
Glib::SignalProxyDetailed< void(const Glib::ustring &)> signal_action_removed (const Glib::ustring & action_name={})
Glib::SignalProxyDetailed< void(const Glib::ustring &, const Glib::VariantBase &)> signal_action_state_changed (const Glib::ustring & action_name={})
Public Member Functions inherited from Glib::Interface
 Interface ()
 A Default constructor.
 Interface (Interface && src) noexcept
Interfaceoperator= (Interface && src) noexcept
 Interface (const Glib::Interface_Class & interface_class)
 Called by constructors of derived classes.
 Interface (GObject * castitem)
 Called by constructors of derived classes.
 ~Interface () noexcept override
 Interface (const Interface &)=delete
Interfaceoperator= (const Interface &)=delete
GObject * gobj ()
const GObject * gobj () const
Public Member Functions inherited from Gio::ActionMap
 ActionMap (ActionMap && src) noexcept
ActionMapoperator= (ActionMap && src) noexcept
 ~ActionMap () noexcept override
GActionMap * gobj ()
 Provides access to the underlying C GObject.
const GActionMap * gobj () const
 Provides access to the underlying C GObject.
void add_action (const Glib::RefPtr< Action > & action)
 Adds an action to the action_map.
void remove_action (const Glib::ustring & action_name)
 Removes the named action from the action map.
Glib::RefPtr< Actionlookup_action (const Glib::ustring & action_name)
 Looks up the action with the name action_name in action_map.
Glib::RefPtr< const Actionlookup_action (const Glib::ustring & action_name) const