1#[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
274mod sealed {
275 pub trait Sealed {}
276 impl<T: super::IsA<super::DBusProxy>> Sealed for T {}
277}
278
279pub trait DBusProxyExt: IsA<DBusProxy> + sealed::Sealed + 'static {
280 #[doc(alias = "g_dbus_proxy_call")]
281 fn call<P: FnOnce(Result<glib::Variant, glib::Error>) + 'static>(
282 &self,
283 method_name: &str,
284 parameters: Option<&glib::Variant>,
285 flags: DBusCallFlags,
286 timeout_msec: i32,
287 cancellable: Option<&impl IsA<Cancellable>>,
288 callback: P,
289 ) {
290 let main_context = glib::MainContext::ref_thread_default();
291 let is_main_context_owner = main_context.is_owner();
292 let has_acquired_main_context = (!is_main_context_owner)
293 .then(|| main_context.acquire().ok())
294 .flatten();
295 assert!(
296 is_main_context_owner || has_acquired_main_context.is_some(),
297 "Async operations only allowed if the thread is owning the MainContext"
298 );
299
300 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
301 Box_::new(glib::thread_guard::ThreadGuard::new(callback));
302 unsafe extern "C" fn call_trampoline<
303 P: FnOnce(Result<glib::Variant, glib::Error>) + 'static,
304 >(
305 _source_object: *mut glib::gobject_ffi::GObject,
306 res: *mut crate::ffi::GAsyncResult,
307 user_data: glib::ffi::gpointer,
308 ) {
309 let mut error = std::ptr::null_mut();
310 let ret = ffi::g_dbus_proxy_call_finish(_source_object as *mut _, res, &mut error);
311 let result = if error.is_null() {
312 Ok(from_glib_full(ret))
313 } else {
314 Err(from_glib_full(error))
315 };
316 let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
317 Box_::from_raw(user_data as *mut _);
318 let callback: P = callback.into_inner();
319 callback(result);
320 }
321 let callback = call_trampoline::<P>;
322 unsafe {
323 ffi::g_dbus_proxy_call(
324 self.as_ref().to_glib_none().0,
325 method_name.to_glib_none().0,
326 parameters.to_glib_none().0,
327 flags.into_glib(),
328 timeout_msec,
329 cancellable.map(|p| p.as_ref()).to_glib_none().0,
330 Some(callback),
331 Box_::into_raw(user_data) as *mut _,
332 );
333 }
334 }
335
336 fn call_future(
337 &self,
338 method_name: &str,
339 parameters: Option<&glib::Variant>,
340 flags: DBusCallFlags,
341 timeout_msec: i32,
342 ) -> Pin<Box_<dyn std::future::Future<Output = Result<glib::Variant, glib::Error>> + 'static>>
343 {
344 let method_name = String::from(method_name);
345 let parameters = parameters.map(ToOwned::to_owned);
346 Box_::pin(crate::GioFuture::new(
347 self,
348 move |obj, cancellable, send| {
349 obj.call(
350 &method_name,
351 parameters.as_ref().map(::std::borrow::Borrow::borrow),
352 flags,
353 timeout_msec,
354 Some(cancellable),
355 move |res| {
356 send.resolve(res);
357 },
358 );
359 },
360 ))
361 }
362
363 #[doc(alias = "g_dbus_proxy_call_sync")]
364 fn call_sync(
365 &self,
366 method_name: &str,
367 parameters: Option<&glib::Variant>,
368 flags: DBusCallFlags,
369 timeout_msec: i32,
370 cancellable: Option<&impl IsA<Cancellable>>,
371 ) -> Result<glib::Variant, glib::Error> {
372 unsafe {
373 let mut error = std::ptr::null_mut();
374 let ret = ffi::g_dbus_proxy_call_sync(
375 self.as_ref().to_glib_none().0,
376 method_name.to_glib_none().0,
377 parameters.to_glib_none().0,
378 flags.into_glib(),
379 timeout_msec,
380 cancellable.map(|p| p.as_ref()).to_glib_none().0,
381 &mut error,
382 );
383 if error.is_null() {
384 Ok(from_glib_full(ret))
385 } else {
386 Err(from_glib_full(error))
387 }
388 }
389 }
390
391 #[cfg(unix)]
392 #[cfg_attr(docsrs, doc(cfg(unix)))]
393 #[doc(alias = "g_dbus_proxy_call_with_unix_fd_list")]
394 fn call_with_unix_fd_list<
395 P: FnOnce(Result<(glib::Variant, Option<UnixFDList>), glib::Error>) + 'static,
396 >(
397 &self,
398 method_name: &str,
399 parameters: Option<&glib::Variant>,
400 flags: DBusCallFlags,
401 timeout_msec: i32,
402 fd_list: Option<&impl IsA<UnixFDList>>,
403 cancellable: Option<&impl IsA<Cancellable>>,
404 callback: P,
405 ) {
406 let main_context = glib::MainContext::ref_thread_default();
407 let is_main_context_owner = main_context.is_owner();
408 let has_acquired_main_context = (!is_main_context_owner)
409 .then(|| main_context.acquire().ok())
410 .flatten();
411 assert!(
412 is_main_context_owner || has_acquired_main_context.is_some(),
413 "Async operations only allowed if the thread is owning the MainContext"
414 );
415
416 let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
417 Box_::new(glib::thread_guard::ThreadGuard::new(callback));
418 unsafe extern "C" fn call_with_unix_fd_list_trampoline<
419 P: FnOnce(Result<(glib::Variant, Option<UnixFDList>), glib::Error>) + 'static,
420 >(
421 _source_object: *mut glib::gobject_ffi::GObject,
422 res: *mut crate::ffi::GAsyncResult,
423 user_data: glib::ffi::gpointer,
424 ) {
425 let mut error = std::ptr::null_mut();
426 let mut out_fd_list = std::ptr::null_mut();
427 let ret = ffi::g_dbus_proxy_call_with_unix_fd_list_finish(
428 _source_object as *mut _,
429 &mut out_fd_list,
430 res,
431 &mut error,
432 );
433 let result = if error.is_null() {
434 Ok((from_glib_full(ret), from_glib_full(out_fd_list)))
435 } else {
436 Err(from_glib_full(error))
437 };
438 let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
439 Box_::from_raw(user_data as *mut _);
440 let callback: P = callback.into_inner();
441 callback(result);
442 }
443 let callback = call_with_unix_fd_list_trampoline::<P>;
444 unsafe {
445 ffi::g_dbus_proxy_call_with_unix_fd_list(
446 self.as_ref().to_glib_none().0,
447 method_name.to_glib_none().0,
448 parameters.to_glib_none().0,
449 flags.into_glib(),
450 timeout_msec,
451 fd_list.map(|p| p.as_ref()).to_glib_none().0,
452 cancellable.map(|p| p.as_ref()).to_glib_none().0,
453 Some(callback),
454 Box_::into_raw(user_data) as *mut _,
455 );
456 }
457 }
458
459 #[cfg(unix)]
460 #[cfg_attr(docsrs, doc(cfg(unix)))]
461 fn call_with_unix_fd_list_future(
462 &self,
463 method_name: &str,
464 parameters: Option<&glib::Variant>,
465 flags: DBusCallFlags,
466 timeout_msec: i32,
467 fd_list: Option<&(impl IsA<UnixFDList> + Clone + 'static)>,
468 ) -> Pin<
469 Box_<
470 dyn std::future::Future<
471 Output = Result<(glib::Variant, Option<UnixFDList>), glib::Error>,
472 > + 'static,
473 >,
474 > {
475 let method_name = String::from(method_name);
476 let parameters = parameters.map(ToOwned::to_owned);
477 let fd_list = fd_list.map(ToOwned::to_owned);
478 Box_::pin(crate::GioFuture::new(
479 self,
480 move |obj, cancellable, send| {
481 obj.call_with_unix_fd_list(
482 &method_name,
483 parameters.as_ref().map(::std::borrow::Borrow::borrow),
484 flags,
485 timeout_msec,
486 fd_list.as_ref().map(::std::borrow::Borrow::borrow),
487 Some(cancellable),
488 move |res| {
489 send.resolve(res);
490 },
491 );
492 },
493 ))
494 }
495
496 #[cfg(unix)]
497 #[cfg_attr(docsrs, doc(cfg(unix)))]
498 #[doc(alias = "g_dbus_proxy_call_with_unix_fd_list_sync")]
499 fn call_with_unix_fd_list_sync(
500 &self,
501 method_name: &str,
502 parameters: Option<&glib::Variant>,
503 flags: DBusCallFlags,
504 timeout_msec: i32,
505 fd_list: Option<&impl IsA<UnixFDList>>,
506 cancellable: Option<&impl IsA<Cancellable>>,
507 ) -> Result<(glib::Variant, Option<UnixFDList>), glib::Error> {
508 unsafe {
509 let mut out_fd_list = std::ptr::null_mut();
510 let mut error = std::ptr::null_mut();
511 let ret = ffi::g_dbus_proxy_call_with_unix_fd_list_sync(
512 self.as_ref().to_glib_none().0,
513 method_name.to_glib_none().0,
514 parameters.to_glib_none().0,
515 flags.into_glib(),
516 timeout_msec,
517 fd_list.map(|p| p.as_ref()).to_glib_none().0,
518 &mut out_fd_list,
519 cancellable.map(|p| p.as_ref()).to_glib_none().0,
520 &mut error,
521 );
522 if error.is_null() {
523 Ok((from_glib_full(ret), from_glib_full(out_fd_list)))
524 } else {
525 Err(from_glib_full(error))
526 }
527 }
528 }
529
530 #[doc(alias = "g_dbus_proxy_get_cached_property")]
531 #[doc(alias = "get_cached_property")]
532 fn cached_property(&self, property_name: &str) -> Option<glib::Variant> {
533 unsafe {
534 from_glib_full(ffi::g_dbus_proxy_get_cached_property(
535 self.as_ref().to_glib_none().0,
536 property_name.to_glib_none().0,
537 ))
538 }
539 }
540
541 #[doc(alias = "g_dbus_proxy_get_cached_property_names")]
542 #[doc(alias = "get_cached_property_names")]
543 fn cached_property_names(&self) -> Vec<glib::GString> {
544 unsafe {
545 FromGlibPtrContainer::from_glib_full(ffi::g_dbus_proxy_get_cached_property_names(
546 self.as_ref().to_glib_none().0,
547 ))
548 }
549 }
550
551 #[doc(alias = "g_dbus_proxy_get_connection")]
552 #[doc(alias = "get_connection")]
553 fn connection(&self) -> DBusConnection {
554 unsafe {
555 from_glib_none(ffi::g_dbus_proxy_get_connection(
556 self.as_ref().to_glib_none().0,
557 ))
558 }
559 }
560
561 #[doc(alias = "g_dbus_proxy_get_default_timeout")]
562 #[doc(alias = "get_default_timeout")]
563 fn default_timeout(&self) -> i32 {
564 unsafe { ffi::g_dbus_proxy_get_default_timeout(self.as_ref().to_glib_none().0) }
565 }
566
567 #[doc(alias = "g_dbus_proxy_get_flags")]
568 #[doc(alias = "get_flags")]
569 fn flags(&self) -> DBusProxyFlags {
570 unsafe { from_glib(ffi::g_dbus_proxy_get_flags(self.as_ref().to_glib_none().0)) }
571 }
572
573 #[doc(alias = "g_dbus_proxy_get_interface_info")]
574 #[doc(alias = "get_interface_info")]
575 fn interface_info(&self) -> Option<DBusInterfaceInfo> {
576 unsafe {
577 from_glib_none(ffi::g_dbus_proxy_get_interface_info(
578 self.as_ref().to_glib_none().0,
579 ))
580 }
581 }
582
583 #[doc(alias = "g_dbus_proxy_get_interface_name")]
584 #[doc(alias = "get_interface_name")]
585 fn interface_name(&self) -> glib::GString {
586 unsafe {
587 from_glib_none(ffi::g_dbus_proxy_get_interface_name(
588 self.as_ref().to_glib_none().0,
589 ))
590 }
591 }
592
593 #[doc(alias = "g_dbus_proxy_get_name")]
594 #[doc(alias = "get_name")]
595 fn name(&self) -> Option<glib::GString> {
596 unsafe { from_glib_none(ffi::g_dbus_proxy_get_name(self.as_ref().to_glib_none().0)) }
597 }
598
599 #[doc(alias = "g_dbus_proxy_get_name_owner")]
600 #[doc(alias = "get_name_owner")]
601 fn name_owner(&self) -> Option<glib::GString> {
602 unsafe {
603 from_glib_full(ffi::g_dbus_proxy_get_name_owner(
604 self.as_ref().to_glib_none().0,
605 ))
606 }
607 }
608
609 #[doc(alias = "g_dbus_proxy_get_object_path")]
610 #[doc(alias = "get_object_path")]
611 fn object_path(&self) -> glib::GString {
612 unsafe {
613 from_glib_none(ffi::g_dbus_proxy_get_object_path(
614 self.as_ref().to_glib_none().0,
615 ))
616 }
617 }
618
619 #[doc(alias = "g_dbus_proxy_set_cached_property")]
620 fn set_cached_property(&self, property_name: &str, value: Option<&glib::Variant>) {
621 unsafe {
622 ffi::g_dbus_proxy_set_cached_property(
623 self.as_ref().to_glib_none().0,
624 property_name.to_glib_none().0,
625 value.to_glib_none().0,
626 );
627 }
628 }
629
630 #[doc(alias = "g_dbus_proxy_set_default_timeout")]
631 fn set_default_timeout(&self, timeout_msec: i32) {
632 unsafe {
633 ffi::g_dbus_proxy_set_default_timeout(self.as_ref().to_glib_none().0, timeout_msec);
634 }
635 }
636
637 #[doc(alias = "g_dbus_proxy_set_interface_info")]
638 fn set_interface_info(&self, info: Option<&DBusInterfaceInfo>) {
639 unsafe {
640 ffi::g_dbus_proxy_set_interface_info(
641 self.as_ref().to_glib_none().0,
642 info.to_glib_none().0,
643 );
644 }
645 }
646
647 #[doc(alias = "g-connection")]
648 fn g_connection(&self) -> Option<DBusConnection> {
649 ObjectExt::property(self.as_ref(), "g-connection")
650 }
651
652 #[doc(alias = "g-default-timeout")]
653 fn g_default_timeout(&self) -> i32 {
654 ObjectExt::property(self.as_ref(), "g-default-timeout")
655 }
656
657 #[doc(alias = "g-default-timeout")]
658 fn set_g_default_timeout(&self, g_default_timeout: i32) {
659 ObjectExt::set_property(self.as_ref(), "g-default-timeout", g_default_timeout)
660 }
661
662 #[doc(alias = "g-flags")]
663 fn g_flags(&self) -> DBusProxyFlags {
664 ObjectExt::property(self.as_ref(), "g-flags")
665 }
666
667 #[doc(alias = "g-interface-info")]
668 fn g_interface_info(&self) -> Option<DBusInterfaceInfo> {
669 ObjectExt::property(self.as_ref(), "g-interface-info")
670 }
671
672 #[doc(alias = "g-interface-info")]
673 fn set_g_interface_info(&self, g_interface_info: Option<&DBusInterfaceInfo>) {
674 ObjectExt::set_property(self.as_ref(), "g-interface-info", g_interface_info)
675 }
676
677 #[doc(alias = "g-interface-name")]
678 fn g_interface_name(&self) -> Option<glib::GString> {
679 ObjectExt::property(self.as_ref(), "g-interface-name")
680 }
681
682 #[doc(alias = "g-name")]
683 fn g_name(&self) -> Option<glib::GString> {
684 ObjectExt::property(self.as_ref(), "g-name")
685 }
686
687 #[doc(alias = "g-name-owner")]
688 fn g_name_owner(&self) -> Option<glib::GString> {
689 ObjectExt::property(self.as_ref(), "g-name-owner")
690 }
691
692 #[doc(alias = "g-object-path")]
693 fn g_object_path(&self) -> Option<glib::GString> {
694 ObjectExt::property(self.as_ref(), "g-object-path")
695 }
696
697 #[doc(alias = "g-default-timeout")]
698 fn connect_g_default_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(
699 &self,
700 f: F,
701 ) -> SignalHandlerId {
702 unsafe extern "C" fn notify_g_default_timeout_trampoline<
703 P: IsA<DBusProxy>,
704 F: Fn(&P) + Send + Sync + 'static,
705 >(
706 this: *mut ffi::GDBusProxy,
707 _param_spec: glib::ffi::gpointer,
708 f: glib::ffi::gpointer,
709 ) {
710 let f: &F = &*(f as *const F);
711 f(DBusProxy::from_glib_borrow(this).unsafe_cast_ref())
712 }
713 unsafe {
714 let f: Box_<F> = Box_::new(f);
715 connect_raw(
716 self.as_ptr() as *mut _,
717 b"notify::g-default-timeout\0".as_ptr() as *const _,
718 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
719 notify_g_default_timeout_trampoline::<Self, F> as *const (),
720 )),
721 Box_::into_raw(f),
722 )
723 }
724 }
725
726 #[doc(alias = "g-interface-info")]
727 fn connect_g_interface_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
728 &self,
729 f: F,
730 ) -> SignalHandlerId {
731 unsafe extern "C" fn notify_g_interface_info_trampoline<
732 P: IsA<DBusProxy>,
733 F: Fn(&P) + Send + Sync + 'static,
734 >(
735 this: *mut ffi::GDBusProxy,
736 _param_spec: glib::ffi::gpointer,
737 f: glib::ffi::gpointer,
738 ) {
739 let f: &F = &*(f as *const F);
740 f(DBusProxy::from_glib_borrow(this).unsafe_cast_ref())
741 }
742 unsafe {
743 let f: Box_<F> = Box_::new(f);
744 connect_raw(
745 self.as_ptr() as *mut _,
746 b"notify::g-interface-info\0".as_ptr() as *const _,
747 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
748 notify_g_interface_info_trampoline::<Self, F> as *const (),
749 )),
750 Box_::into_raw(f),
751 )
752 }
753 }
754
755 #[doc(alias = "g-name-owner")]
756 fn connect_g_name_owner_notify<F: Fn(&Self) + Send + Sync + 'static>(
757 &self,
758 f: F,
759 ) -> SignalHandlerId {
760 unsafe extern "C" fn notify_g_name_owner_trampoline<
761 P: IsA<DBusProxy>,
762 F: Fn(&P) + Send + Sync + 'static,
763 >(
764 this: *mut ffi::GDBusProxy,
765 _param_spec: glib::ffi::gpointer,
766 f: glib::ffi::gpointer,
767 ) {
768 let f: &F = &*(f as *const F);
769 f(DBusProxy::from_glib_borrow(this).unsafe_cast_ref())
770 }
771 unsafe {
772 let f: Box_<F> = Box_::new(f);
773 connect_raw(
774 self.as_ptr() as *mut _,
775 b"notify::g-name-owner\0".as_ptr() as *const _,
776 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
777 notify_g_name_owner_trampoline::<Self, F> as *const (),
778 )),
779 Box_::into_raw(f),
780 )
781 }
782 }
783}
784
785impl<O: IsA<DBusProxy>> DBusProxyExt for O {}