Skip to main content

gio/auto/
application.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    ActionGroup, ActionMap, ApplicationFlags, Cancellable, DBusConnection, File, Notification, ffi,
7};
8use glib::{
9    object::ObjectType as _,
10    prelude::*,
11    signal::{SignalHandlerId, connect_raw},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    ///  from the
18    /// launching instance to the primary instance, in the form of a
19    /// [`glib::Variant`][struct@crate::glib::Variant] dictionary mapping strings to variants. To use platform
20    /// data, override the [`ApplicationImpl::before_emit()`][crate::subclass::prelude::ApplicationImpl::before_emit()] or
21    /// [`ApplicationImpl::after_emit()`][crate::subclass::prelude::ApplicationImpl::after_emit()] virtual functions
22    /// in your `GApplication` subclass. When dealing with
23    /// [`ApplicationCommandLine`][crate::ApplicationCommandLine] objects, the platform data is
24    /// directly available via [`ApplicationCommandLineExt::cwd()`][crate::prelude::ApplicationCommandLineExt::cwd()],
25    /// [`ApplicationCommandLineExt::environ()`][crate::prelude::ApplicationCommandLineExt::environ()] and
26    /// [`ApplicationCommandLineExt::platform_data()`][crate::prelude::ApplicationCommandLineExt::platform_data()].
27    ///
28    /// As the name indicates, the platform data may vary depending on the
29    /// operating system, but it always includes the current directory (key
30    /// `cwd`), and optionally the environment (ie the set of environment
31    /// variables and their values) of the calling process (key `environ`).
32    /// The environment is only added to the platform data if the
33    /// `G_APPLICATION_SEND_ENVIRONMENT` flag is set. `GApplication` subclasses
34    /// can add their own platform data by overriding the
35    /// `vfunc::Gio::Application::add_platform_data` virtual function. For instance,
36    /// `GtkApplication` adds startup notification data in this way.
37    ///
38    /// To parse commandline arguments you may handle the
39    /// [`command-line`][struct@crate::Application#command-line] signal or override the
40    /// `vfunc::Gio::Application::local_command_line` virtual function, to parse them in
41    /// either the primary instance or the local instance, respectively.
42    ///
43    /// For an example of opening files with a `GApplication`, see
44    /// [gapplication-example-open.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-open.c).
45    ///
46    /// For an example of using actions with `GApplication`, see
47    /// [gapplication-example-actions.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-actions.c).
48    ///
49    /// For an example of using extra D-Bus hooks with `GApplication`, see
50    /// [gapplication-example-dbushooks.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-dbushooks.c).
51    ///
52    /// ## Properties
53    ///
54    ///
55    /// #### `action-group`
56    ///  The group of actions that the application exports.
57    ///
58    /// Writable
59    ///
60    ///
61    /// #### `application-id`
62    ///  The unique identifier for the application.
63    ///
64    /// Readable | Writable | Construct
65    ///
66    ///
67    /// #### `flags`
68    ///  Flags specifying the behaviour of the application.
69    ///
70    /// Readable | Writable
71    ///
72    ///
73    /// #### `inactivity-timeout`
74    ///  Time (in milliseconds) to stay alive after becoming idle.
75    ///
76    /// Readable | Writable
77    ///
78    ///
79    /// #### `is-busy`
80    ///  Whether the application is currently marked as busy through
81    /// g_application_mark_busy() or g_application_bind_busy_property().
82    ///
83    /// Readable
84    ///
85    ///
86    /// #### `is-registered`
87    ///  Whether [`ApplicationExt::register()`][crate::prelude::ApplicationExt::register()] has been called.
88    ///
89    /// Readable
90    ///
91    ///
92    /// #### `is-remote`
93    ///  Whether this application instance is remote.
94    ///
95    /// Readable
96    ///
97    ///
98    /// #### `resource-base-path`
99    ///  The base resource path for the application.
100    ///
101    /// Readable | Writable
102    ///
103    ///
104    /// #### `version`
105    ///  The human-readable version number of the application.
106    ///
107    /// Readable | Writable
108    ///
109    /// ## Signals
110    ///
111    ///
112    /// #### `activate`
113    ///  The ::activate signal is emitted on the primary instance when an
114    /// activation occurs. See g_application_activate().
115    ///
116    ///
117    ///
118    ///
119    /// #### `command-line`
120    ///  The ::command-line signal is emitted on the primary instance when
121    /// a commandline is not handled locally. See g_application_run() and
122    /// the #GApplicationCommandLine documentation for more information.
123    ///
124    ///
125    ///
126    ///
127    /// #### `handle-local-options`
128    ///  The ::handle-local-options signal is emitted on the local instance
129    /// after the parsing of the commandline options has occurred.
130    ///
131    /// You can add options to be recognised during commandline option
132    /// parsing using g_application_add_main_option_entries() and
133    /// g_application_add_option_group().
134    ///
135    /// Signal handlers can inspect @options (along with values pointed to
136    /// from the @arg_data of an installed #GOptionEntrys) in order to
137    /// decide to perform certain actions, including direct local handling
138    /// (which may be useful for options like --version).
139    ///
140    /// In the event that the application is marked
141    /// [`ApplicationFlags::HANDLES_COMMAND_LINE`][crate::ApplicationFlags::HANDLES_COMMAND_LINE] the "normal processing" will
142    /// send the @options dictionary to the primary instance where it can be
143    /// read with g_application_command_line_get_options_dict().  The signal
144    /// handler can modify the dictionary before returning, and the
145    /// modified dictionary will be sent.
146    ///
147    /// In the event that [`ApplicationFlags::HANDLES_COMMAND_LINE`][crate::ApplicationFlags::HANDLES_COMMAND_LINE] is not set,
148    /// "normal processing" will treat the remaining uncollected command
149    /// line arguments as filenames or URIs.  If there are no arguments,
150    /// the application is activated by g_application_activate().  One or
151    /// more arguments results in a call to g_application_open().
152    ///
153    /// If you want to handle the local commandline arguments for yourself
154    /// by converting them to calls to g_application_open() or
155    /// g_action_group_activate_action() then you must be sure to register
156    /// the application first.  You should probably not call
157    /// g_application_activate() for yourself, however: just return -1 and
158    /// allow the default handler to do it for you.  This will ensure that
159    /// the `--gapplication-service` switch works properly (i.e. no activation
160    /// in that case).
161    ///
162    /// Note that this signal is emitted from the default implementation of
163    /// local_command_line().  If you override that function and don't
164    /// chain up then this signal will never be emitted.
165    ///
166    /// You can override local_command_line() if you need more powerful
167    /// capabilities than what is provided here, but this should not
168    /// normally be required.
169    ///
170    ///
171    ///
172    ///
173    /// #### `name-lost`
174    ///  The ::name-lost signal is emitted only on the registered primary instance
175    /// when a new instance has taken over. This can only happen if the application
176    /// is using the [`ApplicationFlags::ALLOW_REPLACEMENT`][crate::ApplicationFlags::ALLOW_REPLACEMENT] flag.
177    ///
178    /// The default handler for this signal calls g_application_quit().
179    ///
180    ///
181    ///
182    ///
183    /// #### `open`
184    ///  The ::open signal is emitted on the primary instance when there are
185    /// files to open. See g_application_open() for more information.
186    ///
187    ///
188    ///
189    ///
190    /// #### `shutdown`
191    ///  The ::shutdown signal is emitted only on the registered primary instance
192    /// immediately after the main loop terminates.
193    ///
194    ///
195    ///
196    ///
197    /// #### `startup`
198    ///  The ::startup signal is emitted on the primary instance immediately
199    /// after registration. See g_application_register().
200    ///
201    ///
202    /// <details><summary><h4>ActionGroup</h4></summary>
203    ///
204    ///
205    /// #### `action-added`
206    ///  Signals that a new action was just added to the group.
207    ///
208    /// This signal is emitted after the action has been added
209    /// and is now visible.
210    ///
211    /// Detailed
212    ///
213    ///
214    /// #### `action-enabled-changed`
215    ///  Signals that the enabled status of the named action has changed.
216    ///
217    /// Detailed
218    ///
219    ///
220    /// #### `action-removed`
221    ///  Signals that an action is just about to be removed from the group.
222    ///
223    /// This signal is emitted before the action is removed, so the action
224    /// is still visible and can be queried from the signal handler.
225    ///
226    /// Detailed
227    ///
228    ///
229    /// #### `action-state-changed`
230    ///  Signals that the state of the named action has changed.
231    ///
232    /// Detailed
233    /// </details>
234    ///
235    /// # Implements
236    ///
237    /// [`ApplicationExt`][trait@crate::prelude::ApplicationExt], [`trait@glib::ObjectExt`], [`ActionGroupExt`][trait@crate::prelude::ActionGroupExt], [`ActionMapExt`][trait@crate::prelude::ActionMapExt], [`ApplicationExtManual`][trait@crate::prelude::ApplicationExtManual], [`ActionMapExtManual`][trait@crate::prelude::ActionMapExtManual]
238    #[doc(alias = "GApplication")]
239    pub struct Application(Object<ffi::GApplication, ffi::GApplicationClass>) @implements ActionGroup, ActionMap;
240
241    match fn {
242        type_ => || ffi::g_application_get_type(),
243    }
244}
245
246impl Application {
247    pub const NONE: Option<&'static Application> = None;
248
249    /// Creates a new #GApplication instance.
250    ///
251    /// If non-[`None`], the application id must be valid.  See
252    /// g_application_id_is_valid().
253    ///
254    /// If no application ID is given then some features of #GApplication
255    /// (most notably application uniqueness) will be disabled.
256    /// ## `application_id`
257    /// the application id
258    /// ## `flags`
259    /// the application flags
260    ///
261    /// # Returns
262    ///
263    /// a new #GApplication instance
264    #[doc(alias = "g_application_new")]
265    pub fn new(application_id: Option<&str>, flags: ApplicationFlags) -> Application {
266        unsafe {
267            from_glib_full(ffi::g_application_new(
268                application_id.to_glib_none().0,
269                flags.into_glib(),
270            ))
271        }
272    }
273
274    // rustdoc-stripper-ignore-next
275    /// Creates a new builder-pattern struct instance to construct [`Application`] objects.
276    ///
277    /// This method returns an instance of [`ApplicationBuilder`](crate::builders::ApplicationBuilder) which can be used to create [`Application`] objects.
278    pub fn builder() -> ApplicationBuilder {
279        ApplicationBuilder::new()
280    }
281
282    /// Returns the default #GApplication instance for this process.
283    ///
284    /// Normally there is only one #GApplication per process and it becomes
285    /// the default when it is created.  You can exercise more control over
286    /// this by using g_application_set_default().
287    ///
288    /// If there is no default application then [`None`] is returned.
289    ///
290    /// # Returns
291    ///
292    /// the default application for this process, or [`None`]
293    #[doc(alias = "g_application_get_default")]
294    #[doc(alias = "get_default")]
295    #[allow(clippy::should_implement_trait)]
296    pub fn default() -> Option<Application> {
297        unsafe { from_glib_none(ffi::g_application_get_default()) }
298    }
299
300    /// Checks if @application_id is a valid application identifier.
301    ///
302    /// A valid ID is required for calls to g_application_new() and
303    /// g_application_set_application_id().
304    ///
305    /// Application identifiers follow the same format as
306    /// [D-Bus well-known bus names](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus).
307    /// For convenience, the restrictions on application identifiers are
308    /// reproduced here:
309    ///
310    /// - Application identifiers are composed of 1 or more elements separated by a
311    ///   period (`.`) character. All elements must contain at least one character.
312    ///
313    /// - Each element must only contain the ASCII characters `[A-Z][a-z][0-9]_-`,
314    ///   with `-` discouraged in new application identifiers. Each element must not
315    ///   begin with a digit.
316    ///
317    /// - Application identifiers must contain at least one `.` (period) character
318    ///   (and thus at least two elements).
319    ///
320    /// - Application identifiers must not begin with a `.` (period) character.
321    ///
322    /// - Application identifiers must not exceed 255 characters.
323    ///
324    /// Note that the hyphen (`-`) character is allowed in application identifiers,
325    /// but is problematic or not allowed in various specifications and APIs that
326    /// refer to D-Bus, such as
327    /// [Flatpak application IDs](http://docs.flatpak.org/en/latest/introduction.html#identifiers),
328    /// the
329    /// [`DBusActivatable` interface in the Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus),
330    /// and the convention that an application's "main" interface and object path
331    /// resemble its application identifier and bus name. To avoid situations that
332    /// require special-case handling, it is recommended that new application
333    /// identifiers consistently replace hyphens with underscores.
334    ///
335    /// Like D-Bus interface names, application identifiers should start with the
336    /// reversed DNS domain name of the author of the interface (in lower-case), and
337    /// it is conventional for the rest of the application identifier to consist of
338    /// words run together, with initial capital letters.
339    ///
340    /// As with D-Bus interface names, if the author's DNS domain name contains
341    /// hyphen/minus characters they should be replaced by underscores, and if it
342    /// contains leading digits they should be escaped by prepending an underscore.
343    /// For example, if the owner of 7-zip.org used an application identifier for an
344    /// archiving application, it might be named `org._7_zip.Archiver`.
345    /// ## `application_id`
346    /// a potential application identifier
347    ///
348    /// # Returns
349    ///
350    /// [`true`] if @application_id is valid
351    #[doc(alias = "g_application_id_is_valid")]
352    pub fn id_is_valid(application_id: &str) -> bool {
353        unsafe {
354            from_glib(ffi::g_application_id_is_valid(
355                application_id.to_glib_none().0,
356            ))
357        }
358    }
359}
360
361impl Default for Application {
362    fn default() -> Self {
363        glib::object::Object::new::<Self>()
364    }
365}
366
367// rustdoc-stripper-ignore-next
368/// A [builder-pattern] type to construct [`Application`] objects.
369///
370/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
371#[must_use = "The builder must be built to be used"]
372pub struct ApplicationBuilder {
373    builder: glib::object::ObjectBuilder<'static, Application>,
374}
375
376impl ApplicationBuilder {
377    fn new() -> Self {
378        Self {
379            builder: glib::object::Object::builder(),
380        }
381    }
382
383    /// The unique identifier for the application.
384    pub fn application_id(self, application_id: impl Into<glib::GString>) -> Self {
385        Self {
386            builder: self
387                .builder
388                .property("application-id", application_id.into()),
389        }
390    }
391
392    /// Flags specifying the behaviour of the application.
393    pub fn flags(self, flags: ApplicationFlags) -> Self {
394        Self {
395            builder: self.builder.property("flags", flags),
396        }
397    }
398
399    /// Time (in milliseconds) to stay alive after becoming idle.
400    pub fn inactivity_timeout(self, inactivity_timeout: u32) -> Self {
401        Self {
402            builder: self
403                .builder
404                .property("inactivity-timeout", inactivity_timeout),
405        }
406    }
407
408    /// The base resource path for the application.
409    pub fn resource_base_path(self, resource_base_path: impl Into<glib::GString>) -> Self {
410        Self {
411            builder: self
412                .builder
413                .property("resource-base-path", resource_base_path.into()),
414        }
415    }
416
417    /// The human-readable version number of the application.
418    #[cfg(feature = "v2_80")]
419    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
420    pub fn version(self, version: impl Into<glib::GString>) -> Self {
421        Self {
422            builder: self.builder.property("version", version.into()),
423        }
424    }
425
426    // rustdoc-stripper-ignore-next
427    /// Build the [`Application`].
428    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
429    pub fn build(self) -> Application {
430        self.builder.build()
431    }
432}
433
434/// Trait containing all [`struct@Application`] methods.
435///
436/// # Implementors
437///
438/// [`Application`][struct@crate::Application]
439pub trait ApplicationExt: IsA<Application> + 'static {
440    /// Activates the application.
441    ///
442    /// In essence, this results in the #GApplication::activate signal being
443    /// emitted in the primary instance.
444    ///
445    /// The application must be registered before calling this function.
446    #[doc(alias = "g_application_activate")]
447    fn activate(&self) {
448        unsafe {
449            ffi::g_application_activate(self.as_ref().to_glib_none().0);
450        }
451    }
452
453    /// Add an option to be handled by @self.
454    ///
455    /// Calling this function is the equivalent of calling
456    /// g_application_add_main_option_entries() with a single #GOptionEntry
457    /// that has its arg_data member set to [`None`].
458    ///
459    /// The parsed arguments will be packed into a #GVariantDict which
460    /// is passed to #GApplication::handle-local-options. If
461    /// [`ApplicationFlags::HANDLES_COMMAND_LINE`][crate::ApplicationFlags::HANDLES_COMMAND_LINE] is set, then it will also
462    /// be sent to the primary instance. See
463    /// g_application_add_main_option_entries() for more details.
464    ///
465    /// See #GOptionEntry for more documentation of the arguments.
466    /// ## `long_name`
467    /// the long name of an option used to specify it in a commandline
468    /// ## `short_name`
469    /// the short name of an option
470    /// ## `flags`
471    /// flags from #GOptionFlags
472    /// ## `arg`
473    /// the type of the option, as a #GOptionArg
474    /// ## `description`
475    /// the description for the option in `--help` output
476    /// ## `arg_description`
477    /// the placeholder to use for the extra argument
478    ///    parsed by the option in `--help` output
479    #[doc(alias = "g_application_add_main_option")]
480    fn add_main_option(
481        &self,
482        long_name: &str,
483        short_name: glib::Char,
484        flags: glib::OptionFlags,
485        arg: glib::OptionArg,
486        description: &str,
487        arg_description: Option<&str>,
488    ) {
489        unsafe {
490            ffi::g_application_add_main_option(
491                self.as_ref().to_glib_none().0,
492                long_name.to_glib_none().0,
493                short_name.into_glib(),
494                flags.into_glib(),
495                arg.into_glib(),
496                description.to_glib_none().0,
497                arg_description.to_glib_none().0,
498            );
499        }
500    }
501
502    //#[doc(alias = "g_application_add_main_option_entries")]
503    //fn add_main_option_entries(&self, entries: /*Ignored*/&[glib::OptionEntry]) {
504    //    unsafe { TODO: call ffi:g_application_add_main_option_entries() }
505    //}
506
507    //#[doc(alias = "g_application_add_option_group")]
508    //fn add_option_group(&self, group: /*Ignored*/glib::OptionGroup) {
509    //    unsafe { TODO: call ffi:g_application_add_option_group() }
510    //}
511
512    /// Marks @self as busy (see g_application_mark_busy()) while
513    /// @property on @object is [`true`].
514    ///
515    /// The binding holds a reference to @self while it is active, but
516    /// not to @object. Instead, the binding is destroyed when @object is
517    /// finalized.
518    /// ## `object`
519    /// a #GObject
520    /// ## `property`
521    /// the name of a boolean property of @object
522    #[doc(alias = "g_application_bind_busy_property")]
523    fn bind_busy_property(&self, object: &impl IsA<glib::Object>, property: &str) {
524        unsafe {
525            ffi::g_application_bind_busy_property(
526                self.as_ref().to_glib_none().0,
527                object.as_ref().to_glib_none().0,
528                property.to_glib_none().0,
529            );
530        }
531    }
532
533    /// Gets the unique identifier for @self.
534    ///
535    /// # Returns
536    ///
537    /// the identifier for @self, owned by @self
538    #[doc(alias = "g_application_get_application_id")]
539    #[doc(alias = "get_application_id")]
540    #[doc(alias = "application-id")]
541    fn application_id(&self) -> Option<glib::GString> {
542        unsafe {
543            from_glib_none(ffi::g_application_get_application_id(
544                self.as_ref().to_glib_none().0,
545            ))
546        }
547    }
548
549    /// Gets the #GDBusConnection being used by the application, or [`None`].
550    ///
551    /// If #GApplication is using its D-Bus backend then this function will
552    /// return the #GDBusConnection being used for uniqueness and
553    /// communication with the desktop environment and other instances of the
554    /// application.
555    ///
556    /// If #GApplication is not using D-Bus then this function will return
557    /// [`None`].  This includes the situation where the D-Bus backend would
558    /// normally be in use but we were unable to connect to the bus.
559    ///
560    /// This function must not be called before the application has been
561    /// registered.  See g_application_get_is_registered().
562    ///
563    /// # Returns
564    ///
565    /// a #GDBusConnection, or [`None`]
566    #[doc(alias = "g_application_get_dbus_connection")]
567    #[doc(alias = "get_dbus_connection")]
568    fn dbus_connection(&self) -> Option<DBusConnection> {
569        unsafe {
570            from_glib_none(ffi::g_application_get_dbus_connection(
571                self.as_ref().to_glib_none().0,
572            ))
573        }
574    }
575
576    /// Gets the D-Bus object path being used by the application, or [`None`].
577    ///
578    /// If #GApplication is using its D-Bus backend then this function will
579    /// return the D-Bus object path that #GApplication is using.  If the
580    /// application is the primary instance then there is an object published
581    /// at this path.  If the application is not the primary instance then
582    /// the result of this function is undefined.
583    ///
584    /// If #GApplication is not using D-Bus then this function will return
585    /// [`None`].  This includes the situation where the D-Bus backend would
586    /// normally be in use but we were unable to connect to the bus.
587    ///
588    /// This function must not be called before the application has been
589    /// registered.  See g_application_get_is_registered().
590    ///
591    /// # Returns
592    ///
593    /// the object path, or [`None`]
594    #[doc(alias = "g_application_get_dbus_object_path")]
595    #[doc(alias = "get_dbus_object_path")]
596    fn dbus_object_path(&self) -> Option<glib::GString> {
597        unsafe {
598            from_glib_none(ffi::g_application_get_dbus_object_path(
599                self.as_ref().to_glib_none().0,
600            ))
601        }
602    }
603
604    /// Gets the flags for @self.
605    ///
606    /// See #GApplicationFlags.
607    ///
608    /// # Returns
609    ///
610    /// the flags for @self
611    #[doc(alias = "g_application_get_flags")]
612    #[doc(alias = "get_flags")]
613    fn flags(&self) -> ApplicationFlags {
614        unsafe { from_glib(ffi::g_application_get_flags(self.as_ref().to_glib_none().0)) }
615    }
616
617    /// Gets the current inactivity timeout for the application.
618    ///
619    /// This is the amount of time (in milliseconds) after the last call to
620    /// g_application_release() before the application stops running.
621    ///
622    /// # Returns
623    ///
624    /// the timeout, in milliseconds
625    #[doc(alias = "g_application_get_inactivity_timeout")]
626    #[doc(alias = "get_inactivity_timeout")]
627    #[doc(alias = "inactivity-timeout")]
628    fn inactivity_timeout(&self) -> u32 {
629        unsafe { ffi::g_application_get_inactivity_timeout(self.as_ref().to_glib_none().0) }
630    }
631
632    /// Gets the application's current busy state, as set through
633    /// g_application_mark_busy() or g_application_bind_busy_property().
634    ///
635    /// # Returns
636    ///
637    /// [`true`] if @self is currently marked as busy
638    #[doc(alias = "g_application_get_is_busy")]
639    #[doc(alias = "get_is_busy")]
640    #[doc(alias = "is-busy")]
641    fn is_busy(&self) -> bool {
642        unsafe {
643            from_glib(ffi::g_application_get_is_busy(
644                self.as_ref().to_glib_none().0,
645            ))
646        }
647    }
648
649    /// Checks if @self is registered.
650    ///
651    /// An application is registered if g_application_register() has been
652    /// successfully called.
653    ///
654    /// # Returns
655    ///
656    /// [`true`] if @self is registered
657    #[doc(alias = "g_application_get_is_registered")]
658    #[doc(alias = "get_is_registered")]
659    #[doc(alias = "is-registered")]
660    fn is_registered(&self) -> bool {
661        unsafe {
662            from_glib(ffi::g_application_get_is_registered(
663                self.as_ref().to_glib_none().0,
664            ))
665        }
666    }
667
668    /// Checks if @self is remote.
669    ///
670    /// If @self is remote then it means that another instance of
671    /// application already exists (the 'primary' instance).  Calls to
672    /// perform actions on @self will result in the actions being
673    /// performed by the primary instance.
674    ///
675    /// The value of this property cannot be accessed before
676    /// g_application_register() has been called.  See
677    /// g_application_get_is_registered().
678    ///
679    /// # Returns
680    ///
681    /// [`true`] if @self is remote
682    #[doc(alias = "g_application_get_is_remote")]
683    #[doc(alias = "get_is_remote")]
684    #[doc(alias = "is-remote")]
685    fn is_remote(&self) -> bool {
686        unsafe {
687            from_glib(ffi::g_application_get_is_remote(
688                self.as_ref().to_glib_none().0,
689            ))
690        }
691    }
692
693    /// Gets the resource base path of @self.
694    ///
695    /// See g_application_set_resource_base_path() for more information.
696    ///
697    /// # Returns
698    ///
699    /// the base resource path, if one is set
700    #[doc(alias = "g_application_get_resource_base_path")]
701    #[doc(alias = "get_resource_base_path")]
702    #[doc(alias = "resource-base-path")]
703    fn resource_base_path(&self) -> Option<glib::GString> {
704        unsafe {
705            from_glib_none(ffi::g_application_get_resource_base_path(
706                self.as_ref().to_glib_none().0,
707            ))
708        }
709    }
710
711    /// Gets the version of @self.
712    ///
713    /// # Returns
714    ///
715    /// the version of @self
716    #[cfg(feature = "v2_80")]
717    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
718    #[doc(alias = "g_application_get_version")]
719    #[doc(alias = "get_version")]
720    fn version(&self) -> Option<glib::GString> {
721        unsafe {
722            from_glib_none(ffi::g_application_get_version(
723                self.as_ref().to_glib_none().0,
724            ))
725        }
726    }
727
728    /// Opens the given files.
729    ///
730    /// In essence, this results in the #GApplication::open signal being emitted
731    /// in the primary instance.
732    ///
733    /// @n_files must be greater than zero.
734    ///
735    /// @hint is simply passed through to the ::open signal.  It is
736    /// intended to be used by applications that have multiple modes for
737    /// opening files (eg: "view" vs "edit", etc).  Unless you have a need
738    /// for this functionality, you should use "".
739    ///
740    /// The application must be registered before calling this function
741    /// and it must have the [`ApplicationFlags::HANDLES_OPEN`][crate::ApplicationFlags::HANDLES_OPEN] flag set.
742    /// ## `files`
743    /// an array of #GFiles to open
744    /// ## `hint`
745    /// a hint (or ""), but never [`None`]
746    #[doc(alias = "g_application_open")]
747    fn open(&self, files: &[File], hint: &str) {
748        let n_files = files.len() as _;
749        unsafe {
750            ffi::g_application_open(
751                self.as_ref().to_glib_none().0,
752                files.to_glib_none().0,
753                n_files,
754                hint.to_glib_none().0,
755            );
756        }
757    }
758
759    /// Immediately quits the application.
760    ///
761    /// Upon return to the mainloop, g_application_run() will return,
762    /// calling only the 'shutdown' function before doing so.
763    ///
764    /// The hold count is ignored.
765    /// Take care if your code has called g_application_hold() on the application and
766    /// is therefore still expecting it to exist.
767    /// (Note that you may have called g_application_hold() indirectly, for example
768    /// through gtk_application_add_window().)
769    ///
770    /// The result of calling g_application_run() again after it returns is
771    /// unspecified.
772    #[doc(alias = "g_application_quit")]
773    fn quit(&self) {
774        unsafe {
775            ffi::g_application_quit(self.as_ref().to_glib_none().0);
776        }
777    }
778
779    /// Attempts registration of the application.
780    ///
781    /// This is the point at which the application discovers if it is the
782    /// primary instance or merely acting as a remote for an already-existing
783    /// primary instance.  This is implemented by attempting to acquire the
784    /// application identifier as a unique bus name on the session bus using
785    /// GDBus.
786    ///
787    /// If there is no application ID or if [`ApplicationFlags::NON_UNIQUE`][crate::ApplicationFlags::NON_UNIQUE] was
788    /// given, then this process will always become the primary instance.
789    ///
790    /// Due to the internal architecture of GDBus, method calls can be
791    /// dispatched at any time (even if a main loop is not running).  For
792    /// this reason, you must ensure that any object paths that you wish to
793    /// register are registered before calling this function.
794    ///
795    /// If the application has already been registered then [`true`] is
796    /// returned with no work performed.
797    ///
798    /// The #GApplication::startup signal is emitted if registration succeeds
799    /// and @self is the primary instance (including the non-unique
800    /// case).
801    ///
802    /// In the event of an error (such as @cancellable being cancelled, or a
803    /// failure to connect to the session bus), [`false`] is returned and @error
804    /// is set appropriately.
805    ///
806    /// Note: the return value of this function is not an indicator that this
807    /// instance is or is not the primary instance of the application.  See
808    /// g_application_get_is_remote() for that.
809    /// ## `cancellable`
810    /// a #GCancellable, or [`None`]
811    ///
812    /// # Returns
813    ///
814    /// [`true`] if registration succeeded
815    #[doc(alias = "g_application_register")]
816    fn register(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), glib::Error> {
817        unsafe {
818            let mut error = std::ptr::null_mut();
819            let is_ok = ffi::g_application_register(
820                self.as_ref().to_glib_none().0,
821                cancellable.map(|p| p.as_ref()).to_glib_none().0,
822                &mut error,
823            );
824            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
825            if error.is_null() {
826                Ok(())
827            } else {
828                Err(from_glib_full(error))
829            }
830        }
831    }
832
833    /// Sends a notification on behalf of @self to the desktop shell.
834    /// There is no guarantee that the notification is displayed immediately,
835    /// or even at all.
836    ///
837    /// Notifications may persist after the application exits. It will be
838    /// D-Bus-activated when the notification or one of its actions is
839    /// activated.
840    ///
841    /// Modifying @notification after this call has no effect. However, the
842    /// object can be reused for a later call to this function.
843    ///
844    /// @id may be any string that uniquely identifies the event for the
845    /// application. It does not need to be in any special format. For
846    /// example, "new-message" might be appropriate for a notification about
847    /// new messages.
848    ///
849    /// If a previous notification was sent with the same @id, it will be
850    /// replaced with @notification and shown again as if it was a new
851    /// notification. This works even for notifications sent from a previous
852    /// execution of the application, as long as @id is the same string.
853    ///
854    /// @id may be `NULL`, but it is impossible to replace or withdraw
855    /// notifications without an id.
856    ///
857    /// If @notification is no longer relevant, it can be withdrawn with
858    /// [`withdraw_notification()`][Self::withdraw_notification()].
859    ///
860    /// It is an error to call this function if @self has no
861    /// application ID.
862    /// ## `id`
863    /// id of the notification, or [`None`]
864    /// ## `notification`
865    /// the #GNotification to send
866    #[doc(alias = "g_application_send_notification")]
867    fn send_notification(&self, id: Option<&str>, notification: &Notification) {
868        unsafe {
869            ffi::g_application_send_notification(
870                self.as_ref().to_glib_none().0,
871                id.to_glib_none().0,
872                notification.to_glib_none().0,
873            );
874        }
875    }
876
877    /// Sets the unique identifier for @self.
878    ///
879    /// The application id can only be modified if @self has not yet
880    /// been registered.
881    ///
882    /// If non-[`None`], the application id must be valid.  See
883    /// g_application_id_is_valid().
884    /// ## `application_id`
885    /// the identifier for @self
886    #[doc(alias = "g_application_set_application_id")]
887    #[doc(alias = "application-id")]
888    fn set_application_id(&self, application_id: Option<&str>) {
889        unsafe {
890            ffi::g_application_set_application_id(
891                self.as_ref().to_glib_none().0,
892                application_id.to_glib_none().0,
893            );
894        }
895    }
896
897    /// Sets or unsets the default application for the process, as returned
898    /// by g_application_get_default().
899    ///
900    /// This function does not take its own reference on @self.  If
901    /// @self is destroyed then the default application will revert
902    /// back to [`None`].
903    #[doc(alias = "g_application_set_default")]
904    fn set_default(&self) {
905        unsafe {
906            ffi::g_application_set_default(self.as_ref().to_glib_none().0);
907        }
908    }
909
910    /// Sets the flags for @self.
911    ///
912    /// The flags can only be modified if @self has not yet been
913    /// registered.
914    ///
915    /// See #GApplicationFlags.
916    /// ## `flags`
917    /// the flags for @self
918    #[doc(alias = "g_application_set_flags")]
919    #[doc(alias = "flags")]
920    fn set_flags(&self, flags: ApplicationFlags) {
921        unsafe {
922            ffi::g_application_set_flags(self.as_ref().to_glib_none().0, flags.into_glib());
923        }
924    }
925
926    /// Sets the current inactivity timeout for the application.
927    ///
928    /// This is the amount of time (in milliseconds) after the last call to
929    /// g_application_release() before the application stops running.
930    ///
931    /// This call has no side effects of its own.  The value set here is only
932    /// used for next time g_application_release() drops the use count to
933    /// zero.  Any timeouts currently in progress are not impacted.
934    /// ## `inactivity_timeout`
935    /// the timeout, in milliseconds
936    #[doc(alias = "g_application_set_inactivity_timeout")]
937    #[doc(alias = "inactivity-timeout")]
938    fn set_inactivity_timeout(&self, inactivity_timeout: u32) {
939        unsafe {
940            ffi::g_application_set_inactivity_timeout(
941                self.as_ref().to_glib_none().0,
942                inactivity_timeout,
943            );
944        }
945    }
946
947    /// Adds a description to the @self option context.
948    ///
949    /// See g_option_context_set_description() for more information.
950    /// ## `description`
951    /// a string to be shown in `--help` output
952    ///  after the list of options, or [`None`]
953    #[doc(alias = "g_application_set_option_context_description")]
954    fn set_option_context_description(&self, description: Option<&str>) {
955        unsafe {
956            ffi::g_application_set_option_context_description(
957                self.as_ref().to_glib_none().0,
958                description.to_glib_none().0,
959            );
960        }
961    }
962
963    /// Sets the parameter string to be used by the commandline handling of @self.
964    ///
965    /// This function registers the argument to be passed to g_option_context_new()
966    /// when the internal #GOptionContext of @self is created.
967    ///
968    /// See g_option_context_new() for more information about @parameter_string.
969    /// ## `parameter_string`
970    /// a string which is displayed
971    ///   in the first line of `--help` output, after the usage summary `programname [OPTION...]`.
972    #[doc(alias = "g_application_set_option_context_parameter_string")]
973    fn set_option_context_parameter_string(&self, parameter_string: Option<&str>) {
974        unsafe {
975            ffi::g_application_set_option_context_parameter_string(
976                self.as_ref().to_glib_none().0,
977                parameter_string.to_glib_none().0,
978            );
979        }
980    }
981
982    /// Adds a summary to the @self option context.
983    ///
984    /// See g_option_context_set_summary() for more information.
985    /// ## `summary`
986    /// a string to be shown in `--help` output
987    ///  before the list of options, or [`None`]
988    #[doc(alias = "g_application_set_option_context_summary")]
989    fn set_option_context_summary(&self, summary: Option<&str>) {
990        unsafe {
991            ffi::g_application_set_option_context_summary(
992                self.as_ref().to_glib_none().0,
993                summary.to_glib_none().0,
994            );
995        }
996    }
997
998    /// Sets (or unsets) the base resource path of @self.
999    ///
1000    /// The path is used to automatically load various
1001    /// [application resources][`Resource`][crate::Resource] such as menu layouts and
1002    /// action descriptions. The various types of resources will be found at
1003    /// fixed names relative to the given base path.
1004    ///
1005    /// By default, the resource base path is determined from the application
1006    /// ID by prefixing '/' and replacing each '.' with '/'.  This is done at
1007    /// the time that the #GApplication object is constructed.  Changes to
1008    /// the application ID after that point will not have an impact on the
1009    /// resource base path.
1010    ///
1011    /// As an example, if the application has an ID of "org.example.app" then
1012    /// the default resource base path will be "/org/example/app".  If this
1013    /// is a #GtkApplication (and you have not manually changed the path)
1014    /// then Gtk will then search for the menus of the application at
1015    /// "/org/example/app/gtk/menus.ui".
1016    ///
1017    /// See #GResource for more information about adding resources to your
1018    /// application.
1019    ///
1020    /// You can disable automatic resource loading functionality by setting
1021    /// the path to [`None`].
1022    ///
1023    /// Changing the resource base path once the application is running is
1024    /// not recommended.  The point at which the resource path is consulted
1025    /// for forming paths for various purposes is unspecified.  When writing
1026    /// a sub-class of #GApplication you should either set the
1027    /// #GApplication:resource-base-path property at construction time, or call
1028    /// this function during the instance initialization. Alternatively, you
1029    /// can call this function in the #GApplicationClass.startup virtual function,
1030    /// before chaining up to the parent implementation.
1031    /// ## `resource_path`
1032    /// the resource path to use
1033    #[doc(alias = "g_application_set_resource_base_path")]
1034    #[doc(alias = "resource-base-path")]
1035    fn set_resource_base_path(&self, resource_path: Option<&str>) {
1036        unsafe {
1037            ffi::g_application_set_resource_base_path(
1038                self.as_ref().to_glib_none().0,
1039                resource_path.to_glib_none().0,
1040            );
1041        }
1042    }
1043
1044    /// Sets the version number of @self. This will be used to implement
1045    /// a `--version` command line argument
1046    ///
1047    /// The application version can only be modified if @self has not yet
1048    /// been registered.
1049    /// ## `version`
1050    /// the version of @self
1051    #[cfg(feature = "v2_80")]
1052    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
1053    #[doc(alias = "g_application_set_version")]
1054    #[doc(alias = "version")]
1055    fn set_version(&self, version: &str) {
1056        unsafe {
1057            ffi::g_application_set_version(
1058                self.as_ref().to_glib_none().0,
1059                version.to_glib_none().0,
1060            );
1061        }
1062    }
1063
1064    /// Destroys a binding between @property and the busy state of
1065    /// @self that was previously created with
1066    /// g_application_bind_busy_property().
1067    /// ## `object`
1068    /// a #GObject
1069    /// ## `property`
1070    /// the name of a boolean property of @object
1071    #[doc(alias = "g_application_unbind_busy_property")]
1072    fn unbind_busy_property(&self, object: &impl IsA<glib::Object>, property: &str) {
1073        unsafe {
1074            ffi::g_application_unbind_busy_property(
1075                self.as_ref().to_glib_none().0,
1076                object.as_ref().to_glib_none().0,
1077                property.to_glib_none().0,
1078            );
1079        }
1080    }
1081
1082    /// Withdraws a notification that was sent with
1083    /// g_application_send_notification().
1084    ///
1085    /// This call does nothing if a notification with @id doesn't exist or
1086    /// the notification was never sent.
1087    ///
1088    /// This function works even for notifications sent in previous
1089    /// executions of this application, as long @id is the same as it was for
1090    /// the sent notification.
1091    ///
1092    /// Note that notifications are dismissed when the user clicks on one
1093    /// of the buttons in a notification or triggers its default action, so
1094    /// there is no need to explicitly withdraw the notification in that case.
1095    /// ## `id`
1096    /// id of a previously sent notification
1097    #[doc(alias = "g_application_withdraw_notification")]
1098    fn withdraw_notification(&self, id: &str) {
1099        unsafe {
1100            ffi::g_application_withdraw_notification(
1101                self.as_ref().to_glib_none().0,
1102                id.to_glib_none().0,
1103            );
1104        }
1105    }
1106
1107    /// The ::activate signal is emitted on the primary instance when an
1108    /// activation occurs. See g_application_activate().
1109    #[doc(alias = "activate")]
1110    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1111        unsafe extern "C" fn activate_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
1112            this: *mut ffi::GApplication,
1113            f: glib::ffi::gpointer,
1114        ) {
1115            unsafe {
1116                let f: &F = &*(f as *const F);
1117                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1118            }
1119        }
1120        unsafe {
1121            let f: Box_<F> = Box_::new(f);
1122            connect_raw(
1123                self.as_ptr() as *mut _,
1124                c"activate".as_ptr(),
1125                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1126                    activate_trampoline::<Self, F> as *const (),
1127                )),
1128                Box_::into_raw(f),
1129            )
1130        }
1131    }
1132
1133    /// The ::name-lost signal is emitted only on the registered primary instance
1134    /// when a new instance has taken over. This can only happen if the application
1135    /// is using the [`ApplicationFlags::ALLOW_REPLACEMENT`][crate::ApplicationFlags::ALLOW_REPLACEMENT] flag.
1136    ///
1137    /// The default handler for this signal calls g_application_quit().
1138    ///
1139    /// # Returns
1140    ///
1141    /// [`true`] if the signal has been handled
1142    #[cfg(feature = "v2_60")]
1143    #[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
1144    #[doc(alias = "name-lost")]
1145    fn connect_name_lost<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
1146        unsafe extern "C" fn name_lost_trampoline<
1147            P: IsA<Application>,
1148            F: Fn(&P) -> bool + 'static,
1149        >(
1150            this: *mut ffi::GApplication,
1151            f: glib::ffi::gpointer,
1152        ) -> glib::ffi::gboolean {
1153            unsafe {
1154                let f: &F = &*(f as *const F);
1155                f(Application::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
1156            }
1157        }
1158        unsafe {
1159            let f: Box_<F> = Box_::new(f);
1160            connect_raw(
1161                self.as_ptr() as *mut _,
1162                c"name-lost".as_ptr(),
1163                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1164                    name_lost_trampoline::<Self, F> as *const (),
1165                )),
1166                Box_::into_raw(f),
1167            )
1168        }
1169    }
1170
1171    /// The ::shutdown signal is emitted only on the registered primary instance
1172    /// immediately after the main loop terminates.
1173    #[doc(alias = "shutdown")]
1174    fn connect_shutdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1175        unsafe extern "C" fn shutdown_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
1176            this: *mut ffi::GApplication,
1177            f: glib::ffi::gpointer,
1178        ) {
1179            unsafe {
1180                let f: &F = &*(f as *const F);
1181                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1182            }
1183        }
1184        unsafe {
1185            let f: Box_<F> = Box_::new(f);
1186            connect_raw(
1187                self.as_ptr() as *mut _,
1188                c"shutdown".as_ptr(),
1189                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1190                    shutdown_trampoline::<Self, F> as *const (),
1191                )),
1192                Box_::into_raw(f),
1193            )
1194        }
1195    }
1196
1197    /// The ::startup signal is emitted on the primary instance immediately
1198    /// after registration. See g_application_register().
1199    #[doc(alias = "startup")]
1200    fn connect_startup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1201        unsafe extern "C" fn startup_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
1202            this: *mut ffi::GApplication,
1203            f: glib::ffi::gpointer,
1204        ) {
1205            unsafe {
1206                let f: &F = &*(f as *const F);
1207                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1208            }
1209        }
1210        unsafe {
1211            let f: Box_<F> = Box_::new(f);
1212            connect_raw(
1213                self.as_ptr() as *mut _,
1214                c"startup".as_ptr(),
1215                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1216                    startup_trampoline::<Self, F> as *const (),
1217                )),
1218                Box_::into_raw(f),
1219            )
1220        }
1221    }
1222
1223    #[doc(alias = "application-id")]
1224    fn connect_application_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1225        unsafe extern "C" fn notify_application_id_trampoline<
1226            P: IsA<Application>,
1227            F: Fn(&P) + 'static,
1228        >(
1229            this: *mut ffi::GApplication,
1230            _param_spec: glib::ffi::gpointer,
1231            f: glib::ffi::gpointer,
1232        ) {
1233            unsafe {
1234                let f: &F = &*(f as *const F);
1235                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1236            }
1237        }
1238        unsafe {
1239            let f: Box_<F> = Box_::new(f);
1240            connect_raw(
1241                self.as_ptr() as *mut _,
1242                c"notify::application-id".as_ptr(),
1243                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1244                    notify_application_id_trampoline::<Self, F> as *const (),
1245                )),
1246                Box_::into_raw(f),
1247            )
1248        }
1249    }
1250
1251    #[doc(alias = "flags")]
1252    fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1253        unsafe extern "C" fn notify_flags_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
1254            this: *mut ffi::GApplication,
1255            _param_spec: glib::ffi::gpointer,
1256            f: glib::ffi::gpointer,
1257        ) {
1258            unsafe {
1259                let f: &F = &*(f as *const F);
1260                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1261            }
1262        }
1263        unsafe {
1264            let f: Box_<F> = Box_::new(f);
1265            connect_raw(
1266                self.as_ptr() as *mut _,
1267                c"notify::flags".as_ptr(),
1268                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1269                    notify_flags_trampoline::<Self, F> as *const (),
1270                )),
1271                Box_::into_raw(f),
1272            )
1273        }
1274    }
1275
1276    #[doc(alias = "inactivity-timeout")]
1277    fn connect_inactivity_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1278        unsafe extern "C" fn notify_inactivity_timeout_trampoline<
1279            P: IsA<Application>,
1280            F: Fn(&P) + 'static,
1281        >(
1282            this: *mut ffi::GApplication,
1283            _param_spec: glib::ffi::gpointer,
1284            f: glib::ffi::gpointer,
1285        ) {
1286            unsafe {
1287                let f: &F = &*(f as *const F);
1288                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1289            }
1290        }
1291        unsafe {
1292            let f: Box_<F> = Box_::new(f);
1293            connect_raw(
1294                self.as_ptr() as *mut _,
1295                c"notify::inactivity-timeout".as_ptr(),
1296                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1297                    notify_inactivity_timeout_trampoline::<Self, F> as *const (),
1298                )),
1299                Box_::into_raw(f),
1300            )
1301        }
1302    }
1303
1304    #[doc(alias = "is-busy")]
1305    fn connect_is_busy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1306        unsafe extern "C" fn notify_is_busy_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
1307            this: *mut ffi::GApplication,
1308            _param_spec: glib::ffi::gpointer,
1309            f: glib::ffi::gpointer,
1310        ) {
1311            unsafe {
1312                let f: &F = &*(f as *const F);
1313                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1314            }
1315        }
1316        unsafe {
1317            let f: Box_<F> = Box_::new(f);
1318            connect_raw(
1319                self.as_ptr() as *mut _,
1320                c"notify::is-busy".as_ptr(),
1321                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1322                    notify_is_busy_trampoline::<Self, F> as *const (),
1323                )),
1324                Box_::into_raw(f),
1325            )
1326        }
1327    }
1328
1329    #[doc(alias = "is-registered")]
1330    fn connect_is_registered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1331        unsafe extern "C" fn notify_is_registered_trampoline<
1332            P: IsA<Application>,
1333            F: Fn(&P) + 'static,
1334        >(
1335            this: *mut ffi::GApplication,
1336            _param_spec: glib::ffi::gpointer,
1337            f: glib::ffi::gpointer,
1338        ) {
1339            unsafe {
1340                let f: &F = &*(f as *const F);
1341                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1342            }
1343        }
1344        unsafe {
1345            let f: Box_<F> = Box_::new(f);
1346            connect_raw(
1347                self.as_ptr() as *mut _,
1348                c"notify::is-registered".as_ptr(),
1349                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1350                    notify_is_registered_trampoline::<Self, F> as *const (),
1351                )),
1352                Box_::into_raw(f),
1353            )
1354        }
1355    }
1356
1357    #[doc(alias = "is-remote")]
1358    fn connect_is_remote_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1359        unsafe extern "C" fn notify_is_remote_trampoline<
1360            P: IsA<Application>,
1361            F: Fn(&P) + 'static,
1362        >(
1363            this: *mut ffi::GApplication,
1364            _param_spec: glib::ffi::gpointer,
1365            f: glib::ffi::gpointer,
1366        ) {
1367            unsafe {
1368                let f: &F = &*(f as *const F);
1369                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1370            }
1371        }
1372        unsafe {
1373            let f: Box_<F> = Box_::new(f);
1374            connect_raw(
1375                self.as_ptr() as *mut _,
1376                c"notify::is-remote".as_ptr(),
1377                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1378                    notify_is_remote_trampoline::<Self, F> as *const (),
1379                )),
1380                Box_::into_raw(f),
1381            )
1382        }
1383    }
1384
1385    #[doc(alias = "resource-base-path")]
1386    fn connect_resource_base_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1387        unsafe extern "C" fn notify_resource_base_path_trampoline<
1388            P: IsA<Application>,
1389            F: Fn(&P) + 'static,
1390        >(
1391            this: *mut ffi::GApplication,
1392            _param_spec: glib::ffi::gpointer,
1393            f: glib::ffi::gpointer,
1394        ) {
1395            unsafe {
1396                let f: &F = &*(f as *const F);
1397                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1398            }
1399        }
1400        unsafe {
1401            let f: Box_<F> = Box_::new(f);
1402            connect_raw(
1403                self.as_ptr() as *mut _,
1404                c"notify::resource-base-path".as_ptr(),
1405                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1406                    notify_resource_base_path_trampoline::<Self, F> as *const (),
1407                )),
1408                Box_::into_raw(f),
1409            )
1410        }
1411    }
1412
1413    #[cfg(feature = "v2_80")]
1414    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
1415    #[doc(alias = "version")]
1416    fn connect_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1417        unsafe extern "C" fn notify_version_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
1418            this: *mut ffi::GApplication,
1419            _param_spec: glib::ffi::gpointer,
1420            f: glib::ffi::gpointer,
1421        ) {
1422            unsafe {
1423                let f: &F = &*(f as *const F);
1424                f(Application::from_glib_borrow(this).unsafe_cast_ref())
1425            }
1426        }
1427        unsafe {
1428            let f: Box_<F> = Box_::new(f);
1429            connect_raw(
1430                self.as_ptr() as *mut _,
1431                c"notify::version".as_ptr(),
1432                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1433                    notify_version_trampoline::<Self, F> as *const (),
1434                )),
1435                Box_::into_raw(f),
1436            )
1437        }
1438    }
1439}
1440
1441impl<O: IsA<Application>> ApplicationExt for O {}