|
| 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 crate::{ |
| 6 | + ffi, AsyncInitable, AsyncResult, BusType, Cancellable, DBusConnection, DBusObjectManager, |
| 7 | + DBusObjectManagerClientFlags, DBusObjectProxy, DBusProxy, Initable, |
| 8 | +}; |
| 9 | +use glib::{ |
| 10 | + object::ObjectType as _, |
| 11 | + prelude::*, |
| 12 | + signal::{connect_raw, SignalHandlerId}, |
| 13 | + translate::*, |
| 14 | +}; |
| 15 | +use std::boxed::Box as Box_; |
| 16 | + |
| 17 | +glib::wrapper! { |
| 18 | + #[doc(alias = "GDBusObjectManagerClient")] |
| 19 | + pub struct DBusObjectManagerClient(Object<ffi::GDBusObjectManagerClient, ffi::GDBusObjectManagerClientClass>) @implements AsyncInitable, DBusObjectManager, Initable; |
| 20 | + |
| 21 | + match fn { |
| 22 | + type_ => || ffi::g_dbus_object_manager_client_get_type(), |
| 23 | + } |
| 24 | +} |
| 25 | + |
| 26 | +impl DBusObjectManagerClient { |
| 27 | + pub const NONE: Option<&'static DBusObjectManagerClient> = None; |
| 28 | + |
| 29 | + #[doc(alias = "g_dbus_object_manager_client_new_for_bus_sync")] |
| 30 | + #[doc(alias = "new_for_bus_sync")] |
| 31 | + pub fn for_bus_sync( |
| 32 | + bus_type: BusType, |
| 33 | + flags: DBusObjectManagerClientFlags, |
| 34 | + name: &str, |
| 35 | + object_path: &str, |
| 36 | + get_proxy_type_func: Option< |
| 37 | + Box_< |
| 38 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type + 'static, |
| 39 | + >, |
| 40 | + >, |
| 41 | + cancellable: Option<&impl IsA<Cancellable>>, |
| 42 | + ) -> Result<DBusObjectManagerClient, glib::Error> { |
| 43 | + let get_proxy_type_func_data: Box_< |
| 44 | + Option< |
| 45 | + Box_< |
| 46 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 47 | + + 'static, |
| 48 | + >, |
| 49 | + >, |
| 50 | + > = Box_::new(get_proxy_type_func); |
| 51 | + unsafe extern "C" fn get_proxy_type_func_func( |
| 52 | + manager: *mut ffi::GDBusObjectManagerClient, |
| 53 | + object_path: *const std::ffi::c_char, |
| 54 | + interface_name: *const std::ffi::c_char, |
| 55 | + data: glib::ffi::gpointer, |
| 56 | + ) -> glib::ffi::GType { |
| 57 | + let manager = from_glib_borrow(manager); |
| 58 | + let object_path: Borrowed<glib::GString> = from_glib_borrow(object_path); |
| 59 | + let interface_name: Borrowed<Option<glib::GString>> = from_glib_borrow(interface_name); |
| 60 | + let callback = &*(data as *mut Option< |
| 61 | + Box_< |
| 62 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 63 | + + 'static, |
| 64 | + >, |
| 65 | + >); |
| 66 | + if let Some(ref callback) = *callback { |
| 67 | + callback( |
| 68 | + &manager, |
| 69 | + object_path.as_str(), |
| 70 | + (*interface_name).as_ref().map(|s| s.as_str()), |
| 71 | + ) |
| 72 | + } else { |
| 73 | + panic!("cannot get closure...") |
| 74 | + } |
| 75 | + .into_glib() |
| 76 | + } |
| 77 | + let get_proxy_type_func = if get_proxy_type_func_data.is_some() { |
| 78 | + Some(get_proxy_type_func_func as _) |
| 79 | + } else { |
| 80 | + None |
| 81 | + }; |
| 82 | + unsafe extern "C" fn get_proxy_type_destroy_notify_func(data: glib::ffi::gpointer) { |
| 83 | + let _callback = Box_::from_raw( |
| 84 | + data as *mut Option< |
| 85 | + Box_< |
| 86 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 87 | + + 'static, |
| 88 | + >, |
| 89 | + >, |
| 90 | + ); |
| 91 | + } |
| 92 | + let destroy_call6 = Some(get_proxy_type_destroy_notify_func as _); |
| 93 | + let super_callback0: Box_< |
| 94 | + Option< |
| 95 | + Box_< |
| 96 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 97 | + + 'static, |
| 98 | + >, |
| 99 | + >, |
| 100 | + > = get_proxy_type_func_data; |
| 101 | + unsafe { |
| 102 | + let mut error = std::ptr::null_mut(); |
| 103 | + let ret = ffi::g_dbus_object_manager_client_new_for_bus_sync( |
| 104 | + bus_type.into_glib(), |
| 105 | + flags.into_glib(), |
| 106 | + name.to_glib_none().0, |
| 107 | + object_path.to_glib_none().0, |
| 108 | + get_proxy_type_func, |
| 109 | + Box_::into_raw(super_callback0) as *mut _, |
| 110 | + destroy_call6, |
| 111 | + cancellable.map(|p| p.as_ref()).to_glib_none().0, |
| 112 | + &mut error, |
| 113 | + ); |
| 114 | + if error.is_null() { |
| 115 | + Ok(from_glib_full(ret)) |
| 116 | + } else { |
| 117 | + Err(from_glib_full(error)) |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | + |
| 122 | + #[doc(alias = "g_dbus_object_manager_client_new_sync")] |
| 123 | + pub fn new_sync( |
| 124 | + connection: &DBusConnection, |
| 125 | + flags: DBusObjectManagerClientFlags, |
| 126 | + name: Option<&str>, |
| 127 | + object_path: &str, |
| 128 | + get_proxy_type_func: Option< |
| 129 | + Box_< |
| 130 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type + 'static, |
| 131 | + >, |
| 132 | + >, |
| 133 | + cancellable: Option<&impl IsA<Cancellable>>, |
| 134 | + ) -> Result<DBusObjectManagerClient, glib::Error> { |
| 135 | + let get_proxy_type_func_data: Box_< |
| 136 | + Option< |
| 137 | + Box_< |
| 138 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 139 | + + 'static, |
| 140 | + >, |
| 141 | + >, |
| 142 | + > = Box_::new(get_proxy_type_func); |
| 143 | + unsafe extern "C" fn get_proxy_type_func_func( |
| 144 | + manager: *mut ffi::GDBusObjectManagerClient, |
| 145 | + object_path: *const std::ffi::c_char, |
| 146 | + interface_name: *const std::ffi::c_char, |
| 147 | + data: glib::ffi::gpointer, |
| 148 | + ) -> glib::ffi::GType { |
| 149 | + let manager = from_glib_borrow(manager); |
| 150 | + let object_path: Borrowed<glib::GString> = from_glib_borrow(object_path); |
| 151 | + let interface_name: Borrowed<Option<glib::GString>> = from_glib_borrow(interface_name); |
| 152 | + let callback = &*(data as *mut Option< |
| 153 | + Box_< |
| 154 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 155 | + + 'static, |
| 156 | + >, |
| 157 | + >); |
| 158 | + if let Some(ref callback) = *callback { |
| 159 | + callback( |
| 160 | + &manager, |
| 161 | + object_path.as_str(), |
| 162 | + (*interface_name).as_ref().map(|s| s.as_str()), |
| 163 | + ) |
| 164 | + } else { |
| 165 | + panic!("cannot get closure...") |
| 166 | + } |
| 167 | + .into_glib() |
| 168 | + } |
| 169 | + let get_proxy_type_func = if get_proxy_type_func_data.is_some() { |
| 170 | + Some(get_proxy_type_func_func as _) |
| 171 | + } else { |
| 172 | + None |
| 173 | + }; |
| 174 | + unsafe extern "C" fn get_proxy_type_destroy_notify_func(data: glib::ffi::gpointer) { |
| 175 | + let _callback = Box_::from_raw( |
| 176 | + data as *mut Option< |
| 177 | + Box_< |
| 178 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 179 | + + 'static, |
| 180 | + >, |
| 181 | + >, |
| 182 | + ); |
| 183 | + } |
| 184 | + let destroy_call6 = Some(get_proxy_type_destroy_notify_func as _); |
| 185 | + let super_callback0: Box_< |
| 186 | + Option< |
| 187 | + Box_< |
| 188 | + dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type |
| 189 | + + 'static, |
| 190 | + >, |
| 191 | + >, |
| 192 | + > = get_proxy_type_func_data; |
| 193 | + unsafe { |
| 194 | + let mut error = std::ptr::null_mut(); |
| 195 | + let ret = ffi::g_dbus_object_manager_client_new_sync( |
| 196 | + connection.to_glib_none().0, |
| 197 | + flags.into_glib(), |
| 198 | + name.to_glib_none().0, |
| 199 | + object_path.to_glib_none().0, |
| 200 | + get_proxy_type_func, |
| 201 | + Box_::into_raw(super_callback0) as *mut _, |
| 202 | + destroy_call6, |
| 203 | + cancellable.map(|p| p.as_ref()).to_glib_none().0, |
| 204 | + &mut error, |
| 205 | + ); |
| 206 | + if error.is_null() { |
| 207 | + Ok(from_glib_full(ret)) |
| 208 | + } else { |
| 209 | + Err(from_glib_full(error)) |
| 210 | + } |
| 211 | + } |
| 212 | + } |
| 213 | +} |
| 214 | + |
| 215 | +impl std::fmt::Display for DBusObjectManagerClient { |
| 216 | + #[inline] |
| 217 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 218 | + f.write_str(&DBusObjectManagerClientExt::name(self)) |
| 219 | + } |
| 220 | +} |
| 221 | + |
| 222 | +pub trait DBusObjectManagerClientExt: IsA<DBusObjectManagerClient> + 'static { |
| 223 | + #[doc(alias = "g_dbus_object_manager_client_get_connection")] |
| 224 | + #[doc(alias = "get_connection")] |
| 225 | + fn connection(&self) -> DBusConnection { |
| 226 | + unsafe { |
| 227 | + from_glib_none(ffi::g_dbus_object_manager_client_get_connection( |
| 228 | + self.as_ref().to_glib_none().0, |
| 229 | + )) |
| 230 | + } |
| 231 | + } |
| 232 | + |
| 233 | + #[doc(alias = "g_dbus_object_manager_client_get_flags")] |
| 234 | + #[doc(alias = "get_flags")] |
| 235 | + fn flags(&self) -> DBusObjectManagerClientFlags { |
| 236 | + unsafe { |
| 237 | + from_glib(ffi::g_dbus_object_manager_client_get_flags( |
| 238 | + self.as_ref().to_glib_none().0, |
| 239 | + )) |
| 240 | + } |
| 241 | + } |
| 242 | + |
| 243 | + #[doc(alias = "g_dbus_object_manager_client_get_name")] |
| 244 | + #[doc(alias = "get_name")] |
| 245 | + fn name(&self) -> glib::GString { |
| 246 | + unsafe { |
| 247 | + from_glib_none(ffi::g_dbus_object_manager_client_get_name( |
| 248 | + self.as_ref().to_glib_none().0, |
| 249 | + )) |
| 250 | + } |
| 251 | + } |
| 252 | + |
| 253 | + #[doc(alias = "g_dbus_object_manager_client_get_name_owner")] |
| 254 | + #[doc(alias = "get_name_owner")] |
| 255 | + #[doc(alias = "name-owner")] |
| 256 | + fn name_owner(&self) -> Option<glib::GString> { |
| 257 | + unsafe { |
| 258 | + from_glib_full(ffi::g_dbus_object_manager_client_get_name_owner( |
| 259 | + self.as_ref().to_glib_none().0, |
| 260 | + )) |
| 261 | + } |
| 262 | + } |
| 263 | + |
| 264 | + //#[doc(alias = "get-proxy-type-destroy-notify")] |
| 265 | + //fn get_proxy_type_destroy_notify(&self) -> /*Unimplemented*/Basic: Pointer { |
| 266 | + // ObjectExt::property(self.as_ref(), "get-proxy-type-destroy-notify") |
| 267 | + //} |
| 268 | + |
| 269 | + //#[doc(alias = "get-proxy-type-func")] |
| 270 | + //fn get_proxy_type_func(&self) -> /*Unimplemented*/Basic: Pointer { |
| 271 | + // ObjectExt::property(self.as_ref(), "get-proxy-type-func") |
| 272 | + //} |
| 273 | + |
| 274 | + //#[doc(alias = "get-proxy-type-user-data")] |
| 275 | + //fn get_proxy_type_user_data(&self) -> /*Unimplemented*/Basic: Pointer { |
| 276 | + // ObjectExt::property(self.as_ref(), "get-proxy-type-user-data") |
| 277 | + //} |
| 278 | + |
| 279 | + //#[doc(alias = "interface-proxy-properties-changed")] |
| 280 | + //fn connect_interface_proxy_properties_changed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { |
| 281 | + // Empty ctype invalidated_properties: *.CArray TypeId { ns_id: 0, id: 28 } |
| 282 | + //} |
| 283 | + |
| 284 | + #[doc(alias = "interface-proxy-signal")] |
| 285 | + fn connect_interface_proxy_signal< |
| 286 | + F: Fn(&Self, &DBusObjectProxy, &DBusProxy, &str, &str, &glib::Variant) + 'static, |
| 287 | + >( |
| 288 | + &self, |
| 289 | + f: F, |
| 290 | + ) -> SignalHandlerId { |
| 291 | + unsafe extern "C" fn interface_proxy_signal_trampoline< |
| 292 | + P: IsA<DBusObjectManagerClient>, |
| 293 | + F: Fn(&P, &DBusObjectProxy, &DBusProxy, &str, &str, &glib::Variant) + 'static, |
| 294 | + >( |
| 295 | + this: *mut ffi::GDBusObjectManagerClient, |
| 296 | + object_proxy: *mut ffi::GDBusObjectProxy, |
| 297 | + interface_proxy: *mut ffi::GDBusProxy, |
| 298 | + sender_name: *mut std::ffi::c_char, |
| 299 | + signal_name: *mut std::ffi::c_char, |
| 300 | + parameters: *mut glib::ffi::GVariant, |
| 301 | + f: glib::ffi::gpointer, |
| 302 | + ) { |
| 303 | + let f: &F = &*(f as *const F); |
| 304 | + f( |
| 305 | + DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref(), |
| 306 | + &from_glib_borrow(object_proxy), |
| 307 | + &from_glib_borrow(interface_proxy), |
| 308 | + &glib::GString::from_glib_borrow(sender_name), |
| 309 | + &glib::GString::from_glib_borrow(signal_name), |
| 310 | + &from_glib_borrow(parameters), |
| 311 | + ) |
| 312 | + } |
| 313 | + unsafe { |
| 314 | + let f: Box_<F> = Box_::new(f); |
| 315 | + connect_raw( |
| 316 | + self.as_ptr() as *mut _, |
| 317 | + c"interface-proxy-signal".as_ptr() as *const _, |
| 318 | + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 319 | + interface_proxy_signal_trampoline::<Self, F> as *const (), |
| 320 | + )), |
| 321 | + Box_::into_raw(f), |
| 322 | + ) |
| 323 | + } |
| 324 | + } |
| 325 | + |
| 326 | + #[doc(alias = "name-owner")] |
| 327 | + fn connect_name_owner_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { |
| 328 | + unsafe extern "C" fn notify_name_owner_trampoline< |
| 329 | + P: IsA<DBusObjectManagerClient>, |
| 330 | + F: Fn(&P) + 'static, |
| 331 | + >( |
| 332 | + this: *mut ffi::GDBusObjectManagerClient, |
| 333 | + _param_spec: glib::ffi::gpointer, |
| 334 | + f: glib::ffi::gpointer, |
| 335 | + ) { |
| 336 | + let f: &F = &*(f as *const F); |
| 337 | + f(DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref()) |
| 338 | + } |
| 339 | + unsafe { |
| 340 | + let f: Box_<F> = Box_::new(f); |
| 341 | + connect_raw( |
| 342 | + self.as_ptr() as *mut _, |
| 343 | + c"notify::name-owner".as_ptr() as *const _, |
| 344 | + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 345 | + notify_name_owner_trampoline::<Self, F> as *const (), |
| 346 | + )), |
| 347 | + Box_::into_raw(f), |
| 348 | + ) |
| 349 | + } |
| 350 | + } |
| 351 | +} |
| 352 | + |
| 353 | +impl<O: IsA<DBusObjectManagerClient>> DBusObjectManagerClientExt for O {} |
0 commit comments