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::object::ObjectType as ObjectType_;
7 use glib::signal::connect_raw;
8 use glib::signal::SignalHandlerId;
9 use glib::translate::*;
10 use glib_sys;
11 use std::boxed::Box as Box_;
12 use std::fmt;
13 use std::mem::transmute;
14 
15 glib_wrapper! {
16     pub struct AppInfoMonitor(Object<gio_sys::GAppInfoMonitor, AppInfoMonitorClass>);
17 
18     match fn {
19         get_type => || gio_sys::g_app_info_monitor_get_type(),
20     }
21 }
22 
23 impl AppInfoMonitor {
get() -> AppInfoMonitor24     pub fn get() -> AppInfoMonitor {
25         unsafe { from_glib_full(gio_sys::g_app_info_monitor_get()) }
26     }
27 
connect_changed<F: Fn(&AppInfoMonitor) + 'static>(&self, f: F) -> SignalHandlerId28     pub fn connect_changed<F: Fn(&AppInfoMonitor) + 'static>(&self, f: F) -> SignalHandlerId {
29         unsafe extern "C" fn changed_trampoline<F: Fn(&AppInfoMonitor) + 'static>(
30             this: *mut gio_sys::GAppInfoMonitor,
31             f: glib_sys::gpointer,
32         ) {
33             let f: &F = &*(f as *const F);
34             f(&from_glib_borrow(this))
35         }
36         unsafe {
37             let f: Box_<F> = Box_::new(f);
38             connect_raw(
39                 self.as_ptr() as *mut _,
40                 b"changed\0".as_ptr() as *const _,
41                 Some(transmute(changed_trampoline::<F> as usize)),
42                 Box_::into_raw(f),
43             )
44         }
45     }
46 }
47 
48 impl fmt::Display for AppInfoMonitor {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result49     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
50         write!(f, "AppInfoMonitor")
51     }
52 }
53