|
| 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::{DBusInterface, DBusObject}; |
| 6 | +use glib::{ |
| 7 | + prelude::*, |
| 8 | + signal::{connect_raw, SignalHandlerId}, |
| 9 | + translate::*, |
| 10 | +}; |
| 11 | +use std::{boxed::Box as Box_, fmt, mem::transmute}; |
| 12 | + |
| 13 | +glib::wrapper! { |
| 14 | + #[doc(alias = "GDBusObjectManager")] |
| 15 | + pub struct DBusObjectManager(Interface<ffi::GDBusObjectManager, ffi::GDBusObjectManagerIface>); |
| 16 | + |
| 17 | + match fn { |
| 18 | + type_ => || ffi::g_dbus_object_manager_get_type(), |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +impl DBusObjectManager { |
| 23 | + pub const NONE: Option<&'static DBusObjectManager> = None; |
| 24 | +} |
| 25 | + |
| 26 | +mod sealed { |
| 27 | + pub trait Sealed {} |
| 28 | + impl<T: super::IsA<super::DBusObjectManager>> Sealed for T {} |
| 29 | +} |
| 30 | + |
| 31 | +pub trait DBusObjectManagerExt: IsA<DBusObjectManager> + sealed::Sealed + 'static { |
| 32 | + #[doc(alias = "g_dbus_object_manager_get_interface")] |
| 33 | + #[doc(alias = "get_interface")] |
| 34 | + fn interface(&self, object_path: &str, interface_name: &str) -> Option<DBusInterface> { |
| 35 | + unsafe { |
| 36 | + from_glib_full(ffi::g_dbus_object_manager_get_interface( |
| 37 | + self.as_ref().to_glib_none().0, |
| 38 | + object_path.to_glib_none().0, |
| 39 | + interface_name.to_glib_none().0, |
| 40 | + )) |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + #[doc(alias = "g_dbus_object_manager_get_object")] |
| 45 | + #[doc(alias = "get_object")] |
| 46 | + fn object(&self, object_path: &str) -> Option<DBusObject> { |
| 47 | + unsafe { |
| 48 | + from_glib_full(ffi::g_dbus_object_manager_get_object( |
| 49 | + self.as_ref().to_glib_none().0, |
| 50 | + object_path.to_glib_none().0, |
| 51 | + )) |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + #[doc(alias = "g_dbus_object_manager_get_object_path")] |
| 56 | + #[doc(alias = "get_object_path")] |
| 57 | + fn object_path(&self) -> glib::GString { |
| 58 | + unsafe { |
| 59 | + from_glib_none(ffi::g_dbus_object_manager_get_object_path( |
| 60 | + self.as_ref().to_glib_none().0, |
| 61 | + )) |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + #[doc(alias = "g_dbus_object_manager_get_objects")] |
| 66 | + #[doc(alias = "get_objects")] |
| 67 | + fn objects(&self) -> Vec<DBusObject> { |
| 68 | + unsafe { |
| 69 | + FromGlibPtrContainer::from_glib_full(ffi::g_dbus_object_manager_get_objects( |
| 70 | + self.as_ref().to_glib_none().0, |
| 71 | + )) |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + #[doc(alias = "interface-added")] |
| 76 | + fn connect_interface_added<F: Fn(&Self, &DBusObject, &DBusInterface) + 'static>( |
| 77 | + &self, |
| 78 | + f: F, |
| 79 | + ) -> SignalHandlerId { |
| 80 | + unsafe extern "C" fn interface_added_trampoline< |
| 81 | + P: IsA<DBusObjectManager>, |
| 82 | + F: Fn(&P, &DBusObject, &DBusInterface) + 'static, |
| 83 | + >( |
| 84 | + this: *mut ffi::GDBusObjectManager, |
| 85 | + object: *mut ffi::GDBusObject, |
| 86 | + interface: *mut ffi::GDBusInterface, |
| 87 | + f: glib::ffi::gpointer, |
| 88 | + ) { |
| 89 | + let f: &F = &*(f as *const F); |
| 90 | + f( |
| 91 | + DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(), |
| 92 | + &from_glib_borrow(object), |
| 93 | + &from_glib_borrow(interface), |
| 94 | + ) |
| 95 | + } |
| 96 | + unsafe { |
| 97 | + let f: Box_<F> = Box_::new(f); |
| 98 | + connect_raw( |
| 99 | + self.as_ptr() as *mut _, |
| 100 | + b"interface-added\0".as_ptr() as *const _, |
| 101 | + Some(transmute::<_, unsafe extern "C" fn()>( |
| 102 | + interface_added_trampoline::<Self, F> as *const (), |
| 103 | + )), |
| 104 | + Box_::into_raw(f), |
| 105 | + ) |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + #[doc(alias = "interface-removed")] |
| 110 | + fn connect_interface_removed<F: Fn(&Self, &DBusObject, &DBusInterface) + 'static>( |
| 111 | + &self, |
| 112 | + f: F, |
| 113 | + ) -> SignalHandlerId { |
| 114 | + unsafe extern "C" fn interface_removed_trampoline< |
| 115 | + P: IsA<DBusObjectManager>, |
| 116 | + F: Fn(&P, &DBusObject, &DBusInterface) + 'static, |
| 117 | + >( |
| 118 | + this: *mut ffi::GDBusObjectManager, |
| 119 | + object: *mut ffi::GDBusObject, |
| 120 | + interface: *mut ffi::GDBusInterface, |
| 121 | + f: glib::ffi::gpointer, |
| 122 | + ) { |
| 123 | + let f: &F = &*(f as *const F); |
| 124 | + f( |
| 125 | + DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(), |
| 126 | + &from_glib_borrow(object), |
| 127 | + &from_glib_borrow(interface), |
| 128 | + ) |
| 129 | + } |
| 130 | + unsafe { |
| 131 | + let f: Box_<F> = Box_::new(f); |
| 132 | + connect_raw( |
| 133 | + self.as_ptr() as *mut _, |
| 134 | + b"interface-removed\0".as_ptr() as *const _, |
| 135 | + Some(transmute::<_, unsafe extern "C" fn()>( |
| 136 | + interface_removed_trampoline::<Self, F> as *const (), |
| 137 | + )), |
| 138 | + Box_::into_raw(f), |
| 139 | + ) |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + #[doc(alias = "object-added")] |
| 144 | + fn connect_object_added<F: Fn(&Self, &DBusObject) + 'static>(&self, f: F) -> SignalHandlerId { |
| 145 | + unsafe extern "C" fn object_added_trampoline< |
| 146 | + P: IsA<DBusObjectManager>, |
| 147 | + F: Fn(&P, &DBusObject) + 'static, |
| 148 | + >( |
| 149 | + this: *mut ffi::GDBusObjectManager, |
| 150 | + object: *mut ffi::GDBusObject, |
| 151 | + f: glib::ffi::gpointer, |
| 152 | + ) { |
| 153 | + let f: &F = &*(f as *const F); |
| 154 | + f( |
| 155 | + DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(), |
| 156 | + &from_glib_borrow(object), |
| 157 | + ) |
| 158 | + } |
| 159 | + unsafe { |
| 160 | + let f: Box_<F> = Box_::new(f); |
| 161 | + connect_raw( |
| 162 | + self.as_ptr() as *mut _, |
| 163 | + b"object-added\0".as_ptr() as *const _, |
| 164 | + Some(transmute::<_, unsafe extern "C" fn()>( |
| 165 | + object_added_trampoline::<Self, F> as *const (), |
| 166 | + )), |
| 167 | + Box_::into_raw(f), |
| 168 | + ) |
| 169 | + } |
| 170 | + } |
| 171 | + |
| 172 | + #[doc(alias = "object-removed")] |
| 173 | + fn connect_object_removed<F: Fn(&Self, &DBusObject) + 'static>(&self, f: F) -> SignalHandlerId { |
| 174 | + unsafe extern "C" fn object_removed_trampoline< |
| 175 | + P: IsA<DBusObjectManager>, |
| 176 | + F: Fn(&P, &DBusObject) + 'static, |
| 177 | + >( |
| 178 | + this: *mut ffi::GDBusObjectManager, |
| 179 | + object: *mut ffi::GDBusObject, |
| 180 | + f: glib::ffi::gpointer, |
| 181 | + ) { |
| 182 | + let f: &F = &*(f as *const F); |
| 183 | + f( |
| 184 | + DBusObjectManager::from_glib_borrow(this).unsafe_cast_ref(), |
| 185 | + &from_glib_borrow(object), |
| 186 | + ) |
| 187 | + } |
| 188 | + unsafe { |
| 189 | + let f: Box_<F> = Box_::new(f); |
| 190 | + connect_raw( |
| 191 | + self.as_ptr() as *mut _, |
| 192 | + b"object-removed\0".as_ptr() as *const _, |
| 193 | + Some(transmute::<_, unsafe extern "C" fn()>( |
| 194 | + object_removed_trampoline::<Self, F> as *const (), |
| 195 | + )), |
| 196 | + Box_::into_raw(f), |
| 197 | + ) |
| 198 | + } |
| 199 | + } |
| 200 | +} |
| 201 | + |
| 202 | +impl<O: IsA<DBusObjectManager>> DBusObjectManagerExt for O {} |
| 203 | + |
| 204 | +impl fmt::Display for DBusObjectManager { |
| 205 | + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 206 | + f.write_str("DBusObjectManager") |
| 207 | + } |
| 208 | +} |
0 commit comments