gio/auto/
dbus_proxy.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
5#[cfg(unix)]
6#[cfg_attr(docsrs, doc(cfg(unix)))]
7use crate::UnixFDList;
8use crate::{
9    ffi, AsyncInitable, AsyncResult, BusType, Cancellable, DBusCallFlags, DBusConnection,
10    DBusInterface, DBusInterfaceInfo, DBusProxyFlags, Initable,
11};
12use glib::{
13    prelude::*,
14    signal::{connect_raw, SignalHandlerId},
15    translate::*,
16};
17use std::{boxed::Box as Box_, pin::Pin};
18
19glib::wrapper! {
20    #[doc(alias = "GDBusProxy")]
21    pub struct DBusProxy(Object<ffi::GDBusProxy, ffi::GDBusProxyClass>) @implements AsyncInitable, DBusInterface, Initable;
22
23    match fn {
24        type_ => || ffi::g_dbus_proxy_get_type(),
25    }
26}
27
28impl DBusProxy {
29    pub const NONE: Option<&'static DBusProxy> = None;
30
31    #[doc(alias = "g_dbus_proxy_new_for_bus_sync")]
32    #[doc(alias = "new_for_bus_sync")]
33    pub fn for_bus_sync(
34        bus_type: BusType,
35        flags: DBusProxyFlags,
36        info: Option<&DBusInterfaceInfo>,
37        name: &str,
38        object_path: &str,
39        interface_name: &str,
40        cancellable: Option<&impl IsA<Cancellable>>,
41    ) -> Result<DBusProxy, glib::Error> {
42        unsafe {
43            let mut error = std::ptr::null_mut();
44            let ret = ffi::g_dbus_proxy_new_for_bus_sync(
45                bus_type.into_glib(),
46                flags.into_glib(),
47                info.to_glib_none().0,
48                name.to_glib_none().0,
49                object_path.to_glib_none().0,
50                interface_name.to_glib_none().0,
51                cancellable.map(|p| p.as_ref()).to_glib_none().0,
52                &mut error,
53            );
54            if error.is_null() {
55                Ok(from_glib_full(ret))
56            } else {
57                Err(from_glib_full(error))
58            }
59        }
60    }
61
62    #[doc(alias = "g_dbus_proxy_new_sync")]
63    pub fn new_sync(
64        connection: &DBusConnection,
65        flags: DBusProxyFlags,
66        info: Option<&DBusInterfaceInfo>,
67        name: Option<&str>,
68        object_path: &str,
69        interface_name: &str,
70        cancellable: Option<&impl IsA<Cancellable>>,
71    ) -> Result<DBusProxy, glib::Error> {
72        unsafe {
73            let mut error = std::ptr::null_mut();
74            let ret = ffi::g_dbus_proxy_new_sync(
75                connection.to_glib_none().0,
76                flags.into_glib(),
77                info.to_glib_none().0,
78                name.to_glib_none().0,
79                object_path.to_glib_none().0,
80                interface_name.to_glib_none().0,
81                cancellable.map(|p| p.as_ref()).to_glib_none().0,
82                &mut error,
83            );
84            if error.is_null() {
85                Ok(from_glib_full(ret))
86            } else {
87                Err(from_glib_full(error))
88            }
89        }
90    }
91
92    #[doc(alias = "g_dbus_proxy_new")]
93    pub fn new<P: FnOnce(Result<DBusProxy, glib::Error>) + 'static>(
94        connection: &DBusConnection,
95        flags: DBusProxyFlags,
96        info: Option<&DBusInterfaceInfo>,
97        name: Option<&str>,
98        object_path: &str,
99        interface_name: &str,
100        cancellable: Option<&impl IsA<Cancellable>>,
101        callback: P,
102    ) {
103        let main_context = glib::MainContext::ref_thread_default();
104        let is_main_context_owner = main_context.is_owner();
105        let has_acquired_main_context = (!is_main_context_owner)
106            .then(|| main_context.acquire().ok())
107            .flatten();
108        assert!(
109            is_main_context_owner || has_acquired_main_context.is_some(),
110            "Async operations only allowed if the thread is owning the MainContext"
111        );
112
113        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
114            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
115        unsafe extern "C" fn new_trampoline<P: FnOnce(Result<DBusProxy, glib::Error>) + 'static>(
116            _source_object: *mut glib::gobject_ffi::GObject,
117            res: *mut crate::ffi::GAsyncResult,
118            user_data: glib::ffi::gpointer,
119        ) {
120            let mut error = std::ptr::null_mut();
121            let ret = ffi::g_dbus_proxy_new_finish(res, &mut error);
122            let result = if error.is_null() {
123                Ok(from_glib_full(ret))
124            } else {
125                Err(from_glib_full(error))
126            };
127            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
128                Box_::from_raw(user_data as *mut _);
129            let callback: P = callback.into_inner();
130            callback(result);
131        }
132        let callback = new_trampoline::<P>;
133        unsafe {
134            ffi::g_dbus_proxy_new(
135                connection.to_glib_none().0,
136                flags.into_glib(),
137                info.to_glib_none().0,
138                name.to_glib_none().0,
139                object_path.to_glib_none().0,
140                interface_name.to_glib_none().0,
141                cancellable.map(|p| p.as_ref()).to_glib_none().0,
142                Some(callback),
143                Box_::into_raw(user_data) as *mut _,
144            );
145        }
146    }
147
148    pub fn new_future(
149        connection: &DBusConnection,
150        flags: DBusProxyFlags,
151        info: Option<&DBusInterfaceInfo>,
152        name: Option<&str>,
153        object_path: &str,
154        interface_name: &str,
155    ) -> Pin<Box_<dyn std::future::Future<Output = Result<DBusProxy, glib::Error>> + 'static>> {
156        let connection = connection.clone();
157        let info = info.map(ToOwned::to_owned);
158        let name = name.map(ToOwned::to_owned);
159        let object_path = String::from(object_path);
160        let interface_name = String::from(interface_name);
161        Box_::pin(crate::GioFuture::new(
162            &(),
163            move |_obj, cancellable, send| {
164                Self::new(
165                    &connection,
166                    flags,
167                    info.as_ref().map(::std::borrow::Borrow::borrow),
168                    name.as_ref().map(::std::borrow::Borrow::borrow),
169                    &object_path,
170                    &interface_name,
171                    Some(cancellable),
172                    move |res| {
173                        send.resolve(res);
174                    },
175                );
176            },
177        ))
178    }
179
180    #[doc(alias = "g_dbus_proxy_new_for_bus")]
181    #[doc(alias = "new_for_bus")]
182    pub fn for_bus<P: FnOnce(Result<DBusProxy, glib::Error>) + 'static>(
183        bus_type: BusType,
184        flags: DBusProxyFlags,
185        info: Option<&DBusInterfaceInfo>,
186        name: &str,
187        object_path: &str,
188        interface_name: &str,
189        cancellable: Option<&impl IsA<Cancellable>>,
190        callback: P,
191    ) {
192        let main_context = glib::MainContext::ref_thread_default();
193        let is_main_context_owner = main_context.is_owner();
194        let has_acquired_main_context = (!is_main_context_owner)
195            .then(|| main_context.acquire().ok())
196            .flatten();
197        assert!(
198            is_main_context_owner || has_acquired_main_context.is_some(),
199            "Async operations only allowed if the thread is owning the MainContext"
200        );
201
202        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
203            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
204        unsafe extern "C" fn for_bus_trampoline<
205            P: FnOnce(Result<DBusProxy, glib::Error>) + 'static,
206        >(
207            _source_object: *mut glib::gobject_ffi::GObject,
208            res: *mut crate::ffi::GAsyncResult,
209            user_data: glib::ffi::gpointer,
210        ) {
211            let mut error = std::ptr::null_mut();
212            let ret = ffi::g_dbus_proxy_new_for_bus_finish(res, &mut error);
213            let result = if error.is_null() {
214                Ok(from_glib_full(ret))
215            } else {
216                Err(from_glib_full(error))
217            };
218            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
219                Box_::from_raw(user_data as *mut _);
220            let callback: P = callback.into_inner();
221            callback(result);
222        }
223        let callback = for_bus_trampoline::<P>;
224        unsafe {
225            ffi::g_dbus_proxy_new_for_bus(
226                bus_type.into_glib(),
227                flags.into_glib(),
228                info.to_glib_none().0,
229                name.to_glib_none().0,
230                object_path.to_glib_none().0,
231                interface_name.to_glib_none().0,
232                cancellable.map(|p| p.as_ref()).to_glib_none().0,
233                Some(callback),
234                Box_::into_raw(user_data) as *mut _,
235            );
236        }
237    }
238
239    pub fn for_bus_future(
240        bus_type: BusType,
241        flags: DBusProxyFlags,
242        info: Option<&DBusInterfaceInfo>,
243        name: &str,
244        object_path: &str,
245        interface_name: &str,
246    ) -> Pin<Box_<dyn std::future::Future<Output = Result<DBusProxy, glib::Error>> + 'static>> {
247        let info = info.map(ToOwned::to_owned);
248        let name = String::from(name);
249        let object_path = String::from(object_path);
250        let interface_name = String::from(interface_name);
251        Box_::pin(crate::GioFuture::new(
252            &(),
253            move |_obj, cancellable, send| {
254                Self::for_bus(
255                    bus_type,
256                    flags,
257                    info.as_ref().map(::std::borrow::Borrow::borrow),
258                    &name,
259                    &object_path,
260                    &interface_name,
261                    Some(cancellable),
262                    move |res| {
263                        send.resolve(res);
264                    },
265                );
266            },
267        ))
268    }
269}
270
271unsafe impl Send for DBusProxy {}
272unsafe impl Sync for DBusProxy {}
273
274pub trait DBusProxyExt: IsA<DBusProxy> + 'static {
275    #[doc(alias = "g_dbus_proxy_call")]
276    fn call<P: FnOnce(Result<glib::Variant, glib::Error>) + 'static>(
277        &self,
278        method_name: &str,
279        parameters: Option<&glib::Variant>,
280        flags: DBusCallFlags,
281        timeout_msec: i32,
282        cancellable: Option<&impl IsA<Cancellable>>,
283        callback: P,
284    ) {
285        let main_context = glib::MainContext::ref_thread_default();
286        let is_main_context_owner = main_context.is_owner();
287        let has_acquired_main_context = (!is_main_context_owner)
288            .then(|| main_context.acquire().ok())
289            .flatten();
290        assert!(
291            is_main_context_owner || has_acquired_main_context.is_some(),
292            "Async operations only allowed if the thread is owning the MainContext"
293        );
294
295        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
296            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
297        unsafe extern "C" fn call_trampoline<
298            P: FnOnce(Result<glib::Variant, glib::Error>) + 'static,
299        >(
300            _source_object: *mut glib::gobject_ffi::GObject,
301            res: *mut crate::ffi::GAsyncResult,
302            user_data: glib::ffi::gpointer,
303        ) {
304            let mut error = std::ptr::null_mut();
305            let ret = ffi::g_dbus_proxy_call_finish(_source_object as *mut _, res, &mut error);
306            let result = if error.is_null() {
307                Ok(from_glib_full(ret))
308            } else {
309                Err(from_glib_full(error))
310            };
311            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
312                Box_::from_raw(user_data as *mut _);
313            let callback: P = callback.into_inner();
314            callback(result);
315        }
316        let callback = call_trampoline::<P>;
317        unsafe {
318            ffi::g_dbus_proxy_call(
319                self.as_ref().to_glib_none().0,
320                method_name.to_glib_none().0,
321                parameters.to_glib_none().0,
322                flags.into_glib(),
323                timeout_msec,
324                cancellable.map(|p| p.as_ref()).to_glib_none().0,
325                Some(callback),
326                Box_::into_raw(user_data) as *mut _,
327            );
328        }
329    }
330
331    fn call_future(
332        &self,
333        method_name: &str,
334        parameters: Option<&glib::Variant>,
335        flags: DBusCallFlags,
336        timeout_msec: i32,
337    ) -> Pin<Box_<dyn std::future::Future<Output = Result<glib::Variant, glib::Error>> + 'static>>
338    {
339        let method_name = String::from(method_name);
340        let parameters = parameters.map(ToOwned::to_owned);
341        Box_::pin(crate::GioFuture::new(
342            self,
343            move |obj, cancellable, send| {
344                obj.call(
345                    &method_name,
346                    parameters.as_ref().map(::std::borrow::Borrow::borrow),
347                    flags,
348                    timeout_msec,
349                    Some(cancellable),
350                    move |res| {
351                        send.resolve(res);
352                    },
353                );
354            },
355        ))
356    }
357
358    #[doc(alias = "g_dbus_proxy_call_sync")]
359    fn call_sync(
360        &self,
361        method_name: &str,
362        parameters: Option<&glib::Variant>,
363        flags: DBusCallFlags,
364        timeout_msec: i32,
365        cancellable: Option<&impl IsA<Cancellable>>,
366    ) -> Result<glib::Variant, glib::Error> {
367        unsafe {
368            let mut error = std::ptr::null_mut();
369            let ret = ffi::g_dbus_proxy_call_sync(
370                self.as_ref().to_glib_none().0,
371                method_name.to_glib_none().0,
372                parameters.to_glib_none().0,
373                flags.into_glib(),
374                timeout_msec,
375                cancellable.map(|p| p.as_ref()).to_glib_none().0,
376                &mut error,
377            );
378            if error.is_null() {
379                Ok(from_glib_full(ret))
380            } else {
381                Err(from_glib_full(error))
382            }
383        }
384    }
385
386    #[cfg(unix)]
387    #[cfg_attr(docsrs, doc(cfg(unix)))]
388    #[doc(alias = "g_dbus_proxy_call_with_unix_fd_list")]
389    fn call_with_unix_fd_list<
390        P: FnOnce(Result<(glib::Variant, Option<UnixFDList>), glib::Error>) + 'static,
391    >(
392        &self,
393        method_name: &str,
394        parameters: Option<&glib::Variant>,
395        flags: DBusCallFlags,
396        timeout_msec: i32,
397        fd_list: Option<&impl IsA<UnixFDList>>,
398        cancellable: Option<&impl IsA<Cancellable>>,
399        callback: P,
400    ) {
401        let main_context = glib::MainContext::ref_thread_default();
402        let is_main_context_owner = main_context.is_owner();
403        let has_acquired_main_context = (!is_main_context_owner)
404            .then(|| main_context.acquire().ok())
405            .flatten();
406        assert!(
407            is_main_context_owner || has_acquired_main_context.is_some(),
408            "Async operations only allowed if the thread is owning the MainContext"
409        );
410
411        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
412            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
413        unsafe extern "C" fn call_with_unix_fd_list_trampoline<
414            P: FnOnce(Result<(glib::Variant, Option<UnixFDList>), glib::Error>) + 'static,
415        >(
416            _source_object: *mut glib::gobject_ffi::GObject,
417            res: *mut crate::ffi::GAsyncResult,
418            user_data: glib::ffi::gpointer,
419        ) {
420            let mut error = std::ptr::null_mut();
421            let mut out_fd_list = std::ptr::null_mut();
422            let ret = ffi::g_dbus_proxy_call_with_unix_fd_list_finish(
423                _source_object as *mut _,
424                &mut out_fd_list,
425                res,
426                &mut error,
427            );
428            let result = if error.is_null() {
429                Ok((from_glib_full(ret), from_glib_full(out_fd_list)))
430            } else {
431                Err(from_glib_full(error))
432            };
433            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
434                Box_::from_raw(user_data as *mut _);
435            let callback: P = callback.into_inner();
436            callback(result);
437        }
438        let callback = call_with_unix_fd_list_trampoline::<P>;
439        unsafe {
440            ffi::g_dbus_proxy_call_with_unix_fd_list(
441                self.as_ref().to_glib_none().0,
442                method_name.to_glib_none().0,
443                parameters.to_glib_none().0,
444                flags.into_glib(),
445                timeout_msec,
446                fd_list.map(|p| p.as_ref()).to_glib_none().0,
447                cancellable.map(|p| p.as_ref()).to_glib_none().0,
448                Some(callback),
449                Box_::into_raw(user_data) as *mut _,
450            );
451        }
452    }
453
454    #[cfg(unix)]
455    #[cfg_attr(docsrs, doc(cfg(unix)))]
456    fn call_with_unix_fd_list_future(
457        &self,
458        method_name: &str,
459        parameters: Option<&glib::Variant>,
460        flags: DBusCallFlags,
461        timeout_msec: i32,
462        fd_list: Option<&(impl IsA<UnixFDList> + Clone + 'static)>,
463    ) -> Pin<
464        Box_<
465            dyn std::future::Future<
466                    Output = Result<(glib::Variant, Option<UnixFDList>), glib::Error>,
467                > + 'static,
468        >,
469    > {
470        let method_name = String::from(method_name);
471        let parameters = parameters.map(ToOwned::to_owned);
472        let fd_list = fd_list.map(ToOwned::to_owned);
473        Box_::pin(crate::GioFuture::new(
474            self,
475            move |obj, cancellable, send| {
476                obj.call_with_unix_fd_list(
477                    &method_name,
478                    parameters.as_ref().map(::std::borrow::Borrow::borrow),
479                    flags,
480                    timeout_msec,
481                    fd_list.as_ref().map(::std::borrow::Borrow::borrow),
482                    Some(cancellable),
483                    move |res| {
484                        send.resolve(res);
485                    },
486                );
487            },
488        ))
489    }
490
491    #[cfg(unix)]
492    #[cfg_attr(docsrs, doc(cfg(unix)))]
493    #[doc(alias = "g_dbus_proxy_call_with_unix_fd_list_sync")]
494    fn call_with_unix_fd_list_sync(
495        &self,
496        method_name: &str,
497        parameters: Option<&glib::Variant>,
498        flags: DBusCallFlags,
499        timeout_msec: i32,
500        fd_list: Option<&impl IsA<UnixFDList>>,
501        cancellable: Option<&impl IsA<Cancellable>>,
502    ) -> Result<(glib::Variant, Option<UnixFDList>), glib::Error> {
503        unsafe {
504            let mut out_fd_list = std::ptr::null_mut();
505            let mut error = std::ptr::null_mut();
506            let ret = ffi::g_dbus_proxy_call_with_unix_fd_list_sync(
507                self.as_ref().to_glib_none().0,
508                method_name.to_glib_none().0,
509                parameters.to_glib_none().0,
510                flags.into_glib(),
511                timeout_msec,
512                fd_list.map(|p| p.as_ref()).to_glib_none().0,
513                &mut out_fd_list,
514                cancellable.map(|p| p.as_ref()).to_glib_none().0,
515                &mut error,
516            );
517            if error.is_null() {
518                Ok((from_glib_full(ret), from_glib_full(out_fd_list)))
519            } else {
520                Err(from_glib_full(error))
521            }
522        }
523    }
524
525    #[doc(alias = "g_dbus_proxy_get_cached_property")]
526    #[doc(alias = "get_cached_property")]
527    fn cached_property(&self, property_name: &str) -> Option<glib::Variant> {
528        unsafe {
529            from_glib_full(ffi::g_dbus_proxy_get_cached_property(
530                self.as_ref().to_glib_none().0,
531                property_name.to_glib_none().0,
532            ))
533        }
534    }
535
536    #[doc(alias = "g_dbus_proxy_get_cached_property_names")]
537    #[doc(alias = "get_cached_property_names")]
538    fn cached_property_names(&self) -> Vec<glib::GString> {
539        unsafe {
540            FromGlibPtrContainer::from_glib_full(ffi::g_dbus_proxy_get_cached_property_names(
541                self.as_ref().to_glib_none().0,
542            ))
543        }
544    }
545
546    #[doc(alias = "g_dbus_proxy_get_connection")]
547    #[doc(alias = "get_connection")]
548    fn connection(&self) -> DBusConnection {
549        unsafe {
550            from_glib_none(ffi::g_dbus_proxy_get_connection(
551                self.as_ref().to_glib_none().0,
552            ))
553        }
554    }
555
556    #[doc(alias = "g_dbus_proxy_get_default_timeout")]
557    #[doc(alias = "get_default_timeout")]
558    fn default_timeout(&self) -> i32 {
559        unsafe { ffi::g_dbus_proxy_get_default_timeout(self.as_ref().to_glib_none().0) }
560    }
561
562    #[doc(alias = "g_dbus_proxy_get_flags")]
563    #[doc(alias = "get_flags")]
564    fn flags(&self) -> DBusProxyFlags {
565        unsafe { from_glib(ffi::g_dbus_proxy_get_flags(self.as_ref().to_glib_none().0)) }
566    }
567
568    #[doc(alias = "g_dbus_proxy_get_interface_info")]
569    #[doc(alias = "get_interface_info")]
570    fn interface_info(&self) -> Option<DBusInterfaceInfo> {
571        unsafe {
572            from_glib_none(ffi::g_dbus_proxy_get_interface_info(
573                self.as_ref().to_glib_none().0,
574            ))
575        }
576    }
577
578    #[doc(alias = "g_dbus_proxy_get_interface_name")]
579    #[doc(alias = "get_interface_name")]
580    fn interface_name(&self) -> glib::GString {
581        unsafe {
582            from_glib_none(ffi::g_dbus_proxy_get_interface_name(
583                self.as_ref().to_glib_none().0,
584            ))
585        }
586    }
587
588    #[doc(alias = "g_dbus_proxy_get_name")]
589    #[doc(alias = "get_name")]
590    fn name(&self) -> Option<glib::GString> {
591        unsafe { from_glib_none(ffi::g_dbus_proxy_get_name(self.as_ref().to_glib_none().0)) }
592    }
593
594    #[doc(alias = "g_dbus_proxy_get_name_owner")]
595    #[doc(alias = "get_name_owner")]
596    fn name_owner(&self) -> Option<glib::GString> {
597        unsafe {
598            from_glib_full(ffi::g_dbus_proxy_get_name_owner(
599                self.as_ref().to_glib_none().0,
600            ))
601        }
602    }
603
604    #[doc(alias = "g_dbus_proxy_get_object_path")]
605    #[doc(alias = "get_object_path")]
606    fn object_path(&self) -> glib::GString {
607        unsafe {
608            from_glib_none(ffi::g_dbus_proxy_get_object_path(
609                self.as_ref().to_glib_none().0,
610            ))
611        }
612    }
613
614    #[doc(alias = "g_dbus_proxy_set_cached_property")]
615    fn set_cached_property(&self, property_name: &str, value: Option<&glib::Variant>) {
616        unsafe {
617            ffi::g_dbus_proxy_set_cached_property(
618                self.as_ref().to_glib_none().0,
619                property_name.to_glib_none().0,
620                value.to_glib_none().0,
621            );
622        }
623    }
624
625    #[doc(alias = "g_dbus_proxy_set_default_timeout")]
626    fn set_default_timeout(&self, timeout_msec: i32) {
627        unsafe {
628            ffi::g_dbus_proxy_set_default_timeout(self.as_ref().to_glib_none().0, timeout_msec);
629        }
630    }
631
632    #[doc(alias = "g_dbus_proxy_set_interface_info")]
633    fn set_interface_info(&self, info: Option<&DBusInterfaceInfo>) {
634        unsafe {
635            ffi::g_dbus_proxy_set_interface_info(
636                self.as_ref().to_glib_none().0,
637                info.to_glib_none().0,
638            );
639        }
640    }
641
642    #[doc(alias = "g-connection")]
643    fn g_connection(&self) -> Option<DBusConnection> {
644        ObjectExt::property(self.as_ref(), "g-connection")
645    }
646
647    #[doc(alias = "g-default-timeout")]
648    fn g_default_timeout(&self) -> i32 {
649        ObjectExt::property(self.as_ref(), "g-default-timeout")
650    }
651
652    #[doc(alias = "g-default-timeout")]
653    fn set_g_default_timeout(&self, g_default_timeout: i32) {
654        ObjectExt::set_property(self.as_ref(), "g-default-timeout", g_default_timeout)
655    }
656
657    #[doc(alias = "g-flags")]
658    fn g_flags(&self) -> DBusProxyFlags {
659        ObjectExt::property(self.as_ref(), "g-flags")
660    }
661
662    #[doc(alias = "g-interface-info")]
663    fn g_interface_info(&self) -> Option<DBusInterfaceInfo> {
664        ObjectExt::property(self.as_ref(), "g-interface-info")
665    }
666
667    #[doc(alias = "g-interface-info")]
668    fn set_g_interface_info(&self, g_interface_info: Option<&DBusInterfaceInfo>) {
669        ObjectExt::set_property(self.as_ref(), "g-interface-info", g_interface_info)
670    }
671
672    #[doc(alias = "g-interface-name")]
673    fn g_interface_name(&self) -> Option<glib::GString> {
674        ObjectExt::property(self.as_ref(), "g-interface-name")
675    }
676
677    #[doc(alias = "g-name")]
678    fn g_name(&self) -> Option<glib::GString> {
679        ObjectExt::property(self.as_ref(), "g-name")
680    }
681
682    #[doc(alias = "g-name-owner")]
683    fn g_name_owner(&self) -> Option<glib::GString> {
684        ObjectExt::property(self.as_ref(), "g-name-owner")
685    }
686
687    #[doc(alias = "g-object-path")]
688    fn g_object_path(&self) -> Option<glib::GString> {
689        ObjectExt::property(self.as_ref(), "g-object-path")
690    }
691
692    #[doc(alias = "g-default-timeout")]
693    fn connect_g_default_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(
694        &self,
695        f: F,
696    ) -> SignalHandlerId {
697        unsafe extern "C" fn notify_g_default_timeout_trampoline<
698            P: IsA<DBusProxy>,
699            F: Fn(&P) + Send + Sync + 'static,
700        >(
701            this: *mut ffi::GDBusProxy,
702            _param_spec: glib::ffi::gpointer,
703            f: glib::ffi::gpointer,
704        ) {
705            let f: &F = &*(f as *const F);
706            f(DBusProxy::from_glib_borrow(this).unsafe_cast_ref())
707        }
708        unsafe {
709            let f: Box_<F> = Box_::new(f);
710            connect_raw(
711                self.as_ptr() as *mut _,
712                c"notify::g-default-timeout".as_ptr() as *const _,
713                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
714                    notify_g_default_timeout_trampoline::<Self, F> as *const (),
715                )),
716                Box_::into_raw(f),
717            )
718        }
719    }
720
721    #[doc(alias = "g-interface-info")]
722    fn connect_g_interface_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
723        &self,
724        f: F,
725    ) -> SignalHandlerId {
726        unsafe extern "C" fn notify_g_interface_info_trampoline<
727            P: IsA<DBusProxy>,
728            F: Fn(&P) + Send + Sync + 'static,
729        >(
730            this: *mut ffi::GDBusProxy,
731            _param_spec: glib::ffi::gpointer,
732            f: glib::ffi::gpointer,
733        ) {
734            let f: &F = &*(f as *const F);
735            f(DBusProxy::from_glib_borrow(this).unsafe_cast_ref())
736        }
737        unsafe {
738            let f: Box_<F> = Box_::new(f);
739            connect_raw(
740                self.as_ptr() as *mut _,
741                c"notify::g-interface-info".as_ptr() as *const _,
742                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
743                    notify_g_interface_info_trampoline::<Self, F> as *const (),
744                )),
745                Box_::into_raw(f),
746            )
747        }
748    }
749
750    #[doc(alias = "g-name-owner")]
751    fn connect_g_name_owner_notify<F: Fn(&Self) + Send + Sync + 'static>(
752        &self,
753        f: F,
754    ) -> SignalHandlerId {
755        unsafe extern "C" fn notify_g_name_owner_trampoline<
756            P: IsA<DBusProxy>,
757            F: Fn(&P) + Send + Sync + 'static,
758        >(
759            this: *mut ffi::GDBusProxy,
760            _param_spec: glib::ffi::gpointer,
761            f: glib::ffi::gpointer,
762        ) {
763            let f: &F = &*(f as *const F);
764            f(DBusProxy::from_glib_borrow(this).unsafe_cast_ref())
765        }
766        unsafe {
767            let f: Box_<F> = Box_::new(f);
768            connect_raw(
769                self.as_ptr() as *mut _,
770                c"notify::g-name-owner".as_ptr() as *const _,
771                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
772                    notify_g_name_owner_trampoline::<Self, F> as *const (),
773                )),
774                Box_::into_raw(f),
775            )
776        }
777    }
778}
779
780impl<O: IsA<DBusProxy>> DBusProxyExt for O {}