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