1use gio_sys;
6use glib;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::signal::connect_raw;
10use glib::signal::SignalHandlerId;
11use glib::translate::*;
12use glib::GString;
13use glib::StaticType;
14use glib::ToValue;
15use glib::Value;
16use glib_sys;
17use gobject_sys;
18use libc;
19use std::boxed::Box as Box_;
20use std::fmt;
21use std::mem::transmute;
22use std::ptr;
23use ActionGroup;
24use ActionMap;
25use ApplicationCommandLine;
26use ApplicationFlags;
27use Cancellable;
28use Error;
29use File;
30use Notification;
31
32glib_wrapper! {
33 pub struct Application(Object<gio_sys::GApplication, gio_sys::GApplicationClass, ApplicationClass>) @implements ActionGroup, ActionMap;
34
35 match fn {
36 get_type => || gio_sys::g_application_get_type(),
37 }
38}
39
40impl Application {
41 pub fn new(application_id: Option<&str>, flags: ApplicationFlags) -> Application {
42 unsafe {
43 from_glib_full(gio_sys::g_application_new(
44 application_id.to_glib_none().0,
45 flags.to_glib(),
46 ))
47 }
48 }
49
50 pub fn get_default() -> Option<Application> {
51 unsafe { from_glib_none(gio_sys::g_application_get_default()) }
52 }
53
54 pub fn id_is_valid(application_id: &str) -> bool {
55 unsafe {
56 from_glib(gio_sys::g_application_id_is_valid(
57 application_id.to_glib_none().0,
58 ))
59 }
60 }
61}
62
63pub struct ApplicationBuilder {
64 action_group: Option<ActionGroup>,
65 application_id: Option<String>,
66 flags: Option<ApplicationFlags>,
67 inactivity_timeout: Option<u32>,
68 resource_base_path: Option<String>,
69}
70
71impl ApplicationBuilder {
72 pub fn new() -> Self {
73 Self {
74 action_group: None,
75 application_id: None,
76 flags: None,
77 inactivity_timeout: None,
78 resource_base_path: None,
79 }
80 }
81
82 pub fn build(self) -> Application {
83 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
84 if let Some(ref action_group) = self.action_group {
85 properties.push(("action-group", action_group));
86 }
87 if let Some(ref application_id) = self.application_id {
88 properties.push(("application-id", application_id));
89 }
90 if let Some(ref flags) = self.flags {
91 properties.push(("flags", flags));
92 }
93 if let Some(ref inactivity_timeout) = self.inactivity_timeout {
94 properties.push(("inactivity-timeout", inactivity_timeout));
95 }
96 if let Some(ref resource_base_path) = self.resource_base_path {
97 properties.push(("resource-base-path", resource_base_path));
98 }
99 glib::Object::new(Application::static_type(), &properties)
100 .expect("object new")
101 .downcast()
102 .expect("downcast")
103 }
104
105 pub fn action_group(mut self, action_group: &ActionGroup) -> Self {
106 self.action_group = Some(action_group.clone());
107 self
108 }
109
110 pub fn application_id(mut self, application_id: &str) -> Self {
111 self.application_id = Some(application_id.to_string());
112 self
113 }
114
115 pub fn flags(mut self, flags: ApplicationFlags) -> Self {
116 self.flags = Some(flags);
117 self
118 }
119
120 pub fn inactivity_timeout(mut self, inactivity_timeout: u32) -> Self {
121 self.inactivity_timeout = Some(inactivity_timeout);
122 self
123 }
124
125 pub fn resource_base_path(mut self, resource_base_path: &str) -> Self {
126 self.resource_base_path = Some(resource_base_path.to_string());
127 self
128 }
129}
130
131pub const NONE_APPLICATION: Option<&Application> = None;
132
133pub trait ApplicationExt: 'static {
134 fn activate(&self);
135
136 fn add_main_option(
137 &self,
138 long_name: &str,
139 short_name: glib::Char,
140 flags: glib::OptionFlags,
141 arg: glib::OptionArg,
142 description: &str,
143 arg_description: Option<&str>,
144 );
145
146 #[cfg(any(feature = "v2_44", feature = "dox"))]
151 fn bind_busy_property<P: IsA<glib::Object>>(&self, object: &P, property: &str);
152
153 fn get_application_id(&self) -> Option<GString>;
154
155 fn get_dbus_object_path(&self) -> Option<GString>;
158
159 fn get_flags(&self) -> ApplicationFlags;
160
161 fn get_inactivity_timeout(&self) -> u32;
162
163 #[cfg(any(feature = "v2_44", feature = "dox"))]
164 fn get_is_busy(&self) -> bool;
165
166 fn get_is_registered(&self) -> bool;
167
168 fn get_is_remote(&self) -> bool;
169
170 fn get_resource_base_path(&self) -> Option<GString>;
171
172 fn hold(&self);
173
174 fn mark_busy(&self);
175
176 fn open(&self, files: &[File], hint: &str);
177
178 fn quit(&self);
179
180 fn register<P: IsA<Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error>;
181
182 fn release(&self);
183
184 fn send_notification(&self, id: Option<&str>, notification: &Notification);
185
186 fn set_application_id(&self, application_id: Option<&str>);
187
188 fn set_default(&self);
189
190 fn set_flags(&self, flags: ApplicationFlags);
191
192 fn set_inactivity_timeout(&self, inactivity_timeout: u32);
193
194 #[cfg(any(feature = "v2_56", feature = "dox"))]
195 fn set_option_context_description(&self, description: Option<&str>);
196
197 #[cfg(any(feature = "v2_56", feature = "dox"))]
198 fn set_option_context_parameter_string(&self, parameter_string: Option<&str>);
199
200 #[cfg(any(feature = "v2_56", feature = "dox"))]
201 fn set_option_context_summary(&self, summary: Option<&str>);
202
203 fn set_resource_base_path(&self, resource_path: Option<&str>);
204
205 #[cfg(any(feature = "v2_44", feature = "dox"))]
206 fn unbind_busy_property<P: IsA<glib::Object>>(&self, object: &P, property: &str);
207
208 fn unmark_busy(&self);
209
210 fn withdraw_notification(&self, id: &str);
211
212 fn set_property_action_group(&self, action_group: Option<&ActionGroup>);
213
214 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
215
216 fn connect_command_line<F: Fn(&Self, &ApplicationCommandLine) -> i32 + 'static>(
217 &self,
218 f: F,
219 ) -> SignalHandlerId;
220
221 fn connect_shutdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
224
225 fn connect_startup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
226
227 fn connect_property_action_group_notify<F: Fn(&Self) + 'static>(&self, f: F)
228 -> SignalHandlerId;
229
230 fn connect_property_application_id_notify<F: Fn(&Self) + 'static>(
231 &self,
232 f: F,
233 ) -> SignalHandlerId;
234
235 fn connect_property_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
236
237 fn connect_property_inactivity_timeout_notify<F: Fn(&Self) + 'static>(
238 &self,
239 f: F,
240 ) -> SignalHandlerId;
241
242 #[cfg(any(feature = "v2_44", feature = "dox"))]
243 fn connect_property_is_busy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
244
245 fn connect_property_is_registered_notify<F: Fn(&Self) + 'static>(
246 &self,
247 f: F,
248 ) -> SignalHandlerId;
249
250 fn connect_property_is_remote_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
251
252 fn connect_property_resource_base_path_notify<F: Fn(&Self) + 'static>(
253 &self,
254 f: F,
255 ) -> SignalHandlerId;
256}
257
258impl<O: IsA<Application>> ApplicationExt for O {
259 fn activate(&self) {
260 unsafe {
261 gio_sys::g_application_activate(self.as_ref().to_glib_none().0);
262 }
263 }
264
265 fn add_main_option(
266 &self,
267 long_name: &str,
268 short_name: glib::Char,
269 flags: glib::OptionFlags,
270 arg: glib::OptionArg,
271 description: &str,
272 arg_description: Option<&str>,
273 ) {
274 unsafe {
275 gio_sys::g_application_add_main_option(
276 self.as_ref().to_glib_none().0,
277 long_name.to_glib_none().0,
278 short_name.to_glib(),
279 flags.to_glib(),
280 arg.to_glib(),
281 description.to_glib_none().0,
282 arg_description.to_glib_none().0,
283 );
284 }
285 }
286
287 #[cfg(any(feature = "v2_44", feature = "dox"))]
296 fn bind_busy_property<P: IsA<glib::Object>>(&self, object: &P, property: &str) {
297 unsafe {
298 gio_sys::g_application_bind_busy_property(
299 self.as_ref().to_glib_none().0,
300 object.as_ref().to_glib_none().0,
301 property.to_glib_none().0,
302 );
303 }
304 }
305
306 fn get_application_id(&self) -> Option<GString> {
307 unsafe {
308 from_glib_none(gio_sys::g_application_get_application_id(
309 self.as_ref().to_glib_none().0,
310 ))
311 }
312 }
313
314 fn get_dbus_object_path(&self) -> Option<GString> {
319 unsafe {
320 from_glib_none(gio_sys::g_application_get_dbus_object_path(
321 self.as_ref().to_glib_none().0,
322 ))
323 }
324 }
325
326 fn get_flags(&self) -> ApplicationFlags {
327 unsafe {
328 from_glib(gio_sys::g_application_get_flags(
329 self.as_ref().to_glib_none().0,
330 ))
331 }
332 }
333
334 fn get_inactivity_timeout(&self) -> u32 {
335 unsafe { gio_sys::g_application_get_inactivity_timeout(self.as_ref().to_glib_none().0) }
336 }
337
338 #[cfg(any(feature = "v2_44", feature = "dox"))]
339 fn get_is_busy(&self) -> bool {
340 unsafe {
341 from_glib(gio_sys::g_application_get_is_busy(
342 self.as_ref().to_glib_none().0,
343 ))
344 }
345 }
346
347 fn get_is_registered(&self) -> bool {
348 unsafe {
349 from_glib(gio_sys::g_application_get_is_registered(
350 self.as_ref().to_glib_none().0,
351 ))
352 }
353 }
354
355 fn get_is_remote(&self) -> bool {
356 unsafe {
357 from_glib(gio_sys::g_application_get_is_remote(
358 self.as_ref().to_glib_none().0,
359 ))
360 }
361 }
362
363 fn get_resource_base_path(&self) -> Option<GString> {
364 unsafe {
365 from_glib_none(gio_sys::g_application_get_resource_base_path(
366 self.as_ref().to_glib_none().0,
367 ))
368 }
369 }
370
371 fn hold(&self) {
372 unsafe {
373 gio_sys::g_application_hold(self.as_ref().to_glib_none().0);
374 }
375 }
376
377 fn mark_busy(&self) {
378 unsafe {
379 gio_sys::g_application_mark_busy(self.as_ref().to_glib_none().0);
380 }
381 }
382
383 fn open(&self, files: &[File], hint: &str) {
384 let n_files = files.len() as i32;
385 unsafe {
386 gio_sys::g_application_open(
387 self.as_ref().to_glib_none().0,
388 files.to_glib_none().0,
389 n_files,
390 hint.to_glib_none().0,
391 );
392 }
393 }
394
395 fn quit(&self) {
396 unsafe {
397 gio_sys::g_application_quit(self.as_ref().to_glib_none().0);
398 }
399 }
400
401 fn register<P: IsA<Cancellable>>(&self, cancellable: Option<&P>) -> Result<(), Error> {
402 unsafe {
403 let mut error = ptr::null_mut();
404 let _ = gio_sys::g_application_register(
405 self.as_ref().to_glib_none().0,
406 cancellable.map(|p| p.as_ref()).to_glib_none().0,
407 &mut error,
408 );
409 if error.is_null() {
410 Ok(())
411 } else {
412 Err(from_glib_full(error))
413 }
414 }
415 }
416
417 fn release(&self) {
418 unsafe {
419 gio_sys::g_application_release(self.as_ref().to_glib_none().0);
420 }
421 }
422
423 fn send_notification(&self, id: Option<&str>, notification: &Notification) {
424 unsafe {
425 gio_sys::g_application_send_notification(
426 self.as_ref().to_glib_none().0,
427 id.to_glib_none().0,
428 notification.to_glib_none().0,
429 );
430 }
431 }
432
433 fn set_application_id(&self, application_id: Option<&str>) {
434 unsafe {
435 gio_sys::g_application_set_application_id(
436 self.as_ref().to_glib_none().0,
437 application_id.to_glib_none().0,
438 );
439 }
440 }
441
442 fn set_default(&self) {
443 unsafe {
444 gio_sys::g_application_set_default(self.as_ref().to_glib_none().0);
445 }
446 }
447
448 fn set_flags(&self, flags: ApplicationFlags) {
449 unsafe {
450 gio_sys::g_application_set_flags(self.as_ref().to_glib_none().0, flags.to_glib());
451 }
452 }
453
454 fn set_inactivity_timeout(&self, inactivity_timeout: u32) {
455 unsafe {
456 gio_sys::g_application_set_inactivity_timeout(
457 self.as_ref().to_glib_none().0,
458 inactivity_timeout,
459 );
460 }
461 }
462
463 #[cfg(any(feature = "v2_56", feature = "dox"))]
464 fn set_option_context_description(&self, description: Option<&str>) {
465 unsafe {
466 gio_sys::g_application_set_option_context_description(
467 self.as_ref().to_glib_none().0,
468 description.to_glib_none().0,
469 );
470 }
471 }
472
473 #[cfg(any(feature = "v2_56", feature = "dox"))]
474 fn set_option_context_parameter_string(&self, parameter_string: Option<&str>) {
475 unsafe {
476 gio_sys::g_application_set_option_context_parameter_string(
477 self.as_ref().to_glib_none().0,
478 parameter_string.to_glib_none().0,
479 );
480 }
481 }
482
483 #[cfg(any(feature = "v2_56", feature = "dox"))]
484 fn set_option_context_summary(&self, summary: Option<&str>) {
485 unsafe {
486 gio_sys::g_application_set_option_context_summary(
487 self.as_ref().to_glib_none().0,
488 summary.to_glib_none().0,
489 );
490 }
491 }
492
493 fn set_resource_base_path(&self, resource_path: Option<&str>) {
494 unsafe {
495 gio_sys::g_application_set_resource_base_path(
496 self.as_ref().to_glib_none().0,
497 resource_path.to_glib_none().0,
498 );
499 }
500 }
501
502 #[cfg(any(feature = "v2_44", feature = "dox"))]
503 fn unbind_busy_property<P: IsA<glib::Object>>(&self, object: &P, property: &str) {
504 unsafe {
505 gio_sys::g_application_unbind_busy_property(
506 self.as_ref().to_glib_none().0,
507 object.as_ref().to_glib_none().0,
508 property.to_glib_none().0,
509 );
510 }
511 }
512
513 fn unmark_busy(&self) {
514 unsafe {
515 gio_sys::g_application_unmark_busy(self.as_ref().to_glib_none().0);
516 }
517 }
518
519 fn withdraw_notification(&self, id: &str) {
520 unsafe {
521 gio_sys::g_application_withdraw_notification(
522 self.as_ref().to_glib_none().0,
523 id.to_glib_none().0,
524 );
525 }
526 }
527
528 fn set_property_action_group(&self, action_group: Option<&ActionGroup>) {
529 unsafe {
530 gobject_sys::g_object_set_property(
531 self.to_glib_none().0 as *mut gobject_sys::GObject,
532 b"action-group\0".as_ptr() as *const _,
533 Value::from(action_group).to_glib_none().0,
534 );
535 }
536 }
537
538 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
539 unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>(
540 this: *mut gio_sys::GApplication,
541 f: glib_sys::gpointer,
542 ) where
543 P: IsA<Application>,
544 {
545 let f: &F = &*(f as *const F);
546 f(&Application::from_glib_borrow(this).unsafe_cast())
547 }
548 unsafe {
549 let f: Box_<F> = Box_::new(f);
550 connect_raw(
551 self.as_ptr() as *mut _,
552 b"activate\0".as_ptr() as *const _,
553 Some(transmute(activate_trampoline::<Self, F> as usize)),
554 Box_::into_raw(f),
555 )
556 }
557 }
558
559 fn connect_command_line<F: Fn(&Self, &ApplicationCommandLine) -> i32 + 'static>(
560 &self,
561 f: F,
562 ) -> SignalHandlerId {
563 unsafe extern "C" fn command_line_trampoline<
564 P,
565 F: Fn(&P, &ApplicationCommandLine) -> i32 + 'static,
566 >(
567 this: *mut gio_sys::GApplication,
568 command_line: *mut gio_sys::GApplicationCommandLine,
569 f: glib_sys::gpointer,
570 ) -> libc::c_int
571 where
572 P: IsA<Application>,
573 {
574 let f: &F = &*(f as *const F);
575 f(
576 &Application::from_glib_borrow(this).unsafe_cast(),
577 &from_glib_borrow(command_line),
578 )
579 }
580 unsafe {
581 let f: Box_<F> = Box_::new(f);
582 connect_raw(
583 self.as_ptr() as *mut _,
584 b"command-line\0".as_ptr() as *const _,
585 Some(transmute(command_line_trampoline::<Self, F> as usize)),
586 Box_::into_raw(f),
587 )
588 }
589 }
590
591 fn connect_shutdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
596 unsafe extern "C" fn shutdown_trampoline<P, F: Fn(&P) + 'static>(
597 this: *mut gio_sys::GApplication,
598 f: glib_sys::gpointer,
599 ) where
600 P: IsA<Application>,
601 {
602 let f: &F = &*(f as *const F);
603 f(&Application::from_glib_borrow(this).unsafe_cast())
604 }
605 unsafe {
606 let f: Box_<F> = Box_::new(f);
607 connect_raw(
608 self.as_ptr() as *mut _,
609 b"shutdown\0".as_ptr() as *const _,
610 Some(transmute(shutdown_trampoline::<Self, F> as usize)),
611 Box_::into_raw(f),
612 )
613 }
614 }
615
616 fn connect_startup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
617 unsafe extern "C" fn startup_trampoline<P, F: Fn(&P) + 'static>(
618 this: *mut gio_sys::GApplication,
619 f: glib_sys::gpointer,
620 ) where
621 P: IsA<Application>,
622 {
623 let f: &F = &*(f as *const F);
624 f(&Application::from_glib_borrow(this).unsafe_cast())
625 }
626 unsafe {
627 let f: Box_<F> = Box_::new(f);
628 connect_raw(
629 self.as_ptr() as *mut _,
630 b"startup\0".as_ptr() as *const _,
631 Some(transmute(startup_trampoline::<Self, F> as usize)),
632 Box_::into_raw(f),
633 )
634 }
635 }
636
637 fn connect_property_action_group_notify<F: Fn(&Self) + 'static>(
638 &self,
639 f: F,
640 ) -> SignalHandlerId {
641 unsafe extern "C" fn notify_action_group_trampoline<P, F: Fn(&P) + 'static>(
642 this: *mut gio_sys::GApplication,
643 _param_spec: glib_sys::gpointer,
644 f: glib_sys::gpointer,
645 ) where
646 P: IsA<Application>,
647 {
648 let f: &F = &*(f as *const F);
649 f(&Application::from_glib_borrow(this).unsafe_cast())
650 }
651 unsafe {
652 let f: Box_<F> = Box_::new(f);
653 connect_raw(
654 self.as_ptr() as *mut _,
655 b"notify::action-group\0".as_ptr() as *const _,
656 Some(transmute(
657 notify_action_group_trampoline::<Self, F> as usize,
658 )),
659 Box_::into_raw(f),
660 )
661 }
662 }
663
664 fn connect_property_application_id_notify<F: Fn(&Self) + 'static>(
665 &self,
666 f: F,
667 ) -> SignalHandlerId {
668 unsafe extern "C" fn notify_application_id_trampoline<P, F: Fn(&P) + 'static>(
669 this: *mut gio_sys::GApplication,
670 _param_spec: glib_sys::gpointer,
671 f: glib_sys::gpointer,
672 ) where
673 P: IsA<Application>,
674 {
675 let f: &F = &*(f as *const F);
676 f(&Application::from_glib_borrow(this).unsafe_cast())
677 }
678 unsafe {
679 let f: Box_<F> = Box_::new(f);
680 connect_raw(
681 self.as_ptr() as *mut _,
682 b"notify::application-id\0".as_ptr() as *const _,
683 Some(transmute(
684 notify_application_id_trampoline::<Self, F> as usize,
685 )),
686 Box_::into_raw(f),
687 )
688 }
689 }
690
691 fn connect_property_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
692 unsafe extern "C" fn notify_flags_trampoline<P, F: Fn(&P) + 'static>(
693 this: *mut gio_sys::GApplication,
694 _param_spec: glib_sys::gpointer,
695 f: glib_sys::gpointer,
696 ) where
697 P: IsA<Application>,
698 {
699 let f: &F = &*(f as *const F);
700 f(&Application::from_glib_borrow(this).unsafe_cast())
701 }
702 unsafe {
703 let f: Box_<F> = Box_::new(f);
704 connect_raw(
705 self.as_ptr() as *mut _,
706 b"notify::flags\0".as_ptr() as *const _,
707 Some(transmute(notify_flags_trampoline::<Self, F> as usize)),
708 Box_::into_raw(f),
709 )
710 }
711 }
712
713 fn connect_property_inactivity_timeout_notify<F: Fn(&Self) + 'static>(
714 &self,
715 f: F,
716 ) -> SignalHandlerId {
717 unsafe extern "C" fn notify_inactivity_timeout_trampoline<P, F: Fn(&P) + 'static>(
718 this: *mut gio_sys::GApplication,
719 _param_spec: glib_sys::gpointer,
720 f: glib_sys::gpointer,
721 ) where
722 P: IsA<Application>,
723 {
724 let f: &F = &*(f as *const F);
725 f(&Application::from_glib_borrow(this).unsafe_cast())
726 }
727 unsafe {
728 let f: Box_<F> = Box_::new(f);
729 connect_raw(
730 self.as_ptr() as *mut _,
731 b"notify::inactivity-timeout\0".as_ptr() as *const _,
732 Some(transmute(
733 notify_inactivity_timeout_trampoline::<Self, F> as usize,
734 )),
735 Box_::into_raw(f),
736 )
737 }
738 }
739
740 #[cfg(any(feature = "v2_44", feature = "dox"))]
741 fn connect_property_is_busy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
742 unsafe extern "C" fn notify_is_busy_trampoline<P, F: Fn(&P) + 'static>(
743 this: *mut gio_sys::GApplication,
744 _param_spec: glib_sys::gpointer,
745 f: glib_sys::gpointer,
746 ) where
747 P: IsA<Application>,
748 {
749 let f: &F = &*(f as *const F);
750 f(&Application::from_glib_borrow(this).unsafe_cast())
751 }
752 unsafe {
753 let f: Box_<F> = Box_::new(f);
754 connect_raw(
755 self.as_ptr() as *mut _,
756 b"notify::is-busy\0".as_ptr() as *const _,
757 Some(transmute(notify_is_busy_trampoline::<Self, F> as usize)),
758 Box_::into_raw(f),
759 )
760 }
761 }
762
763 fn connect_property_is_registered_notify<F: Fn(&Self) + 'static>(
764 &self,
765 f: F,
766 ) -> SignalHandlerId {
767 unsafe extern "C" fn notify_is_registered_trampoline<P, F: Fn(&P) + 'static>(
768 this: *mut gio_sys::GApplication,
769 _param_spec: glib_sys::gpointer,
770 f: glib_sys::gpointer,
771 ) where
772 P: IsA<Application>,
773 {
774 let f: &F = &*(f as *const F);
775 f(&Application::from_glib_borrow(this).unsafe_cast())
776 }
777 unsafe {
778 let f: Box_<F> = Box_::new(f);
779 connect_raw(
780 self.as_ptr() as *mut _,
781 b"notify::is-registered\0".as_ptr() as *const _,
782 Some(transmute(
783 notify_is_registered_trampoline::<Self, F> as usize,
784 )),
785 Box_::into_raw(f),
786 )
787 }
788 }
789
790 fn connect_property_is_remote_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
791 unsafe extern "C" fn notify_is_remote_trampoline<P, F: Fn(&P) + 'static>(
792 this: *mut gio_sys::GApplication,
793 _param_spec: glib_sys::gpointer,
794 f: glib_sys::gpointer,
795 ) where
796 P: IsA<Application>,
797 {
798 let f: &F = &*(f as *const F);
799 f(&Application::from_glib_borrow(this).unsafe_cast())
800 }
801 unsafe {
802 let f: Box_<F> = Box_::new(f);
803 connect_raw(
804 self.as_ptr() as *mut _,
805 b"notify::is-remote\0".as_ptr() as *const _,
806 Some(transmute(notify_is_remote_trampoline::<Self, F> as usize)),
807 Box_::into_raw(f),
808 )
809 }
810 }
811
812 fn connect_property_resource_base_path_notify<F: Fn(&Self) + 'static>(
813 &self,
814 f: F,
815 ) -> SignalHandlerId {
816 unsafe extern "C" fn notify_resource_base_path_trampoline<P, F: Fn(&P) + 'static>(
817 this: *mut gio_sys::GApplication,
818 _param_spec: glib_sys::gpointer,
819 f: glib_sys::gpointer,
820 ) where
821 P: IsA<Application>,
822 {
823 let f: &F = &*(f as *const F);
824 f(&Application::from_glib_borrow(this).unsafe_cast())
825 }
826 unsafe {
827 let f: Box_<F> = Box_::new(f);
828 connect_raw(
829 self.as_ptr() as *mut _,
830 b"notify::resource-base-path\0".as_ptr() as *const _,
831 Some(transmute(
832 notify_resource_base_path_trampoline::<Self, F> as usize,
833 )),
834 Box_::into_raw(f),
835 )
836 }
837 }
838}
839
840impl fmt::Display for Application {
841 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
842 write!(f, "Application")
843 }
844}