"Fossies" - the Fresh Open Source Software Archive

Member "glibmm-2.74.0/untracked/gio/giomm/application.h" (19 Sep 2022, 58441 Bytes) of package /linux/misc/glibmm-2.74.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "application.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes reports: 2.73.2_vs_2.74.0 or 2.72.1_vs_2.74.0.

    1 // Generated by gmmproc 2.74.0 -- DO NOT MODIFY!
    2 #ifndef _GIOMM_APPLICATION_H
    3 #define _GIOMM_APPLICATION_H
    4 
    5 #include <giommconfig.h>
    6 
    7 
    8 #include <glibmm/ustring.h>
    9 #include <sigc++/sigc++.h>
   10 
   11 /* Copyright (C) 2007 The gtkmm Development Team
   12  *
   13  * This library is free software; you can redistribute it and/or
   14  * modify it under the terms of the GNU Lesser General Public
   15  * License as published by the Free Software Foundation; either
   16  * version 2.1 of the License, or (at your option) any later version.
   17  *
   18  * This library is distributed in the hope that it will be useful,
   19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21  * Lesser General Public License for more details.
   22  *
   23  * You should have received a copy of the GNU Lesser General Public
   24  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
   25  */
   26 
   27 
   28 #include <giomm/actiongroup.h>
   29 #include <giomm/actionmap.h>
   30 #include <giomm/applicationcommandline.h>
   31 #include <giomm/file.h>
   32 #include <glibmm/object.h>
   33 #include <glibmm/optionentry.h>
   34 #include <glibmm/optiongroup.h>
   35 #include <glibmm/variant.h>
   36 #include <glibmm/variantdict.h>
   37 #include <giomm/dbusconnection.h>
   38 #include <giomm/notification.h>
   39 
   40 
   41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   42 using GApplication = struct _GApplication;
   43 using GApplicationClass = struct _GApplicationClass;
   44 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
   45 
   46 
   47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   48 namespace Gio
   49 { class GIOMM_API Application_Class; } // namespace Gio
   50 #endif //DOXYGEN_SHOULD_SKIP_THIS
   51 
   52 namespace Gio
   53 {
   54 
   55 
   56 /** Application - Core application class.
   57  * An Application is the foundation of an application, unique for a given
   58  * application identifier. The Application class wraps some low-level
   59  * platform-specific services and is intended to act as the foundation for
   60  * higher-level application classes such as Gtk::Application or MxApplication.
   61  * In general, you should not use this class outside of a higher level
   62  * framework.
   63  *
   64  * One of the core features that Application provides is process uniqueness,
   65  * in the context of a "session". The session concept is platform-dependent,
   66  * but corresponds roughly to a graphical desktop login. When your application
   67  * is launched again, its arguments are passed through platform communication
   68  * to the already running program. The already running instance of the program
   69  * is called the <i>primary instance</i>.
   70  *
   71  * Before using Application, you must choose an "application identifier". The
   72  * expected form of an application identifier is very close to that of of a
   73  * <a href="
   74  * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface">DBus
   75  * bus name</a>. Examples include: "com.example.MyApp",
   76  * "org.example.internal-apps.Calculator". For details on valid application
   77  * identifiers, see id_is_valid().
   78  *
   79  * Application provides convenient life cycle management by maintaining a
   80  * <i>use count</i> for the primary application instance. The use count can be
   81  * changed using hold() and release(). If it drops to zero, the application
   82  * exits.
   83  *
   84  * Application also implements the ActionGroup and ActionMap
   85  * interfaces and lets you easily export actions by adding them with
   86  * Gio::ActionMap::add_action(). When invoking an action by calling
   87  * Gio::ActionGroup::activate_action() on the application, it is always
   88  * invoked in the primary instance.
   89  *
   90  * There is a number of different entry points into an Application:
   91  *
   92  * - via 'Activate' (i.e. just starting the application)
   93  * - via 'Open' (i.e. opening some files)
   94  * - via activating an action
   95  *
   96  * The signal_startup() signal lets you handle the application initialization
   97  * for all of these in a single place.
   98  *
   99  * See the C API docs for an example.
  100  *
  101  * @newin{2,32}
  102  */
  103 
  104 class GIOMM_API Application : public Glib::Object, public ActionGroup, public ActionMap
  105 {
  106   
  107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
  108 
  109 public:
  110   using CppObjectType = Application;
  111   using CppClassType = Application_Class;
  112   using BaseObjectType = GApplication;
  113   using BaseClassType = GApplicationClass;
  114 
  115   // noncopyable
  116   Application(const Application&) = delete;
  117   Application& operator=(const Application&) = delete;
  118 
  119 private:  friend class Application_Class;
  120   static CppClassType application_class_;
  121 
  122 protected:
  123   explicit Application(const Glib::ConstructParams& construct_params);
  124   explicit Application(GApplication* castitem);
  125 
  126 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  127 
  128 public:
  129 
  130   Application(Application&& src) noexcept;
  131   Application& operator=(Application&& src) noexcept;
  132 
  133   ~Application() noexcept override;
  134 
  135   /** Get the GType for this class, for use with the underlying GObject type system.
  136    */
  137   static GType get_type()      G_GNUC_CONST;
  138 
  139 #ifndef DOXYGEN_SHOULD_SKIP_THIS
  140 
  141 
  142   static GType get_base_type() G_GNUC_CONST;
  143 #endif
  144 
  145   ///Provides access to the underlying C GObject.
  146   GApplication*       gobj()       { return reinterpret_cast<GApplication*>(gobject_); }
  147 
  148   ///Provides access to the underlying C GObject.
  149   const GApplication* gobj() const { return reinterpret_cast<GApplication*>(gobject_); }
  150 
  151   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  152   GApplication* gobj_copy();
  153 
  154 private:
  155 
  156   
  157 public:
  158   /** @addtogroup giommEnums giomm Enums and Flags */
  159 
  160   /** 
  161    *  @var Flags NONE
  162    * Default. Deprecated in 2.74, use
  163    * Gio::Application::Flags::DEFAULT_FLAGS instead.
  164    * 
  165    *  @var Flags DEFAULT_FLAGS
  166    * Default flags. @newin{2,74}
  167    * 
  168    *  @var Flags IS_SERVICE
  169    * Run as a service. In this mode, registration
  170    * fails if the service is already running, and the application
  171    * will initially wait up to 10 seconds for an initial activation
  172    * message to arrive.
  173    * 
  174    *  @var Flags IS_LAUNCHER
  175    * Don't try to become the primary instance.
  176    * 
  177    *  @var Flags HANDLES_OPEN
  178    * This application handles opening files (in
  179    * the primary instance). Note that this flag only affects the default
  180    * implementation of local_command_line(), and has no effect if
  181    * Gio::Application::Flags::HANDLES_COMMAND_LINE is given.
  182    * See g_application_run() for details.
  183    * 
  184    *  @var Flags HANDLES_COMMAND_LINE
  185    * This application handles command line
  186    * arguments (in the primary instance). Note that this flag only affect
  187    * the default implementation of local_command_line().
  188    * See g_application_run() for details.
  189    * 
  190    *  @var Flags SEND_ENVIRONMENT
  191    * Send the environment of the
  192    * launching process to the primary instance. Set this flag if your
  193    * application is expected to behave differently depending on certain
  194    * environment variables. For instance, an editor might be expected
  195    * to use the `GIT_COMMITTER_NAME` environment variable
  196    * when editing a git commit message. The environment is available
  197    * to the Application::signal_command_line() signal handler, via
  198    * g_application_command_line_getenv().
  199    * 
  200    *  @var Flags NON_UNIQUE
  201    * Make no attempts to do any of the typical
  202    * single-instance application negotiation, even if the application
  203    * ID is given.  The application neither attempts to become the
  204    * owner of the application ID nor does it check if an existing
  205    * owner already exists.  Everything occurs in the local process.
  206    * @newin{2,30}
  207    * 
  208    *  @var Flags CAN_OVERRIDE_APP_ID
  209    * Allow users to override the
  210    * application ID from the command line with `--gapplication-app-id`.
  211    * @newin{2,48}
  212    * 
  213    *  @var Flags ALLOW_REPLACEMENT
  214    * Allow another instance to take over
  215    * the bus name. @newin{2,60}
  216    * 
  217    *  @var Flags REPLACE
  218    * Take over from another instance. This flag is
  219    * usually set by passing `--gapplication-replace` on the commandline.
  220    * @newin{2,60}
  221    * 
  222    *  @enum Flags
  223    * 
  224    * Flags used to define the behaviour of a Application.
  225    * 
  226    * @newin{2,28}
  227    *
  228    * @ingroup giommEnums
  229    * @par Bitwise operators:
  230    * <tt>Application::Flags operator|(Application::Flags, Application::Flags)</tt><br>
  231    * <tt>Application::Flags operator&(Application::Flags, Application::Flags)</tt><br>
  232    * <tt>Application::Flags operator^(Application::Flags, Application::Flags)</tt><br>
  233    * <tt>Application::Flags operator~(Application::Flags)</tt><br>
  234    * <tt>Application::Flags& operator|=(Application::Flags&, Application::Flags)</tt><br>
  235    * <tt>Application::Flags& operator&=(Application::Flags&, Application::Flags)</tt><br>
  236    * <tt>Application::Flags& operator^=(Application::Flags&, Application::Flags)</tt><br>
  237    */
  238   enum class Flags
  239   {
  240     NONE = 0x0,
  241     DEFAULT_FLAGS = 0x0,
  242     IS_SERVICE = (1 << 0),
  243     IS_LAUNCHER = (1 << 1),
  244     HANDLES_OPEN = (1 << 2),
  245     HANDLES_COMMAND_LINE = (1 << 3),
  246     SEND_ENVIRONMENT = (1 << 4),
  247     NON_UNIQUE = (1 << 5),
  248     CAN_OVERRIDE_APP_ID = (1 << 6),
  249     ALLOW_REPLACEMENT = (1 << 7),
  250     REPLACE = (1 << 8)
  251   };
  252 
  253 
  254 protected:
  255   /** Constructs an application instance.
  256    * If no application ID is given then some features (most notably application uniqueness) will be disabled.
  257    *
  258    * @param application_id The application ID.
  259    * @param flags The application flags.
  260    */
  261   explicit Application(const Glib::ustring& application_id = {}, Flags flags = Flags::NONE);
  262   
  263 
  264 public:
  265   
  266 
  267   // Application::OptionType wraps GOptionArg, but _WRAP_ENUM can't be used here.
  268   // GOptionArg is defined in glib_enums.defs, not in gio_enums.defs.
  269   /** The OptionType enum values determine the expected type of a command line option.
  270    * If an option expects an extra argument, it can be specified in several ways;
  271    * with a short option: "-x arg", with a long option: "--name arg" or combined
  272    * in a single argument: "--name=arg". All option types except OptionType::BOOL
  273    * expect an extra argument. OptionType::STRING_VECTOR and
  274    * OptionType::FILENAME_VECTOR accept more than one extra argument.
  275    *
  276    * The descriptions of the enum values show what type of Glib::Variant<>
  277    * is stored in a Glib::VariantDict.
  278    *
  279    * @newin{2,42}
  280    *
  281    * @ingroup glibmmEnums
  282    */
  283   enum class OptionType
  284   {
  285     BOOL,   ///< bool
  286     STRING, ///< Glib::ustring
  287     INT,    ///< gint32
  288     // CALLBACK,
  289     FILENAME = INT+2, ///< std::string
  290     STRING_VECTOR,    ///< std::vector<Glib::ustring>
  291     FILENAME_VECTOR,  ///< std::vector<std::string>
  292     DOUBLE,           ///< double
  293     INT64             ///< gint64
  294   };
  295 
  296   /** Creates an application instance.
  297    * If no application ID is given then some features (most notably application uniqueness) will be disabled.
  298    *
  299    * @param application_id The application ID.
  300    * @param flags The application flags.
  301    */
  302   
  303   static Glib::RefPtr<Application> create(const Glib::ustring& application_id =  {}, Flags flags =  Flags::NONE);
  304 
  305 
  306   /** Checks if @a application_id is a valid application identifier.
  307    * 
  308    * A valid ID is required for calls to g_application_new() and
  309    * g_application_set_application_id().
  310    * 
  311    * Application identifiers follow the same format as
  312    * [D-Bus well-known bus names](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus).
  313    * For convenience, the restrictions on application identifiers are
  314    * reproduced here:
  315    * 
  316    * - Application identifiers are composed of 1 or more elements separated by a
  317    * period (`.`) character. All elements must contain at least one character.
  318    * 
  319    * - Each element must only contain the ASCII characters `[A-Z][a-z][0-9]_-`,
  320    * with `-` discouraged in new application identifiers. Each element must not
  321    * begin with a digit.
  322    * 
  323    * - Application identifiers must contain at least one `.` (period) character
  324    * (and thus at least two elements).
  325    * 
  326    * - Application identifiers must not begin with a `.` (period) character.
  327    * 
  328    * - Application identifiers must not exceed 255 characters.
  329    * 
  330    * Note that the hyphen (`-`) character is allowed in application identifiers,
  331    * but is problematic or not allowed in various specifications and APIs that
  332    * refer to D-Bus, such as
  333    * [Flatpak application IDs](http://docs.flatpak.org/en/latest/introduction.html#identifiers),
  334    * the
  335    * [`DBusActivatable` interface in the Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus),
  336    * and the convention that an application's "main" interface and object path
  337    * resemble its application identifier and bus name. To avoid situations that
  338    * require special-case handling, it is recommended that new application
  339    * identifiers consistently replace hyphens with underscores.
  340    * 
  341    * Like D-Bus interface names, application identifiers should start with the
  342    * reversed DNS domain name of the author of the interface (in lower-case), and
  343    * it is conventional for the rest of the application identifier to consist of
  344    * words run together, with initial capital letters.
  345    * 
  346    * As with D-Bus interface names, if the author's DNS domain name contains
  347    * hyphen/minus characters they should be replaced by underscores, and if it
  348    * contains leading digits they should be escaped by prepending an underscore.
  349    * For example, if the owner of 7-zip.org used an application identifier for an
  350    * archiving application, it might be named `org._7_zip.Archiver`.
  351    * 
  352    * @param application_id A potential application identifier.
  353    * @return <tt>true</tt> if @a application_id is valid.
  354    */
  355   static bool id_is_valid(const Glib::ustring& application_id);
  356 
  357   
  358   /** Gets the unique identifier for @a application.
  359    * 
  360    * @newin{2,28}
  361    * 
  362    * @return The identifier for @a application, owned by @a application.
  363    */
  364   Glib::ustring get_id() const;
  365   
  366   /** Sets the unique identifier for @a application.
  367    * 
  368    * The application id can only be modified if @a application has not yet
  369    * been registered.
  370    * 
  371    * If non-<tt>nullptr</tt>, the application id must be valid.  See
  372    * g_application_id_is_valid().
  373    * 
  374    * @newin{2,28}
  375    * 
  376    * @param application_id The identifier for @a application.
  377    */
  378   void set_id(const Glib::ustring& application_id);
  379 
  380 
  381   /** Gets the Gio::DBus::Connection being used by the application, or <tt>nullptr</tt>.
  382    * 
  383    * If Application is using its D-Bus backend then this function will
  384    * return the Gio::DBus::Connection being used for uniqueness and
  385    * communication with the desktop environment and other instances of the
  386    * application.
  387    * 
  388    * If Application is not using D-Bus then this function will return
  389    * <tt>nullptr</tt>.  This includes the situation where the D-Bus backend would
  390    * normally be in use but we were unable to connect to the bus.
  391    * 
  392    * This function must not be called before the application has been
  393    * registered.  See g_application_get_is_registered().
  394    * 
  395    * @newin{2,34}
  396    * 
  397    * @return A Gio::DBus::Connection, or <tt>nullptr</tt>.
  398    */
  399   Glib::RefPtr<DBus::Connection> get_dbus_connection();
  400   
  401   /** Gets the Gio::DBus::Connection being used by the application, or <tt>nullptr</tt>.
  402    * 
  403    * If Application is using its D-Bus backend then this function will
  404    * return the Gio::DBus::Connection being used for uniqueness and
  405    * communication with the desktop environment and other instances of the
  406    * application.
  407    * 
  408    * If Application is not using D-Bus then this function will return
  409    * <tt>nullptr</tt>.  This includes the situation where the D-Bus backend would
  410    * normally be in use but we were unable to connect to the bus.
  411    * 
  412    * This function must not be called before the application has been
  413    * registered.  See g_application_get_is_registered().
  414    * 
  415    * @newin{2,34}
  416    * 
  417    * @return A Gio::DBus::Connection, or <tt>nullptr</tt>.
  418    */
  419   Glib::RefPtr<const DBus::Connection> get_dbus_connection() const;
  420 
  421   
  422   /** Gets the D-Bus object path being used by the application, or <tt>nullptr</tt>.
  423    * 
  424    * If Application is using its D-Bus backend then this function will
  425    * return the D-Bus object path that Application is using.  If the
  426    * application is the primary instance then there is an object published
  427    * at this path.  If the application is not the primary instance then
  428    * the result of this function is undefined.
  429    * 
  430    * If Application is not using D-Bus then this function will return
  431    * <tt>nullptr</tt>.  This includes the situation where the D-Bus backend would
  432    * normally be in use but we were unable to connect to the bus.
  433    * 
  434    * This function must not be called before the application has been
  435    * registered.  See g_application_get_is_registered().
  436    * 
  437    * @newin{2,34}
  438    * 
  439    * @return The object path, or <tt>nullptr</tt>.
  440    */
  441   Glib::ustring get_dbus_object_path() const;
  442 
  443   
  444   /** Gets the current inactivity timeout for the application.
  445    * 
  446    * This is the amount of time (in milliseconds) after the last call to
  447    * g_application_release() before the application stops running.
  448    * 
  449    * @newin{2,28}
  450    * 
  451    * @return The timeout, in milliseconds.
  452    */
  453   guint get_inactivity_timeout() const;
  454   
  455   /** Sets the current inactivity timeout for the application.
  456    * 
  457    * This is the amount of time (in milliseconds) after the last call to
  458    * g_application_release() before the application stops running.
  459    * 
  460    * This call has no side effects of its own.  The value set here is only
  461    * used for next time g_application_release() drops the use count to
  462    * zero.  Any timeouts currently in progress are not impacted.
  463    * 
  464    * @newin{2,28}
  465    * 
  466    * @param inactivity_timeout The timeout, in milliseconds.
  467    */
  468   void set_inactivity_timeout(guint inactivity_timeout);
  469 
  470   
  471   /** Gets the flags for @a application.
  472    * 
  473    * See Gio::Application::Flags.
  474    * 
  475    * @newin{2,28}
  476    * 
  477    * @return The flags for @a application.
  478    */
  479   Flags get_flags() const;
  480   
  481   /** Sets the flags for @a application.
  482    * 
  483    * The flags can only be modified if @a application has not yet been
  484    * registered.
  485    * 
  486    * See Gio::Application::Flags.
  487    * 
  488    * @newin{2,28}
  489    * 
  490    * @param flags The flags for @a application.
  491    */
  492   void set_flags(Flags flags);
  493 
  494   
  495   /** Gets the resource base path of @a application.
  496    * 
  497    * See g_application_set_resource_base_path() for more information.
  498    * 
  499    * @newin{2,44}
  500    * 
  501    * @return The base resource path, if one is set.
  502    */
  503   std::string get_resource_base_path() const;
  504   
  505   /** Sets (or unsets) the base resource path of @a application.
  506    * 
  507    * The path is used to automatically load various [application
  508    * resources][gresource] such as menu layouts and action descriptions.
  509    * The various types of resources will be found at fixed names relative
  510    * to the given base path.
  511    * 
  512    * By default, the resource base path is determined from the application
  513    * ID by prefixing '/' and replacing each '.' with '/'.  This is done at
  514    * the time that the Application object is constructed.  Changes to
  515    * the application ID after that point will not have an impact on the
  516    * resource base path.
  517    * 
  518    * As an example, if the application has an ID of "org.example.app" then
  519    * the default resource base path will be "/org/example/app".  If this
  520    * is a Gtk::Application (and you have not manually changed the path)
  521    * then Gtk will then search for the menus of the application at
  522    * "/org/example/app/gtk/menus.ui".
  523    * 
  524    * See Resource for more information about adding resources to your
  525    * application.
  526    * 
  527    * You can disable automatic resource loading functionality by setting
  528    * the path to <tt>nullptr</tt>.
  529    * 
  530    * Changing the resource base path once the application is running is
  531    * not recommended.  The point at which the resource path is consulted
  532    * for forming paths for various purposes is unspecified.  When writing
  533    * a sub-class of Application you should either set the
  534    * Application::property_resource_base_path() property at construction time, or call
  535    * this function during the instance initialization. Alternatively, you
  536    * can call this function in the ApplicationClass.startup virtual function,
  537    * before chaining up to the parent implementation.
  538    * 
  539    * @newin{2,44}
  540    * 
  541    * @param resource_path The resource path to use.
  542    */
  543   void set_resource_base_path(const std::string& resource_path);
  544 
  545   /** Disable automatic resource loading functionality.
  546    * See set_resource_base_path().
  547    * @newin{2,44}
  548    */
  549   void unset_resource_base_path();
  550 
  551   
  552   //Note: We would like to add a group, not just some entries,
  553   //so we can do pre and post parsing. See https://bugzilla.gnome.org/show_bug.cgi?id=727602
  554   //but instead we need to use the VariantDict passed to the handle_local_options signal
  555   //and provided by ApplicationCommandLine::get_options_dict() in on_command_line().
  556 
  557   /** Adds a main option entry to be handled by the Application.
  558    *
  559    * This function is comparable to Glib::OptionGroup::add_entry() +
  560    * Glib::OptionContext::set_main_group().
  561    *
  562    * After the commandline arguments are parsed, the
  563    * signal_handle_local_options() signal will be emitted.  At this
  564    * point, the application can inspect the parsed values.
  565    *
  566    * Unlike OptionGroup + OptionContext, Application packs the arguments
  567    * into a Glib::VariantDict which is passed to the
  568    * signal_handle_local_options() handler, where it can be
  569    * inspected and modified. If Gio::Application::Flags::HANDLES_COMMAND_LINE is
  570    * set, then the resulting dictionary is sent to the primary instance,
  571    * where Gio::ApplicationCommandLine::get_options_dict() will return it.
  572    * This "packing" is done according to the type of the argument --
  573    * booleans for normal flags, Glib::ustring's for strings, std::string's for
  574    * filenames, etc.  The packing only occurs if the flag is given (ie: we
  575    * do not pack a "false" Variant in the case that a flag is missing).
  576    *
  577    * In general, it is recommended that all commandline arguments are
  578    * parsed locally.  The options dictionary should then be used to
  579    * transmit the result of the parsing to the primary instance, where
  580    * Glib::VariantDict::lookup_value() can be used.  For local options, it is
  581    * possible to consult (and potentially remove) the option from the options dictionary.
  582    *
  583    * This function is new in GLib 2.40.  Before then, the only real choice
  584    * was to send all of the commandline arguments (options and all) to the
  585    * primary instance for handling.  Application ignored them completely
  586    * on the local side.  Calling this function "opts in" to the new
  587    * behaviour, and in particular, means that unrecognised options will be
  588    * treated as errors.  Unrecognised options have never been ignored when
  589    * Gio::Application::Flags::HANDLES_COMMAND_LINE is unset.
  590    *
  591    * If signal_handle_local_options() needs to see the list of
  592    * filenames, then the use of G_OPTION_REMAINING as @a long_name is recommended.
  593    * G_OPTION_REMAINING can be used as a key into
  594    * the options dictionary.  If you do use G_OPTION_REMAINING then you
  595    * need to handle these arguments for yourself because once they are
  596    * consumed, they will no longer be visible to the default handling
  597    * (which treats them as filenames to be opened).
  598    *
  599    * @newin{2,42}
  600    *
  601    * @param arg_type A Gio::Application::OptionType.
  602    * @param long_name The long name of an option can be used to specify it
  603    *     in a commandline as `--long_name`. Every option must have a
  604    *     long name.
  605    * @param short_name If an option has a short name, it can be specified
  606    *     `-short_name` in a commandline. @a short_name must be a printable
  607    *     ASCII character different from '-', or '\0' if the option has no
  608    *     short name.
  609    * @param description The description for the option in `--help` output.
  610    * @param arg_description The placeholder to use for the extra argument parsed
  611    *     by the option in `--help` output.
  612    * @param flags Flags from Glib::OptionEntry::Flags. Do not set OptionEntry::Flags::FILENAME.
  613    *     Character encoding is chosen with @a arg_type.
  614    */
  615   void add_main_option_entry(OptionType arg_type, const Glib::ustring& long_name,
  616     gchar short_name = '\0', const Glib::ustring& description = {},
  617     const Glib::ustring& arg_description = {},
  618     Glib::OptionEntry::Flags flags = Glib::OptionEntry::Flags::NONE);
  619   
  620 
  621   /** Adds a main option entry to be handled by the Application.
  622    *
  623    * Adds a string option entry, but lets the callback @a slot parse the extra
  624    * argument instead of having it packed in a Glib::VariantDict.
  625    *
  626    * If you create more than one Application instance (unusual),
  627    * one Application instance can't add an option with the same name as
  628    * another instance adds. This restriction does not apply to the
  629    * add_main_option_entry() that takes an OptionType parameter.
  630    *
  631    * @newin{2,42}
  632    *
  633    * @see add_main_option_entry(OptionType, const Glib::ustring&,
  634    *   gchar, const Glib::ustring&, const Glib::ustring&, Glib::OptionEntry::Flags)
  635    */
  636   void add_main_option_entry(const Glib::OptionGroup::SlotOptionArgString& slot,
  637     const Glib::ustring& long_name,
  638     gchar short_name = '\0', const Glib::ustring& description = {},
  639     const Glib::ustring& arg_description = {},
  640     Glib::OptionEntry::Flags flags = Glib::OptionEntry::Flags::NONE);
  641 
  642   /** Adds a main option entry to be handled by the Application.
  643    *
  644    * Adds a filename option entry, but lets the callback @a slot parse the extra
  645    * argument instead of having it packed in a Glib::VariantDict.
  646    *
  647    * If you create more than one Application instance (unusual),
  648    * one Application instance can't add an option with the same name as
  649    * another instance adds. This restriction does not apply to the
  650    * add_main_option_entry() that takes an OptionType parameter.
  651    *
  652    * @newin{2,42}
  653    *
  654    * @see add_main_option_entry(OptionType, const Glib::ustring&,
  655    *   gchar, const Glib::ustring&, const Glib::ustring&, Glib::OptionEntry::Flags)
  656    */
  657   void add_main_option_entry_filename(const Glib::OptionGroup::SlotOptionArgFilename& slot,
  658     const Glib::ustring& long_name,
  659     gchar short_name = '\0', const Glib::ustring& description = {},
  660     const Glib::ustring& arg_description = {},
  661     Glib::OptionEntry::Flags flags = Glib::OptionEntry::Flags::NONE);
  662 
  663   // GApplication takes ownership of the GOptionGroup, unrefing it later.
  664  
  665 
  666   /** Adds a Glib::OptionGroup to the commandline handling of the application.
  667    *
  668    * This function is comparable to Glib::OptionContext::add_group().
  669    *
  670    * Unlike add_main_option_entry(), this function never transmits options to the
  671    * primary instance.
  672    *
  673    * The reason for that is because, by the time the options arrive at the
  674    * primary instance, it is typically too late to do anything with them.
  675    * Taking the GTK option group as an example: GTK will already have been
  676    * initialised by the time the signal_command_line() handler runs.
  677    * In the case that this is not the first-running instance of the
  678    * application, the existing instance may already have been running for
  679    * a very long time.
  680    *
  681    * This means that the options from Glib::OptionGroup are only really usable
  682    * in the case that the instance of the application being run is the
  683    * first instance. Passing options like `--display=` or `--gdk-debug=`
  684    * on future runs will have no effect on the existing primary instance.
  685    *
  686    * Calling this function will cause the options in the supplied option
  687    * group to be parsed, but it does not cause you to be "opted in" to the
  688    * new functionality whereby unrecognised options are rejected even if
  689    * Gio::Application::Flags::HANDLES_COMMAND_LINE was given.
  690    *
  691    * @newin{2,62}
  692    *
  693    * @param group A Glib::OptionGroup.
  694    * @note The group will not be copied, so it should exist for as long as the application exists.
  695    */
  696   void add_option_group(Glib::OptionGroup& group);
  697 
  698   
  699   /** Sets the parameter string to be used by the commandline handling of @a application.
  700    * 
  701    * This function registers the argument to be passed to Glib::option_context_new()
  702    * when the internal OptionContext of @a application is created.
  703    * 
  704    * See Glib::option_context_new() for more information about @a parameter_string.
  705    * 
  706    * @newin{2,56}
  707    * 
  708    * @param parameter_string A string which is displayed
  709    * in the first line of `--help` output, after the usage summary `programname [OPTION...]`.
  710    */
  711   void set_option_context_parameter_string(const Glib::ustring& parameter_string);
  712   
  713   /** Adds a summary to the @a application option context.
  714    * 
  715    * See Glib::option_context_set_summary() for more information.
  716    * 
  717    * @newin{2,56}
  718    * 
  719    * @param summary A string to be shown in `--help` output
  720    * before the list of options, or <tt>nullptr</tt>.
  721    */
  722   void set_option_context_summary(const Glib::ustring& summary);
  723   
  724   /** Adds a description to the @a application option context.
  725    * 
  726    * See Glib::option_context_set_description() for more information.
  727    * 
  728    * @newin{2,56}
  729    * 
  730    * @param description A string to be shown in `--help` output
  731    * after the list of options, or <tt>nullptr</tt>.
  732    */
  733   void set_option_context_description(const Glib::ustring& description);
  734 
  735   
  736   /** Checks if @a application is registered.
  737    * 
  738    * An application is registered if g_application_register() has been
  739    * successfully called.
  740    * 
  741    * @newin{2,28}
  742    * 
  743    * @return <tt>true</tt> if @a application is registered.
  744    */
  745   bool is_registered() const;
  746   
  747   /** Checks if @a application is remote.
  748    * 
  749    * If @a application is remote then it means that another instance of
  750    * application already exists (the 'primary' instance).  Calls to
  751    * perform actions on @a application will result in the actions being
  752    * performed by the primary instance.
  753    * 
  754    * The value of this property cannot be accessed before
  755    * g_application_register() has been called.  See
  756    * g_application_get_is_registered().
  757    * 
  758    * @newin{2,28}
  759    * 
  760    * @return <tt>true</tt> if @a application is remote.
  761    */
  762   bool is_remote() const;
  763 
  764   //Renamed from register() because that is a C++ keyword.
  765   
  766   /** Attempts registration of the application.
  767    * 
  768    * This is the point at which the application discovers if it is the
  769    * primary instance or merely acting as a remote for an already-existing
  770    * primary instance.  This is implemented by attempting to acquire the
  771    * application identifier as a unique bus name on the session bus using
  772    * GDBus.
  773    * 
  774    * If there is no application ID or if Gio::Application::Flags::NON_UNIQUE was
  775    * given, then this process will always become the primary instance.
  776    * 
  777    * Due to the internal architecture of GDBus, method calls can be
  778    * dispatched at any time (even if a main loop is not running).  For
  779    * this reason, you must ensure that any object paths that you wish to
  780    * register are registered before calling this function.
  781    * 
  782    * If the application has already been registered then <tt>true</tt> is
  783    * returned with no work performed.
  784    * 
  785    * The Application::signal_startup() signal is emitted if registration succeeds
  786    * and @a application is the primary instance (including the non-unique
  787    * case).
  788    * 
  789    * In the event of an error (such as @a cancellable being cancelled, or a
  790    * failure to connect to the session bus), <tt>false</tt> is returned and @a error
  791    * is set appropriately.
  792    * 
  793    * @note the return value of this function is not an indicator that this
  794    * instance is or is not the primary instance of the application.  See
  795    * g_application_get_is_remote() for that.
  796    * 
  797    * @newin{2,28}
  798    * 
  799    * @param cancellable A Cancellable, or <tt>nullptr</tt>.
  800    * @return <tt>true</tt> if registration succeeded.
  801    * 
  802    * @throws Glib::Error
  803    */
  804   bool register_application(const Glib::RefPtr<Gio::Cancellable>& cancellable);
  805 
  806   /// A register_application() convenience overload.
  807   bool register_application();
  808   
  809 
  810   /** Increases the use count of @a application.
  811    * 
  812    * Use this function to indicate that the application has a reason to
  813    * continue to run.  For example, g_application_hold() is called by GTK+
  814    * when a toplevel window is on the screen.
  815    * 
  816    * To cancel the hold, call g_application_release().
  817    */
  818   void hold();
  819   
  820   /** Decrease the use count of @a application.
  821    * 
  822    * When the use count reaches zero, the application will stop running.
  823    * 
  824    * Never call this function except to cancel the effect of a previous
  825    * call to g_application_hold().
  826    */
  827   void release();
  828   
  829   /** Activates the application.
  830    * 
  831    * In essence, this results in the Application::signal_activate() signal being
  832    * emitted in the primary instance.
  833    * 
  834    * The application must be registered before calling this function.
  835    * 
  836    * @newin{2,28}
  837    */
  838   void activate();
  839 
  840   using type_vec_files = std::vector< Glib::RefPtr<File> >;
  841 
  842   /* Opens the given files.
  843    *
  844    * In essence, this results in the open signal being emitted
  845    * in the primary instance.
  846    *
  847    * @a hint is simply passed through to the open signal.  It is
  848    * intended to be used by applications that have multiple modes for
  849    * opening files (eg: "view" vs "edit", etc).
  850    *
  851    * The application must be registered before calling this method
  852    * and it must have the Application::Flags::HANDLES_OPEN flag set.
  853    *
  854    * @param files The files to open. This must be non-empty.
  855    * @param hint A hint.
  856    *
  857    * @newin{2,32}
  858    */
  859   void open(const type_vec_files& files, const Glib::ustring& hint = {});
  860   
  861 
  862   /* Opens the given file.
  863    *
  864    * In essence, this results in the open signal being emitted
  865    * in the primary instance.
  866    *
  867    * @a hint is simply passed through to the open signal.  It is
  868    * intended to be used by applications that have multiple modes for
  869    * opening files (eg: "view" vs "edit", etc).
  870    *
  871    * The application must be registered before calling this method
  872    * and it must have the Application::Flags::HANDLES_OPEN flag set.
  873    *
  874    * @param file The file to open. This must be non-empty.
  875    * @param hint A hint.
  876    *
  877    * @newin{2,32}
  878    */
  879   void open(const Glib::RefPtr<Gio::File>& file, const Glib::ustring& hint = {});
  880 
  881   
  882   /** Runs the application.
  883    * 
  884    * This function is intended to be run from main() and its return value
  885    * is intended to be returned by main(). Although you are expected to pass
  886    * the @a argc, @a argv parameters from main() to this function, it is possible
  887    * to pass <tt>nullptr</tt> if @a argv is not available or commandline handling is not
  888    * required.  Note that on Windows, @a argc and @a argv are ignored, and
  889    * Glib::win32_get_command_line() is called internally (for proper support
  890    * of Unicode commandline arguments).
  891    * 
  892    * Application will attempt to parse the commandline arguments.  You
  893    * can add commandline flags to the list of recognised options by way of
  894    * g_application_add_main_option_entries().  After this, the
  895    * Application::signal_handle_local_options() signal is emitted, from which the
  896    * application can inspect the values of its OptionEntrys.
  897    * 
  898    * Application::signal_handle_local_options() is a good place to handle options
  899    * such as `--version`, where an immediate reply from the local process is
  900    * desired (instead of communicating with an already-running instance).
  901    * A Application::signal_handle_local_options() handler can stop further processing
  902    * by returning a non-negative value, which then becomes the exit status of
  903    * the process.
  904    * 
  905    * What happens next depends on the flags: if
  906    * Gio::Application::Flags::HANDLES_COMMAND_LINE was specified then the remaining
  907    * commandline arguments are sent to the primary instance, where a
  908    * Application::signal_command_line() signal is emitted.  Otherwise, the
  909    * remaining commandline arguments are assumed to be a list of files.
  910    * If there are no files listed, the application is activated via the
  911    * Application::signal_activate() signal.  If there are one or more files, and
  912    * Gio::Application::Flags::HANDLES_OPEN was specified then the files are opened
  913    * via the Application::signal_open() signal.
  914    * 
  915    * If you are interested in doing more complicated local handling of the
  916    * commandline then you should implement your own Application subclass
  917    * and override local_command_line(). In this case, you most likely want
  918    * to return <tt>true</tt> from your local_command_line() implementation to
  919    * suppress the default handling. See
  920    * [gapplication-example-cmdline2.c][https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c]
  921    * for an example.
  922    * 
  923    * If, after the above is done, the use count of the application is zero
  924    * then the exit status is returned immediately.  If the use count is
  925    * non-zero then the default main context is iterated until the use count
  926    * falls to zero, at which point 0 is returned.
  927    * 
  928    * If the Gio::Application::Flags::IS_SERVICE flag is set, then the service will
  929    * run for as much as 10 seconds with a use count of zero while waiting
  930    * for the message that caused the activation to arrive.  After that,
  931    * if the use count falls to zero the application will exit immediately,
  932    * except in the case that g_application_set_inactivity_timeout() is in
  933    * use.
  934    * 
  935    * This function sets the prgname (Glib::set_prgname()), if not already set,
  936    * to the basename of argv[0].
  937    * 
  938    * Much like Glib::main_loop_run(), this function will acquire the main context
  939    * for the duration that the application is running.
  940    * 
  941    * Since 2.40, applications that are not explicitly flagged as services
  942    * or launchers (ie: neither Gio::Application::Flags::IS_SERVICE or
  943    * Gio::Application::Flags::IS_LAUNCHER are given as flags) will check (from the
  944    * default handler for local_command_line) if "--gapplication-service"
  945    * was given in the command line.  If this flag is present then normal
  946    * commandline processing is interrupted and the
  947    * Gio::Application::Flags::IS_SERVICE flag is set.  This provides a "compromise"
  948    * solution whereby running an application directly from the commandline
  949    * will invoke it in the normal way (which can be useful for debugging)
  950    * while still allowing applications to be D-Bus activated in service
  951    * mode.  The D-Bus service file should invoke the executable with
  952    * "--gapplication-service" as the sole commandline argument.  This
  953    * approach is suitable for use by most graphical applications but
  954    * should not be used from applications like editors that need precise
  955    * control over when processes invoked via the commandline will exit and
  956    * what their exit status will be.
  957    * 
  958    * @newin{2,28}
  959    * 
  960    * @param argc The argc from main() (or 0 if @a argv is <tt>nullptr</tt>).
  961    * @param argv The argv from main(), or <tt>nullptr</tt>.
  962    * @return The exit status.
  963    */
  964   int run(int argc, char** argv);
  965 
  966   
  967   /** Immediately quits the application.
  968    * 
  969    * Upon return to the mainloop, g_application_run() will return,
  970    * calling only the 'shutdown' function before doing so.
  971    * 
  972    * The hold count is ignored.
  973    * Take care if your code has called g_application_hold() on the application and
  974    * is therefore still expecting it to exist.
  975    * (Note that you may have called g_application_hold() indirectly, for example
  976    * through gtk_application_add_window().)
  977    * 
  978    * The result of calling g_application_run() again after it returns is
  979    * unspecified.
  980    * 
  981    * @newin{2,32}
  982    */
  983   void quit();
  984 
  985   
  986   /** Sets or unsets the default application for the process, as returned
  987    * by g_application_get_default().
  988    * 
  989    * This function does not take its own reference on @a application.  If
  990    *  @a application is destroyed then the default application will revert
  991    * back to <tt>nullptr</tt>.
  992    * 
  993    * @newin{2,32}
  994    * 
  995    * @param application The application to set as default, or <tt>nullptr</tt>.
  996    */
  997   static void set_default(const Glib::RefPtr<Application>& application);
  998 
  999   /// Unsets any existing default application.
 1000   static void unset_default();
 1001 
 1002   
 1003   /** Returns the default Application instance for this process.
 1004    * 
 1005    * Normally there is only one Application per process and it becomes
 1006    * the default when it is created.  You can exercise more control over
 1007    * this by using g_application_set_default().
 1008    * 
 1009    * If there is no default application then <tt>nullptr</tt> is returned.
 1010    * 
 1011    * @newin{2,32}
 1012    * 
 1013    * @return The default application for this process, or <tt>nullptr</tt>.
 1014    */
 1015   static Glib::RefPtr<Application> get_default();
 1016 
 1017   
 1018   /** Increases the busy count of @a application.
 1019    * 
 1020    * Use this function to indicate that the application is busy, for instance
 1021    * while a long running operation is pending.
 1022    * 
 1023    * The busy state will be exposed to other processes, so a session shell will
 1024    * use that information to indicate the state to the user (e.g. with a
 1025    * spinner).
 1026    * 
 1027    * To cancel the busy indication, use g_application_unmark_busy().
 1028    * 
 1029    * The application must be registered before calling this function.
 1030    * 
 1031    * @newin{2,38}
 1032    */
 1033   void mark_busy();
 1034   
 1035   /** Decreases the busy count of @a application.
 1036    * 
 1037    * When the busy count reaches zero, the new state will be propagated
 1038    * to other processes.
 1039    * 
 1040    * This function must only be called to cancel the effect of a previous
 1041    * call to g_application_mark_busy().
 1042    * 
 1043    * @newin{2,38}
 1044    */
 1045   void unmark_busy();
 1046   
 1047   /** Gets the application's current busy state, as set through
 1048    * g_application_mark_busy() or g_application_bind_busy_property().
 1049    * 
 1050    * @newin{2,44}
 1051    * 
 1052    * @return <tt>true</tt> if @a application is currently marked as busy.
 1053    */
 1054   bool get_is_busy() const;
 1055 
 1056   
 1057   /** Sends a notification on behalf of @a application to the desktop shell.
 1058    * There is no guarantee that the notification is displayed immediately,
 1059    * or even at all.
 1060    * 
 1061    * Notifications may persist after the application exits. It will be
 1062    * D-Bus-activated when the notification or one of its actions is
 1063    * activated.
 1064    * 
 1065    * Modifying @a notification after this call has no effect. However, the
 1066    * object can be reused for a later call to this function.
 1067    * 
 1068    *  @a id may be any string that uniquely identifies the event for the
 1069    * application. It does not need to be in any special format. For
 1070    * example, "new-message" might be appropriate for a notification about
 1071    * new messages.
 1072    * 
 1073    * If a previous notification was sent with the same @a id, it will be
 1074    * replaced with @a notification and shown again as if it was a new
 1075    * notification. This works even for notifications sent from a previous
 1076    * execution of the application, as long as @a id is the same string.
 1077    * 
 1078    *  @a id may be <tt>nullptr</tt>, but it is impossible to replace or withdraw
 1079    * notifications without an id.
 1080    * 
 1081    * If @a notification is no longer relevant, it can be withdrawn with
 1082    * g_application_withdraw_notification().
 1083    * 
 1084    * @newin{2,40}
 1085    * 
 1086    * @param id Id of the notification, or <tt>nullptr</tt>.
 1087    * @param notification The Notification to send.
 1088    */
 1089   void send_notification(const Glib::ustring& id, const Glib::RefPtr<Notification>& notification);
 1090 
 1091   /// A send_notification() convenience overload.
 1092   void send_notification(const Glib::RefPtr<Notification>& notification);
 1093   
 1094   /** Withdraws a notification that was sent with
 1095    * g_application_send_notification().
 1096    * 
 1097    * This call does nothing if a notification with @a id doesn't exist or
 1098    * the notification was never sent.
 1099    * 
 1100    * This function works even for notifications sent in previous
 1101    * executions of this application, as long @a id is the same as it was for
 1102    * the sent notification.
 1103    * 
 1104    * Note that notifications are dismissed when the user clicks on one
 1105    * of the buttons in a notification or triggers its default action, so
 1106    * there is no need to explicitly withdraw the notification in that case.
 1107    * 
 1108    * @newin{2,40}
 1109    * 
 1110    * @param id Id of a previously sent notification.
 1111    */
 1112   void withdraw_notification(const Glib::ustring& id);
 1113 
 1114 //TODO: Glib::RefPtr<Glib::ObjectBase>, Glib::ObjectBase, or both?
 1115 //#m4 __CONVERSION(`const Glib::RefPtr<Glib::ObjectBase>&', `gpointer', `($3)->gobj()')
 1116 //  _WRAP_METHOD(void bind_busy_property(const Glib::RefPtr<Glib::ObjectBase>& object, const Glib::ustring& property), g_application_bind_busy_property)
 1117 //  _WRAP_METHOD(void unbind_busy_property(const Glib::RefPtr<Glib::ObjectBase>& object, const Glib::ustring& property), g_application_unbind_busy_property)
 1118 
 1119   
 1120   /** The unique identifier for the application.
 1121    *
 1122    * Default value: ""
 1123    *
 1124    * @return A PropertyProxy that allows you to get or set the value of the property,
 1125    * or receive notification when the value of the property changes.
 1126    */
 1127   Glib::PropertyProxy< Glib::ustring > property_application_id() ;
 1128 
 1129 /** The unique identifier for the application.
 1130    *
 1131    * Default value: ""
 1132    *
 1133    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1134    * or receive notification when the value of the property changes.
 1135    */
 1136   Glib::PropertyProxy_ReadOnly< Glib::ustring > property_application_id() const;
 1137 
 1138   /** Flags specifying the behaviour of the application.
 1139    *
 1140    * Default value: Gio::Application::Flags::NONE
 1141    *
 1142    * @return A PropertyProxy that allows you to get or set the value of the property,
 1143    * or receive notification when the value of the property changes.
 1144    */
 1145   Glib::PropertyProxy< Flags > property_flags() ;
 1146 
 1147 /** Flags specifying the behaviour of the application.
 1148    *
 1149    * Default value: Gio::Application::Flags::NONE
 1150    *
 1151    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1152    * or receive notification when the value of the property changes.
 1153    */
 1154   Glib::PropertyProxy_ReadOnly< Flags > property_flags() const;
 1155 
 1156   /** Time (ms) to stay alive after becoming idle.
 1157    *
 1158    * Default value: 0
 1159    *
 1160    * @return A PropertyProxy that allows you to get or set the value of the property,
 1161    * or receive notification when the value of the property changes.
 1162    */
 1163   Glib::PropertyProxy< guint > property_inactivity_timeout() ;
 1164 
 1165 /** Time (ms) to stay alive after becoming idle.
 1166    *
 1167    * Default value: 0
 1168    *
 1169    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1170    * or receive notification when the value of the property changes.
 1171    */
 1172   Glib::PropertyProxy_ReadOnly< guint > property_inactivity_timeout() const;
 1173 
 1174   /** If g_application_register() has been called.
 1175    *
 1176    * Default value: <tt>false</tt>
 1177    *
 1178    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1179    * or receive notification when the value of the property changes.
 1180    */
 1181   Glib::PropertyProxy_ReadOnly< bool > property_is_registered() const;
 1182 
 1183 
 1184   /** If this application instance is remote.
 1185    *
 1186    * Default value: <tt>false</tt>
 1187    *
 1188    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1189    * or receive notification when the value of the property changes.
 1190    */
 1191   Glib::PropertyProxy_ReadOnly< bool > property_is_remote() const;
 1192 
 1193 
 1194   /** The base resource path for the application.
 1195    *
 1196    * @newin{2,44}
 1197    *
 1198    * Default value: ""
 1199    *
 1200    * @return A PropertyProxy that allows you to get or set the value of the property,
 1201    * or receive notification when the value of the property changes.
 1202    */
 1203   Glib::PropertyProxy< std::string > property_resource_base_path() ;
 1204 
 1205 /** The base resource path for the application.
 1206    *
 1207    * @newin{2,44}
 1208    *
 1209    * Default value: ""
 1210    *
 1211    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1212    * or receive notification when the value of the property changes.
 1213    */
 1214   Glib::PropertyProxy_ReadOnly< std::string > property_resource_base_path() const;
 1215 
 1216   /** Whether the application is currently marked as busy through
 1217    * g_application_mark_busy() or g_application_bind_busy_property().
 1218    * 
 1219    * @newin{2,44}
 1220    *
 1221    * Default value: <tt>false</tt>
 1222    *
 1223    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
 1224    * or receive notification when the value of the property changes.
 1225    */
 1226   Glib::PropertyProxy_ReadOnly< bool > property_is_busy() const;
 1227 
 1228 
 1229   /**
 1230    * @par Slot Prototype:
 1231    * <tt>void on_my_%startup()</tt>
 1232    *
 1233    * Flags: Run First
 1234    *
 1235    * The signal_startup() signal is emitted on the primary instance immediately
 1236    * after registration. See g_application_register().
 1237    */
 1238 
 1239   Glib::SignalProxy<void()> signal_startup();
 1240 
 1241   
 1242   /**
 1243    * @par Slot Prototype:
 1244    * <tt>void on_my_%shutdown()</tt>
 1245    *
 1246    * Flags: Run Last
 1247    *
 1248    * The signal_shutdown() signal is emitted only on the registered primary instance
 1249    * immediately after the main loop terminates.
 1250    * 
 1251    * @newin{2,46}
 1252    */
 1253 
 1254   Glib::SignalProxy<void()> signal_shutdown();
 1255 
 1256   
 1257   /**
 1258    * @par Slot Prototype:
 1259    * <tt>void on_my_%activate()</tt>
 1260    *
 1261    * Flags: Run Last
 1262    *
 1263    * The signal_activate() signal is emitted on the primary instance when an
 1264    * activation occurs. See g_application_activate().
 1265    */
 1266 
 1267   Glib::SignalProxy<void()> signal_activate();
 1268 
 1269 
 1270   //We wrap the open signal without _WRAP_SIGNAL(), because we need to change its parameters.
 1271   //See bug https://bugzilla.gnome.org/show_bug.cgi?id=637457
 1272   Glib::SignalProxy<void(const type_vec_files&, const Glib::ustring&)> signal_open();
 1273   
 1274 
 1275   /**
 1276    * @par Slot Prototype:
 1277    * <tt>int on_my_%command_line(const Glib::RefPtr<ApplicationCommandLine>& command_line)</tt>
 1278    *
 1279    * Flags: Run Last
 1280    *
 1281    * The signal_command_line() signal is emitted on the primary instance when
 1282    * a commandline is not handled locally. See g_application_run() and
 1283    * the ApplicationCommandLine documentation for more information.
 1284    * 
 1285    * @param command_line A ApplicationCommandLine representing the
 1286    * passed commandline.
 1287    * @return An integer that is set as the exit status for the calling
 1288    * process. See g_application_command_line_set_exit_status().
 1289    */
 1290 
 1291   Glib::SignalProxy<int(const Glib::RefPtr<ApplicationCommandLine>&)> signal_command_line();
 1292 
 1293 
 1294   //TODO: Avoid the use of the Variants in the VariantDict?
 1295   //options must be non-const. The handler is meant to modify it. See the description
 1296   //of add_main_option_entry(OptionType, ...).
 1297  
 1298 
 1299   /**
 1300    * @par Slot Prototype:
 1301    * <tt>int on_my_%handle_local_options(const Glib::RefPtr<Glib::VariantDict>& options)</tt>
 1302    *
 1303    * Flags: Run Last
 1304    *
 1305    * The signal_handle_local_options() signal is emitted on the local instance
 1306    * after the parsing of the commandline options has occurred.
 1307    * 
 1308    * You can add options to be recognised during commandline option
 1309    * parsing using g_application_add_main_option_entries() and
 1310    * g_application_add_option_group().
 1311    * 
 1312    * Signal handlers can inspect @a options (along with values pointed to
 1313    * from the @a arg_data of an installed OptionEntrys) in order to
 1314    * decide to perform certain actions, including direct local handling
 1315    * (which may be useful for options like --version).
 1316    * 
 1317    * In the event that the application is marked
 1318    * Gio::Application::Flags::HANDLES_COMMAND_LINE the "normal processing" will
 1319    * send the @a options dictionary to the primary instance where it can be
 1320    * read with g_application_command_line_get_options_dict().  The signal
 1321    * handler can modify the dictionary before returning, and the
 1322    * modified dictionary will be sent.
 1323    * 
 1324    * In the event that Gio::Application::Flags::HANDLES_COMMAND_LINE is not set,
 1325    * "normal processing" will treat the remaining uncollected command
 1326    * line arguments as filenames or URIs.  If there are no arguments,
 1327    * the application is activated by g_application_activate().  One or
 1328    * more arguments results in a call to g_application_open().
 1329    * 
 1330    * If you want to handle the local commandline arguments for yourself
 1331    * by converting them to calls to g_application_open() or
 1332    * g_action_group_activate_action() then you must be sure to register
 1333    * the application first.  You should probably not call
 1334    * g_application_activate() for yourself, however: just return -1 and
 1335    * allow the default handler to do it for you.  This will ensure that
 1336    * the `--gapplication-service` switch works properly (i.e. no activation
 1337    * in that case).
 1338    * 
 1339    * Note that this signal is emitted from the default implementation of
 1340    * local_command_line().  If you override that function and don't
 1341    * chain up then this signal will never be emitted.
 1342    * 
 1343    * You can override local_command_line() if you need more powerful
 1344    * capabilities than what is provided here, but this should not
 1345    * normally be required.
 1346    * 
 1347    * @newin{2,40}
 1348    * 
 1349    * @param options The options dictionary.
 1350    * @return An exit code. If you have handled your options and want
 1351    * to exit the process, return a non-negative option, 0 for success,
 1352    * and a positive value for failure. To continue, return -1 to let
 1353    * the default option processing continue.
 1354    */
 1355 
 1356   Glib::SignalProxy<int(const Glib::RefPtr<Glib::VariantDict>&)> signal_handle_local_options();
 1357 
 1358 
 1359   /**
 1360    * @par Slot Prototype:
 1361    * <tt>bool on_my_%name_lost()</tt>
 1362    *
 1363    * Flags: Run Last
 1364    *
 1365    * The signal_name_lost() signal is emitted only on the registered primary instance
 1366    * when a new instance has taken over. This can only happen if the application
 1367    * is using the Gio::Application::Flags::ALLOW_REPLACEMENT flag.
 1368    * 
 1369    * The default handler for this signal calls g_application_quit().
 1370    * 
 1371    * @newin{2,60}
 1372    * 
 1373    * @return <tt>true</tt> if the signal has been handled.
 1374    */
 1375 
 1376   Glib::SignalProxy<bool()> signal_name_lost();
 1377 
 1378 
 1379 protected:
 1380   virtual void on_open(const type_vec_files& files, const Glib::ustring& hint);
 1381 
 1382 
 1383     virtual bool local_command_line_vfunc(char**& arguments, int& exit_status);
 1384 
 1385 
 1386     virtual void before_emit_vfunc(const Glib::VariantBase& platform_data);
 1387 
 1388     virtual void after_emit_vfunc(const Glib::VariantBase& platform_data);
 1389 
 1390 
 1391   //TODO: File a bug about GVariantBuilder not being registered with the GType system first:
 1392   //_WRAP_VFUNC(void add_platform_data(Glib::VariantBuilder* builder), "add_platform_data")
 1393 
 1394     virtual void quit_mainloop_vfunc();
 1395 
 1396     virtual void run_mainloop_vfunc();
 1397 
 1398 
 1399   /// @throws Glib::Error.
 1400   virtual bool dbus_register_vfunc(const Glib::RefPtr<DBus::Connection>& connection, const Glib::ustring& object_path);
 1401 
 1402     virtual void dbus_unregister_vfunc(const Glib::RefPtr<DBus::Connection>& connection, const Glib::ustring& object_path);
 1403 
 1404 
 1405 private:
 1406   /** This is just a way to call Glib::init() before calling a Glib::Object ctor,
 1407    * so that glibmm's GQuarks are created before they are used.
 1408    */
 1409   const Glib::Class& custom_class_init();
 1410 
 1411   // Code, common to the public add_main_option_entry*() methods with a callback slot.
 1412   void add_main_option_entry_private(const gchar* long_name, gchar short_name,
 1413     const gchar* description, const gchar* arg_description,
 1414     Glib::OptionEntry::Flags flags);
 1415 
 1416 
 1417 public:
 1418 
 1419 public:
 1420   //C++ methods used to invoke GTK+ virtual functions:
 1421 
 1422 protected:
 1423   //GTK+ Virtual Functions (override these to change behaviour):
 1424 
 1425   //Default Signal Handlers::
 1426   /// This is a default handler for the signal signal_startup().
 1427   virtual void on_startup();
 1428   /// This is a default handler for the signal signal_shutdown().
 1429   virtual void on_shutdown();
 1430   /// This is a default handler for the signal signal_activate().
 1431   virtual void on_activate();
 1432   /// This is a default handler for the signal signal_command_line().
 1433   virtual int on_command_line(const Glib::RefPtr<ApplicationCommandLine>& command_line);
 1434   /// This is a default handler for the signal signal_handle_local_options().
 1435   virtual int on_handle_local_options(const Glib::RefPtr<Glib::VariantDict>& options);
 1436   /// This is a default handler for the signal signal_name_lost().
 1437   virtual bool on_name_lost();
 1438 
 1439 
 1440 };
 1441 
 1442 } // namespace Gio
 1443 
 1444 namespace Gio
 1445 {
 1446 
 1447 /** @ingroup giommEnums */
 1448 inline Application::Flags operator|(Application::Flags lhs, Application::Flags rhs)
 1449   { return static_cast<Application::Flags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
 1450 
 1451 /** @ingroup giommEnums */
 1452 inline Application::Flags operator&(Application::Flags lhs, Application::Flags rhs)
 1453   { return static_cast<Application::Flags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
 1454 
 1455 /** @ingroup giommEnums */
 1456 inline Application::Flags operator^(Application::Flags lhs, Application::Flags rhs)
 1457   { return static_cast<Application::Flags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
 1458 
 1459 /** @ingroup giommEnums */
 1460 inline Application::Flags operator~(Application::Flags flags)
 1461   { return static_cast<Application::Flags>(~static_cast<unsigned>(flags)); }
 1462 
 1463 /** @ingroup giommEnums */
 1464 inline Application::Flags& operator|=(Application::Flags& lhs, Application::Flags rhs)
 1465   { return (lhs = static_cast<Application::Flags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
 1466 
 1467 /** @ingroup giommEnums */
 1468 inline Application::Flags& operator&=(Application::Flags& lhs, Application::Flags rhs)
 1469   { return (lhs = static_cast<Application::Flags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
 1470 
 1471 /** @ingroup giommEnums */
 1472 inline Application::Flags& operator^=(Application::Flags& lhs, Application::Flags rhs)
 1473   { return (lhs = static_cast<Application::Flags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
 1474 } // namespace Gio
 1475 
 1476 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 1477 namespace Glib
 1478 {
 1479 
 1480 template <>
 1481 class GIOMM_API Value<Gio::Application::Flags> : public Glib::Value_Flags<Gio::Application::Flags>
 1482 {
 1483 public:
 1484   static GType value_type() G_GNUC_CONST;
 1485 };
 1486 
 1487 } // namespace Glib
 1488 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 1489 
 1490 
 1491 namespace Glib
 1492 {
 1493   /** A Glib::wrap() method for this object.
 1494    *
 1495    * @param object The C instance.
 1496    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
 1497    * @result A C++ instance that wraps this C instance.
 1498    *
 1499    * @relates Gio::Application
 1500    */
 1501   GIOMM_API
 1502   Glib::RefPtr<Gio::Application> wrap(GApplication* object, bool take_copy = false);
 1503 }
 1504 
 1505 
 1506 #endif /* _GIOMM_APPLICATION_H */
 1507