1use crate::{
6 ffi, ActionGroup, ActionMap, ApplicationFlags, Cancellable, DBusConnection, File, Notification,
7};
8use glib::{
9 object::ObjectType as _,
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 #[doc(alias = "GApplication")]
18 pub struct Application(Object<ffi::GApplication, ffi::GApplicationClass>) @implements ActionGroup, ActionMap;
19
20 match fn {
21 type_ => || ffi::g_application_get_type(),
22 }
23}
24
25impl Application {
26 pub const NONE: Option<&'static Application> = None;
27
28 #[doc(alias = "g_application_new")]
29 pub fn new(application_id: Option<&str>, flags: ApplicationFlags) -> Application {
30 unsafe {
31 from_glib_full(ffi::g_application_new(
32 application_id.to_glib_none().0,
33 flags.into_glib(),
34 ))
35 }
36 }
37
38 pub fn builder() -> ApplicationBuilder {
43 ApplicationBuilder::new()
44 }
45
46 #[doc(alias = "g_application_get_default")]
47 #[doc(alias = "get_default")]
48 #[allow(clippy::should_implement_trait)]
49 pub fn default() -> Option<Application> {
50 unsafe { from_glib_none(ffi::g_application_get_default()) }
51 }
52
53 #[doc(alias = "g_application_id_is_valid")]
54 pub fn id_is_valid(application_id: &str) -> bool {
55 unsafe {
56 from_glib(ffi::g_application_id_is_valid(
57 application_id.to_glib_none().0,
58 ))
59 }
60 }
61}
62
63impl Default for Application {
64 fn default() -> Self {
65 glib::object::Object::new::<Self>()
66 }
67}
68
69#[must_use = "The builder must be built to be used"]
74pub struct ApplicationBuilder {
75 builder: glib::object::ObjectBuilder<'static, Application>,
76}
77
78impl ApplicationBuilder {
79 fn new() -> Self {
80 Self {
81 builder: glib::object::Object::builder(),
82 }
83 }
84
85 pub fn application_id(self, application_id: impl Into<glib::GString>) -> Self {
86 Self {
87 builder: self
88 .builder
89 .property("application-id", application_id.into()),
90 }
91 }
92
93 pub fn flags(self, flags: ApplicationFlags) -> Self {
94 Self {
95 builder: self.builder.property("flags", flags),
96 }
97 }
98
99 pub fn inactivity_timeout(self, inactivity_timeout: u32) -> Self {
100 Self {
101 builder: self
102 .builder
103 .property("inactivity-timeout", inactivity_timeout),
104 }
105 }
106
107 pub fn resource_base_path(self, resource_base_path: impl Into<glib::GString>) -> Self {
108 Self {
109 builder: self
110 .builder
111 .property("resource-base-path", resource_base_path.into()),
112 }
113 }
114
115 #[cfg(feature = "v2_80")]
116 #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
117 pub fn version(self, version: impl Into<glib::GString>) -> Self {
118 Self {
119 builder: self.builder.property("version", version.into()),
120 }
121 }
122
123 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
126 pub fn build(self) -> Application {
127 self.builder.build()
128 }
129}
130
131pub trait ApplicationExt: IsA<Application> + 'static {
132 #[doc(alias = "g_application_activate")]
133 fn activate(&self) {
134 unsafe {
135 ffi::g_application_activate(self.as_ref().to_glib_none().0);
136 }
137 }
138
139 #[doc(alias = "g_application_add_main_option")]
140 fn add_main_option(
141 &self,
142 long_name: &str,
143 short_name: glib::Char,
144 flags: glib::OptionFlags,
145 arg: glib::OptionArg,
146 description: &str,
147 arg_description: Option<&str>,
148 ) {
149 unsafe {
150 ffi::g_application_add_main_option(
151 self.as_ref().to_glib_none().0,
152 long_name.to_glib_none().0,
153 short_name.into_glib(),
154 flags.into_glib(),
155 arg.into_glib(),
156 description.to_glib_none().0,
157 arg_description.to_glib_none().0,
158 );
159 }
160 }
161
162 #[doc(alias = "g_application_bind_busy_property")]
173 fn bind_busy_property(&self, object: &impl IsA<glib::Object>, property: &str) {
174 unsafe {
175 ffi::g_application_bind_busy_property(
176 self.as_ref().to_glib_none().0,
177 object.as_ref().to_glib_none().0,
178 property.to_glib_none().0,
179 );
180 }
181 }
182
183 #[doc(alias = "g_application_get_application_id")]
184 #[doc(alias = "get_application_id")]
185 #[doc(alias = "application-id")]
186 fn application_id(&self) -> Option<glib::GString> {
187 unsafe {
188 from_glib_none(ffi::g_application_get_application_id(
189 self.as_ref().to_glib_none().0,
190 ))
191 }
192 }
193
194 #[doc(alias = "g_application_get_dbus_connection")]
195 #[doc(alias = "get_dbus_connection")]
196 fn dbus_connection(&self) -> Option<DBusConnection> {
197 unsafe {
198 from_glib_none(ffi::g_application_get_dbus_connection(
199 self.as_ref().to_glib_none().0,
200 ))
201 }
202 }
203
204 #[doc(alias = "g_application_get_dbus_object_path")]
205 #[doc(alias = "get_dbus_object_path")]
206 fn dbus_object_path(&self) -> Option<glib::GString> {
207 unsafe {
208 from_glib_none(ffi::g_application_get_dbus_object_path(
209 self.as_ref().to_glib_none().0,
210 ))
211 }
212 }
213
214 #[doc(alias = "g_application_get_flags")]
215 #[doc(alias = "get_flags")]
216 fn flags(&self) -> ApplicationFlags {
217 unsafe { from_glib(ffi::g_application_get_flags(self.as_ref().to_glib_none().0)) }
218 }
219
220 #[doc(alias = "g_application_get_inactivity_timeout")]
221 #[doc(alias = "get_inactivity_timeout")]
222 #[doc(alias = "inactivity-timeout")]
223 fn inactivity_timeout(&self) -> u32 {
224 unsafe { ffi::g_application_get_inactivity_timeout(self.as_ref().to_glib_none().0) }
225 }
226
227 #[doc(alias = "g_application_get_is_busy")]
228 #[doc(alias = "get_is_busy")]
229 #[doc(alias = "is-busy")]
230 fn is_busy(&self) -> bool {
231 unsafe {
232 from_glib(ffi::g_application_get_is_busy(
233 self.as_ref().to_glib_none().0,
234 ))
235 }
236 }
237
238 #[doc(alias = "g_application_get_is_registered")]
239 #[doc(alias = "get_is_registered")]
240 #[doc(alias = "is-registered")]
241 fn is_registered(&self) -> bool {
242 unsafe {
243 from_glib(ffi::g_application_get_is_registered(
244 self.as_ref().to_glib_none().0,
245 ))
246 }
247 }
248
249 #[doc(alias = "g_application_get_is_remote")]
250 #[doc(alias = "get_is_remote")]
251 #[doc(alias = "is-remote")]
252 fn is_remote(&self) -> bool {
253 unsafe {
254 from_glib(ffi::g_application_get_is_remote(
255 self.as_ref().to_glib_none().0,
256 ))
257 }
258 }
259
260 #[doc(alias = "g_application_get_resource_base_path")]
261 #[doc(alias = "get_resource_base_path")]
262 #[doc(alias = "resource-base-path")]
263 fn resource_base_path(&self) -> Option<glib::GString> {
264 unsafe {
265 from_glib_none(ffi::g_application_get_resource_base_path(
266 self.as_ref().to_glib_none().0,
267 ))
268 }
269 }
270
271 #[cfg(feature = "v2_80")]
272 #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
273 #[doc(alias = "g_application_get_version")]
274 #[doc(alias = "get_version")]
275 fn version(&self) -> Option<glib::GString> {
276 unsafe {
277 from_glib_none(ffi::g_application_get_version(
278 self.as_ref().to_glib_none().0,
279 ))
280 }
281 }
282
283 #[doc(alias = "g_application_open")]
284 fn open(&self, files: &[File], hint: &str) {
285 let n_files = files.len() as _;
286 unsafe {
287 ffi::g_application_open(
288 self.as_ref().to_glib_none().0,
289 files.to_glib_none().0,
290 n_files,
291 hint.to_glib_none().0,
292 );
293 }
294 }
295
296 #[doc(alias = "g_application_quit")]
297 fn quit(&self) {
298 unsafe {
299 ffi::g_application_quit(self.as_ref().to_glib_none().0);
300 }
301 }
302
303 #[doc(alias = "g_application_register")]
304 fn register(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), glib::Error> {
305 unsafe {
306 let mut error = std::ptr::null_mut();
307 let is_ok = ffi::g_application_register(
308 self.as_ref().to_glib_none().0,
309 cancellable.map(|p| p.as_ref()).to_glib_none().0,
310 &mut error,
311 );
312 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
313 if error.is_null() {
314 Ok(())
315 } else {
316 Err(from_glib_full(error))
317 }
318 }
319 }
320
321 #[doc(alias = "g_application_send_notification")]
322 fn send_notification(&self, id: Option<&str>, notification: &Notification) {
323 unsafe {
324 ffi::g_application_send_notification(
325 self.as_ref().to_glib_none().0,
326 id.to_glib_none().0,
327 notification.to_glib_none().0,
328 );
329 }
330 }
331
332 #[doc(alias = "g_application_set_application_id")]
333 #[doc(alias = "application-id")]
334 fn set_application_id(&self, application_id: Option<&str>) {
335 unsafe {
336 ffi::g_application_set_application_id(
337 self.as_ref().to_glib_none().0,
338 application_id.to_glib_none().0,
339 );
340 }
341 }
342
343 #[doc(alias = "g_application_set_default")]
344 fn set_default(&self) {
345 unsafe {
346 ffi::g_application_set_default(self.as_ref().to_glib_none().0);
347 }
348 }
349
350 #[doc(alias = "g_application_set_flags")]
351 #[doc(alias = "flags")]
352 fn set_flags(&self, flags: ApplicationFlags) {
353 unsafe {
354 ffi::g_application_set_flags(self.as_ref().to_glib_none().0, flags.into_glib());
355 }
356 }
357
358 #[doc(alias = "g_application_set_inactivity_timeout")]
359 #[doc(alias = "inactivity-timeout")]
360 fn set_inactivity_timeout(&self, inactivity_timeout: u32) {
361 unsafe {
362 ffi::g_application_set_inactivity_timeout(
363 self.as_ref().to_glib_none().0,
364 inactivity_timeout,
365 );
366 }
367 }
368
369 #[doc(alias = "g_application_set_option_context_description")]
370 fn set_option_context_description(&self, description: Option<&str>) {
371 unsafe {
372 ffi::g_application_set_option_context_description(
373 self.as_ref().to_glib_none().0,
374 description.to_glib_none().0,
375 );
376 }
377 }
378
379 #[doc(alias = "g_application_set_option_context_parameter_string")]
380 fn set_option_context_parameter_string(&self, parameter_string: Option<&str>) {
381 unsafe {
382 ffi::g_application_set_option_context_parameter_string(
383 self.as_ref().to_glib_none().0,
384 parameter_string.to_glib_none().0,
385 );
386 }
387 }
388
389 #[doc(alias = "g_application_set_option_context_summary")]
390 fn set_option_context_summary(&self, summary: Option<&str>) {
391 unsafe {
392 ffi::g_application_set_option_context_summary(
393 self.as_ref().to_glib_none().0,
394 summary.to_glib_none().0,
395 );
396 }
397 }
398
399 #[doc(alias = "g_application_set_resource_base_path")]
400 #[doc(alias = "resource-base-path")]
401 fn set_resource_base_path(&self, resource_path: Option<&str>) {
402 unsafe {
403 ffi::g_application_set_resource_base_path(
404 self.as_ref().to_glib_none().0,
405 resource_path.to_glib_none().0,
406 );
407 }
408 }
409
410 #[cfg(feature = "v2_80")]
411 #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
412 #[doc(alias = "g_application_set_version")]
413 #[doc(alias = "version")]
414 fn set_version(&self, version: &str) {
415 unsafe {
416 ffi::g_application_set_version(
417 self.as_ref().to_glib_none().0,
418 version.to_glib_none().0,
419 );
420 }
421 }
422
423 #[doc(alias = "g_application_unbind_busy_property")]
424 fn unbind_busy_property(&self, object: &impl IsA<glib::Object>, property: &str) {
425 unsafe {
426 ffi::g_application_unbind_busy_property(
427 self.as_ref().to_glib_none().0,
428 object.as_ref().to_glib_none().0,
429 property.to_glib_none().0,
430 );
431 }
432 }
433
434 #[doc(alias = "g_application_withdraw_notification")]
435 fn withdraw_notification(&self, id: &str) {
436 unsafe {
437 ffi::g_application_withdraw_notification(
438 self.as_ref().to_glib_none().0,
439 id.to_glib_none().0,
440 );
441 }
442 }
443
444 #[doc(alias = "activate")]
445 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
446 unsafe extern "C" fn activate_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
447 this: *mut ffi::GApplication,
448 f: glib::ffi::gpointer,
449 ) {
450 let f: &F = &*(f as *const F);
451 f(Application::from_glib_borrow(this).unsafe_cast_ref())
452 }
453 unsafe {
454 let f: Box_<F> = Box_::new(f);
455 connect_raw(
456 self.as_ptr() as *mut _,
457 c"activate".as_ptr() as *const _,
458 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
459 activate_trampoline::<Self, F> as *const (),
460 )),
461 Box_::into_raw(f),
462 )
463 }
464 }
465
466 #[cfg(feature = "v2_60")]
467 #[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
468 #[doc(alias = "name-lost")]
469 fn connect_name_lost<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
470 unsafe extern "C" fn name_lost_trampoline<
471 P: IsA<Application>,
472 F: Fn(&P) -> bool + 'static,
473 >(
474 this: *mut ffi::GApplication,
475 f: glib::ffi::gpointer,
476 ) -> glib::ffi::gboolean {
477 let f: &F = &*(f as *const F);
478 f(Application::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
479 }
480 unsafe {
481 let f: Box_<F> = Box_::new(f);
482 connect_raw(
483 self.as_ptr() as *mut _,
484 c"name-lost".as_ptr() as *const _,
485 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
486 name_lost_trampoline::<Self, F> as *const (),
487 )),
488 Box_::into_raw(f),
489 )
490 }
491 }
492
493 #[doc(alias = "shutdown")]
494 fn connect_shutdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
495 unsafe extern "C" fn shutdown_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
496 this: *mut ffi::GApplication,
497 f: glib::ffi::gpointer,
498 ) {
499 let f: &F = &*(f as *const F);
500 f(Application::from_glib_borrow(this).unsafe_cast_ref())
501 }
502 unsafe {
503 let f: Box_<F> = Box_::new(f);
504 connect_raw(
505 self.as_ptr() as *mut _,
506 c"shutdown".as_ptr() as *const _,
507 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
508 shutdown_trampoline::<Self, F> as *const (),
509 )),
510 Box_::into_raw(f),
511 )
512 }
513 }
514
515 #[doc(alias = "startup")]
516 fn connect_startup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
517 unsafe extern "C" fn startup_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
518 this: *mut ffi::GApplication,
519 f: glib::ffi::gpointer,
520 ) {
521 let f: &F = &*(f as *const F);
522 f(Application::from_glib_borrow(this).unsafe_cast_ref())
523 }
524 unsafe {
525 let f: Box_<F> = Box_::new(f);
526 connect_raw(
527 self.as_ptr() as *mut _,
528 c"startup".as_ptr() as *const _,
529 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
530 startup_trampoline::<Self, F> as *const (),
531 )),
532 Box_::into_raw(f),
533 )
534 }
535 }
536
537 #[doc(alias = "application-id")]
538 fn connect_application_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
539 unsafe extern "C" fn notify_application_id_trampoline<
540 P: IsA<Application>,
541 F: Fn(&P) + 'static,
542 >(
543 this: *mut ffi::GApplication,
544 _param_spec: glib::ffi::gpointer,
545 f: glib::ffi::gpointer,
546 ) {
547 let f: &F = &*(f as *const F);
548 f(Application::from_glib_borrow(this).unsafe_cast_ref())
549 }
550 unsafe {
551 let f: Box_<F> = Box_::new(f);
552 connect_raw(
553 self.as_ptr() as *mut _,
554 c"notify::application-id".as_ptr() as *const _,
555 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
556 notify_application_id_trampoline::<Self, F> as *const (),
557 )),
558 Box_::into_raw(f),
559 )
560 }
561 }
562
563 #[doc(alias = "flags")]
564 fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
565 unsafe extern "C" fn notify_flags_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
566 this: *mut ffi::GApplication,
567 _param_spec: glib::ffi::gpointer,
568 f: glib::ffi::gpointer,
569 ) {
570 let f: &F = &*(f as *const F);
571 f(Application::from_glib_borrow(this).unsafe_cast_ref())
572 }
573 unsafe {
574 let f: Box_<F> = Box_::new(f);
575 connect_raw(
576 self.as_ptr() as *mut _,
577 c"notify::flags".as_ptr() as *const _,
578 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
579 notify_flags_trampoline::<Self, F> as *const (),
580 )),
581 Box_::into_raw(f),
582 )
583 }
584 }
585
586 #[doc(alias = "inactivity-timeout")]
587 fn connect_inactivity_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
588 unsafe extern "C" fn notify_inactivity_timeout_trampoline<
589 P: IsA<Application>,
590 F: Fn(&P) + 'static,
591 >(
592 this: *mut ffi::GApplication,
593 _param_spec: glib::ffi::gpointer,
594 f: glib::ffi::gpointer,
595 ) {
596 let f: &F = &*(f as *const F);
597 f(Application::from_glib_borrow(this).unsafe_cast_ref())
598 }
599 unsafe {
600 let f: Box_<F> = Box_::new(f);
601 connect_raw(
602 self.as_ptr() as *mut _,
603 c"notify::inactivity-timeout".as_ptr() as *const _,
604 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
605 notify_inactivity_timeout_trampoline::<Self, F> as *const (),
606 )),
607 Box_::into_raw(f),
608 )
609 }
610 }
611
612 #[doc(alias = "is-busy")]
613 fn connect_is_busy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
614 unsafe extern "C" fn notify_is_busy_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
615 this: *mut ffi::GApplication,
616 _param_spec: glib::ffi::gpointer,
617 f: glib::ffi::gpointer,
618 ) {
619 let f: &F = &*(f as *const F);
620 f(Application::from_glib_borrow(this).unsafe_cast_ref())
621 }
622 unsafe {
623 let f: Box_<F> = Box_::new(f);
624 connect_raw(
625 self.as_ptr() as *mut _,
626 c"notify::is-busy".as_ptr() as *const _,
627 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
628 notify_is_busy_trampoline::<Self, F> as *const (),
629 )),
630 Box_::into_raw(f),
631 )
632 }
633 }
634
635 #[doc(alias = "is-registered")]
636 fn connect_is_registered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
637 unsafe extern "C" fn notify_is_registered_trampoline<
638 P: IsA<Application>,
639 F: Fn(&P) + 'static,
640 >(
641 this: *mut ffi::GApplication,
642 _param_spec: glib::ffi::gpointer,
643 f: glib::ffi::gpointer,
644 ) {
645 let f: &F = &*(f as *const F);
646 f(Application::from_glib_borrow(this).unsafe_cast_ref())
647 }
648 unsafe {
649 let f: Box_<F> = Box_::new(f);
650 connect_raw(
651 self.as_ptr() as *mut _,
652 c"notify::is-registered".as_ptr() as *const _,
653 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
654 notify_is_registered_trampoline::<Self, F> as *const (),
655 )),
656 Box_::into_raw(f),
657 )
658 }
659 }
660
661 #[doc(alias = "is-remote")]
662 fn connect_is_remote_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
663 unsafe extern "C" fn notify_is_remote_trampoline<
664 P: IsA<Application>,
665 F: Fn(&P) + 'static,
666 >(
667 this: *mut ffi::GApplication,
668 _param_spec: glib::ffi::gpointer,
669 f: glib::ffi::gpointer,
670 ) {
671 let f: &F = &*(f as *const F);
672 f(Application::from_glib_borrow(this).unsafe_cast_ref())
673 }
674 unsafe {
675 let f: Box_<F> = Box_::new(f);
676 connect_raw(
677 self.as_ptr() as *mut _,
678 c"notify::is-remote".as_ptr() as *const _,
679 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
680 notify_is_remote_trampoline::<Self, F> as *const (),
681 )),
682 Box_::into_raw(f),
683 )
684 }
685 }
686
687 #[doc(alias = "resource-base-path")]
688 fn connect_resource_base_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
689 unsafe extern "C" fn notify_resource_base_path_trampoline<
690 P: IsA<Application>,
691 F: Fn(&P) + 'static,
692 >(
693 this: *mut ffi::GApplication,
694 _param_spec: glib::ffi::gpointer,
695 f: glib::ffi::gpointer,
696 ) {
697 let f: &F = &*(f as *const F);
698 f(Application::from_glib_borrow(this).unsafe_cast_ref())
699 }
700 unsafe {
701 let f: Box_<F> = Box_::new(f);
702 connect_raw(
703 self.as_ptr() as *mut _,
704 c"notify::resource-base-path".as_ptr() as *const _,
705 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
706 notify_resource_base_path_trampoline::<Self, F> as *const (),
707 )),
708 Box_::into_raw(f),
709 )
710 }
711 }
712
713 #[cfg(feature = "v2_80")]
714 #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
715 #[doc(alias = "version")]
716 fn connect_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
717 unsafe extern "C" fn notify_version_trampoline<P: IsA<Application>, F: Fn(&P) + 'static>(
718 this: *mut ffi::GApplication,
719 _param_spec: glib::ffi::gpointer,
720 f: glib::ffi::gpointer,
721 ) {
722 let f: &F = &*(f as *const F);
723 f(Application::from_glib_borrow(this).unsafe_cast_ref())
724 }
725 unsafe {
726 let f: Box_<F> = Box_::new(f);
727 connect_raw(
728 self.as_ptr() as *mut _,
729 c"notify::version".as_ptr() as *const _,
730 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
731 notify_version_trampoline::<Self, F> as *const (),
732 )),
733 Box_::into_raw(f),
734 )
735 }
736 }
737}
738
739impl<O: IsA<Application>> ApplicationExt for O {}