|
2 | 2 |
|
3 | 3 | use crate::{
|
4 | 4 | ffi, BusType, Cancellable, DBusConnection, DBusObjectManagerClient,
|
5 |
| - DBusObjectManagerClientFlags, GioFuture, |
| 5 | + DBusObjectManagerClientFlags, DBusObjectProxy, DBusProxy, GioFuture, |
6 | 6 | };
|
7 |
| -use glib::object::IsA; |
8 |
| -use glib::translate::{from_glib_borrow, from_glib_full, Borrowed, IntoGlib as _, ToGlibPtr as _}; |
| 7 | +use glib::object::{Cast as _, IsA}; |
| 8 | +use glib::signal::connect_raw; |
| 9 | +use glib::translate::{ |
| 10 | + from_glib_borrow, from_glib_full, Borrowed, FromGlibPtrBorrow as _, IntoGlib as _, |
| 11 | + ToGlibPtr as _, |
| 12 | +}; |
| 13 | +use glib::{SignalHandlerId, StrVRef}; |
9 | 14 | use std::future::Future;
|
10 | 15 | use std::pin::Pin;
|
11 | 16 |
|
@@ -473,3 +478,47 @@ impl DBusObjectManagerClient {
|
473 | 478 | }
|
474 | 479 | }
|
475 | 480 | }
|
| 481 | + |
| 482 | +pub trait DBusObjectManagerClientExtManual: IsA<DBusObjectManagerClient> + 'static { |
| 483 | + #[doc(alias = "interface-proxy-properties-changed")] |
| 484 | + fn connect_interface_proxy_properties_changed< |
| 485 | + F: Fn(&Self, &DBusObjectProxy, &DBusProxy, &glib::Variant, &StrVRef) + Send + Sync + 'static, |
| 486 | + >( |
| 487 | + &self, |
| 488 | + f: F, |
| 489 | + ) -> SignalHandlerId { |
| 490 | + unsafe extern "C" fn interface_proxy_properties_changed_trampoline< |
| 491 | + P: IsA<DBusObjectManagerClient>, |
| 492 | + F: Fn(&P, &DBusObjectProxy, &DBusProxy, &glib::Variant, &StrVRef) + Send + Sync + 'static, |
| 493 | + >( |
| 494 | + this: *mut ffi::GDBusObjectManagerClient, |
| 495 | + object_proxy: *mut ffi::GDBusObjectProxy, |
| 496 | + interface_proxy: *mut ffi::GDBusProxy, |
| 497 | + changed_properties: *mut glib::ffi::GVariant, |
| 498 | + invalidated_properties: *const *const std::ffi::c_char, |
| 499 | + f: glib::ffi::gpointer, |
| 500 | + ) { |
| 501 | + let f: &F = &*(f as *const F); |
| 502 | + f( |
| 503 | + DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref(), |
| 504 | + &from_glib_borrow(object_proxy), |
| 505 | + &from_glib_borrow(interface_proxy), |
| 506 | + &from_glib_borrow(changed_properties), |
| 507 | + StrVRef::from_glib_borrow(invalidated_properties), |
| 508 | + ) |
| 509 | + } |
| 510 | + unsafe { |
| 511 | + let f: Box<F> = Box::new(f); |
| 512 | + connect_raw( |
| 513 | + self.as_ptr() as *mut _, |
| 514 | + c"interface-proxy-properties-changed".as_ptr() as *const _, |
| 515 | + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 516 | + interface_proxy_properties_changed_trampoline::<Self, F> as *const (), |
| 517 | + )), |
| 518 | + Box::into_raw(f), |
| 519 | + ) |
| 520 | + } |
| 521 | + } |
| 522 | +} |
| 523 | + |
| 524 | +impl<O: IsA<DBusObjectManagerClient>> DBusObjectManagerClientExtManual for O {} |
0 commit comments