gio/auto/dbus_object_manager_client.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
5use crate::{
6 ffi, AsyncInitable, AsyncResult, BusType, Cancellable, DBusConnection, DBusObjectManager,
7 DBusObjectManagerClientFlags, DBusObjectProxy, DBusProxy, Initable,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// `GDBusObjectManagerClient` is used to create, monitor and delete object
19 /// proxies for remote objects exported by a [`DBusObjectManagerServer`][crate::DBusObjectManagerServer]
20 /// (or any code implementing the
21 /// [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
22 /// interface).
23 ///
24 /// Once an instance of this type has been created, you can connect to
25 /// the [`object-added`][struct@crate::DBusObjectManager#object-added] and
26 /// [`object-removed`][struct@crate::DBusObjectManager#object-removed] signals] and inspect the
27 /// [`DBusObjectProxy`][crate::DBusObjectProxy] objects returned by
28 /// [`DBusObjectManagerExt::objects()`][crate::prelude::DBusObjectManagerExt::objects()].
29 ///
30 /// If the name for a `GDBusObjectManagerClient` is not owned by anyone at
31 /// object construction time, the default behavior is to request the
32 /// message bus to launch an owner for the name. This behavior can be
33 /// disabled using the `G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START`
34 /// flag. It’s also worth noting that this only works if the name of
35 /// interest is activatable in the first place. E.g. in some cases it
36 /// is not possible to launch an owner for the requested name. In this
37 /// case, `GDBusObjectManagerClient` object construction still succeeds but
38 /// there will be no object proxies
39 /// (e.g. [`DBusObjectManagerExt::objects()`][crate::prelude::DBusObjectManagerExt::objects()] returns the empty list) and
40 /// the [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] property is `NULL`.
41 ///
42 /// The owner of the requested name can come and go (for example
43 /// consider a system service being restarted) – `GDBusObjectManagerClient`
44 /// handles this case too; simply connect to the [`notify`][struct@crate::glib::Object#notify]
45 /// signal to watch for changes on the
46 /// [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] property. When the name
47 /// owner vanishes, the behavior is that
48 /// [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] is set to `NULL` (this
49 /// includes emission of the [`notify`][struct@crate::glib::Object#notify] signal) and then
50 /// [`object-removed`][struct@crate::DBusObjectManager#object-removed] signals are synthesized
51 /// for all currently existing object proxies. Since
52 /// [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] is `NULL` when this
53 /// happens, you can use this information to disambiguate a synthesized signal
54 /// from a genuine signal caused by object removal on the remote
55 /// [`DBusObjectManager`][crate::DBusObjectManager]. Similarly, when a new name owner appears,
56 /// [`object-added`][struct@crate::DBusObjectManager#object-added] signals are synthesized
57 /// while [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] is still `NULL`. Only
58 /// when all object proxies have been added, the
59 /// [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] is set to the new name
60 /// owner (this includes emission of the [`notify`][struct@crate::glib::Object#notify] signal).
61 /// Furthermore, you are guaranteed that
62 /// [`name-owner`][struct@crate::DBusObjectManagerClient#name-owner] will alternate between a
63 /// name owner (e.g. `:1.42`) and `NULL` even in the case where
64 /// the name of interest is atomically replaced
65 ///
66 /// Ultimately, `GDBusObjectManagerClient` is used to obtain
67 /// [`DBusProxy`][crate::DBusProxy] instances. All signals (including the
68 /// `org.freedesktop.DBus.Properties::PropertiesChanged` signal)
69 /// delivered to [`DBusProxy`][crate::DBusProxy] instances are guaranteed to originate
70 /// from the name owner. This guarantee along with the behavior
71 /// described above, means that certain race conditions including the
72 /// “half the proxy is from the old owner and the other half is from
73 /// the new owner” problem cannot happen.
74 ///
75 /// To avoid having the application connect to signals on the returned
76 /// [`DBusObjectProxy`][crate::DBusObjectProxy] and [`DBusProxy`][crate::DBusProxy] objects, the
77 /// [`interface-added`][struct@crate::DBusObject#interface-added],
78 /// [`interface-removed`][struct@crate::DBusObject#interface-removed],
79 /// [`g-properties-changed`][struct@crate::DBusProxy#g-properties-changed] and
80 /// [`g-signal`][struct@crate::DBusProxy#g-signal] signals
81 /// are also emitted on the `GDBusObjectManagerClient` instance managing these
82 /// objects. The signals emitted are
83 /// [`interface-added`][struct@crate::DBusObjectManager#interface-added],
84 /// [`interface-removed`][struct@crate::DBusObjectManager#interface-removed],
85 /// [`interface-proxy-properties-changed`][struct@crate::DBusObjectManagerClient#interface-proxy-properties-changed] and
86 /// [`interface-proxy-signal`][struct@crate::DBusObjectManagerClient#interface-proxy-signal].
87 ///
88 /// Note that all callbacks and signals are emitted in the
89 /// thread-default main context (see
90 /// [`glib::MainContext::push_thread_default()`][crate::glib::MainContext::push_thread_default()]) that the
91 /// `GDBusObjectManagerClient` object was constructed in. Additionally, the
92 /// [`DBusObjectProxy`][crate::DBusObjectProxy] and [`DBusProxy`][crate::DBusProxy] objects
93 /// originating from the `GDBusObjectManagerClient` object will be created in
94 /// the same context and, consequently, will deliver signals in the
95 /// same main loop.
96 ///
97 /// ## Properties
98 ///
99 ///
100 /// #### `bus-type`
101 /// If this property is not [`BusType::None`][crate::BusType::None], then
102 /// #GDBusObjectManagerClient:connection must be [`None`] and will be set to the
103 /// #GDBusConnection obtained by calling g_bus_get() with the value
104 /// of this property.
105 ///
106 /// Writeable | Construct Only
107 ///
108 ///
109 /// #### `connection`
110 /// The #GDBusConnection to use.
111 ///
112 /// Readable | Writeable | Construct Only
113 ///
114 ///
115 /// #### `flags`
116 /// Flags from the #GDBusObjectManagerClientFlags enumeration.
117 ///
118 /// Readable | Writeable | Construct Only
119 ///
120 ///
121 /// #### `get-proxy-type-destroy-notify`
122 /// A #GDestroyNotify for the #gpointer user_data in #GDBusObjectManagerClient:get-proxy-type-user-data.
123 ///
124 /// Readable | Writeable | Construct Only
125 ///
126 ///
127 /// #### `get-proxy-type-func`
128 /// The #GDBusProxyTypeFunc to use when determining what #GType to
129 /// use for interface proxies or [`None`].
130 ///
131 /// Readable | Writeable | Construct Only
132 ///
133 ///
134 /// #### `get-proxy-type-user-data`
135 /// The #gpointer user_data to pass to #GDBusObjectManagerClient:get-proxy-type-func.
136 ///
137 /// Readable | Writeable | Construct Only
138 ///
139 ///
140 /// #### `name`
141 /// The well-known name or unique name that the manager is for.
142 ///
143 /// Readable | Writeable | Construct Only
144 ///
145 ///
146 /// #### `name-owner`
147 /// The unique name that owns #GDBusObjectManagerClient:name or [`None`] if
148 /// no-one is currently owning the name. Connect to the
149 /// #GObject::notify signal to track changes to this property.
150 ///
151 /// Readable
152 ///
153 ///
154 /// #### `object-path`
155 /// The object path the manager is for.
156 ///
157 /// Readable | Writeable | Construct Only
158 ///
159 /// ## Signals
160 ///
161 ///
162 /// #### `interface-proxy-properties-changed`
163 /// Emitted when one or more D-Bus properties on proxy changes. The
164 /// local cache has already been updated when this signal fires. Note
165 /// that both @changed_properties and @invalidated_properties are
166 /// guaranteed to never be [`None`] (either may be empty though).
167 ///
168 /// This signal exists purely as a convenience to avoid having to
169 /// connect signals to all interface proxies managed by @manager.
170 ///
171 /// This signal is emitted in the thread-default main context
172 /// (see [`glib::MainContext::push_thread_default()`][crate::glib::MainContext::push_thread_default()])
173 /// that @manager was constructed in.
174 ///
175 ///
176 ///
177 ///
178 /// #### `interface-proxy-signal`
179 /// Emitted when a D-Bus signal is received on @interface_proxy.
180 ///
181 /// This signal exists purely as a convenience to avoid having to
182 /// connect signals to all interface proxies managed by @manager.
183 ///
184 /// This signal is emitted in the thread-default main context
185 /// (see [`glib::MainContext::push_thread_default()`][crate::glib::MainContext::push_thread_default()])
186 /// that @manager was constructed in.
187 ///
188 ///
189 /// <details><summary><h4>DBusObjectManager</h4></summary>
190 ///
191 ///
192 /// #### `interface-added`
193 /// Emitted when @interface is added to @object.
194 ///
195 /// This signal exists purely as a convenience to avoid having to
196 /// connect signals to all objects managed by @manager.
197 ///
198 ///
199 ///
200 ///
201 /// #### `interface-removed`
202 /// Emitted when @interface has been removed from @object.
203 ///
204 /// This signal exists purely as a convenience to avoid having to
205 /// connect signals to all objects managed by @manager.
206 ///
207 ///
208 ///
209 ///
210 /// #### `object-added`
211 /// Emitted when @object is added to @manager.
212 ///
213 ///
214 ///
215 ///
216 /// #### `object-removed`
217 /// Emitted when @object is removed from @manager.
218 ///
219 ///
220 /// </details>
221 ///
222 /// # Implements
223 ///
224 /// [`DBusObjectManagerClientExt`][trait@crate::prelude::DBusObjectManagerClientExt], [`trait@glib::ObjectExt`], [`AsyncInitableExt`][trait@crate::prelude::AsyncInitableExt], [`DBusObjectManagerExt`][trait@crate::prelude::DBusObjectManagerExt], [`InitableExt`][trait@crate::prelude::InitableExt], [`DBusObjectManagerClientExtManual`][trait@crate::prelude::DBusObjectManagerClientExtManual]
225 #[doc(alias = "GDBusObjectManagerClient")]
226 pub struct DBusObjectManagerClient(Object<ffi::GDBusObjectManagerClient, ffi::GDBusObjectManagerClientClass>) @implements AsyncInitable, DBusObjectManager, Initable;
227
228 match fn {
229 type_ => || ffi::g_dbus_object_manager_client_get_type(),
230 }
231}
232
233impl DBusObjectManagerClient {
234 pub const NONE: Option<&'static DBusObjectManagerClient> = None;
235
236 /// Like g_dbus_object_manager_client_new_sync() but takes a #GBusType instead
237 /// of a #GDBusConnection.
238 ///
239 /// This is a synchronous failable constructor - the calling thread is
240 /// blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus()
241 /// for the asynchronous version.
242 /// ## `bus_type`
243 /// A #GBusType.
244 /// ## `flags`
245 /// Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
246 /// ## `name`
247 /// The owner of the control object (unique or well-known name).
248 /// ## `object_path`
249 /// The object path of the control object.
250 /// ## `get_proxy_type_func`
251 /// A #GDBusProxyTypeFunc function or [`None`] to always construct #GDBusProxy proxies.
252 /// ## `get_proxy_type_user_data`
253 /// User data to pass to @get_proxy_type_func.
254 /// ## `get_proxy_type_destroy_notify`
255 /// Free function for @get_proxy_type_user_data or [`None`].
256 /// ## `cancellable`
257 /// A #GCancellable or [`None`]
258 ///
259 /// # Returns
260 ///
261 /// A
262 /// #GDBusObjectManagerClient object or [`None`] if @error is set. Free
263 /// with g_object_unref().
264 #[doc(alias = "g_dbus_object_manager_client_new_for_bus_sync")]
265 #[doc(alias = "new_for_bus_sync")]
266 #[allow(dead_code)]
267 pub(crate) fn for_bus_sync_impl(
268 bus_type: BusType,
269 flags: DBusObjectManagerClientFlags,
270 name: &str,
271 object_path: &str,
272 get_proxy_type_func: Option<
273 Box_<
274 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type + 'static,
275 >,
276 >,
277 cancellable: Option<&impl IsA<Cancellable>>,
278 ) -> Result<DBusObjectManagerClient, glib::Error> {
279 let get_proxy_type_func_data: Box_<
280 Option<
281 Box_<
282 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
283 + 'static,
284 >,
285 >,
286 > = Box_::new(get_proxy_type_func);
287 unsafe extern "C" fn get_proxy_type_func_func(
288 manager: *mut ffi::GDBusObjectManagerClient,
289 object_path: *const std::ffi::c_char,
290 interface_name: *const std::ffi::c_char,
291 data: glib::ffi::gpointer,
292 ) -> glib::ffi::GType {
293 let manager = from_glib_borrow(manager);
294 let object_path: Borrowed<glib::GString> = from_glib_borrow(object_path);
295 let interface_name: Borrowed<Option<glib::GString>> = from_glib_borrow(interface_name);
296 let callback = &*(data as *mut Option<
297 Box_<
298 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
299 + 'static,
300 >,
301 >);
302 if let Some(ref callback) = *callback {
303 callback(
304 &manager,
305 object_path.as_str(),
306 (*interface_name).as_ref().map(|s| s.as_str()),
307 )
308 } else {
309 panic!("cannot get closure...")
310 }
311 .into_glib()
312 }
313 let get_proxy_type_func = if get_proxy_type_func_data.is_some() {
314 Some(get_proxy_type_func_func as _)
315 } else {
316 None
317 };
318 unsafe extern "C" fn get_proxy_type_destroy_notify_func(data: glib::ffi::gpointer) {
319 let _callback = Box_::from_raw(
320 data as *mut Option<
321 Box_<
322 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
323 + 'static,
324 >,
325 >,
326 );
327 }
328 let destroy_call6 = Some(get_proxy_type_destroy_notify_func as _);
329 let super_callback0: Box_<
330 Option<
331 Box_<
332 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
333 + 'static,
334 >,
335 >,
336 > = get_proxy_type_func_data;
337 unsafe {
338 let mut error = std::ptr::null_mut();
339 let ret = ffi::g_dbus_object_manager_client_new_for_bus_sync(
340 bus_type.into_glib(),
341 flags.into_glib(),
342 name.to_glib_none().0,
343 object_path.to_glib_none().0,
344 get_proxy_type_func,
345 Box_::into_raw(super_callback0) as *mut _,
346 destroy_call6,
347 cancellable.map(|p| p.as_ref()).to_glib_none().0,
348 &mut error,
349 );
350 if error.is_null() {
351 Ok(from_glib_full(ret))
352 } else {
353 Err(from_glib_full(error))
354 }
355 }
356 }
357
358 /// Creates a new #GDBusObjectManagerClient object.
359 ///
360 /// This is a synchronous failable constructor - the calling thread is
361 /// blocked until a reply is received. See g_dbus_object_manager_client_new()
362 /// for the asynchronous version.
363 /// ## `connection`
364 /// A #GDBusConnection.
365 /// ## `flags`
366 /// Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
367 /// ## `name`
368 /// The owner of the control object (unique or well-known name), or [`None`] when not using a message bus connection.
369 /// ## `object_path`
370 /// The object path of the control object.
371 /// ## `get_proxy_type_func`
372 /// A #GDBusProxyTypeFunc function or [`None`] to always construct #GDBusProxy proxies.
373 /// ## `get_proxy_type_user_data`
374 /// User data to pass to @get_proxy_type_func.
375 /// ## `get_proxy_type_destroy_notify`
376 /// Free function for @get_proxy_type_user_data or [`None`].
377 /// ## `cancellable`
378 /// A #GCancellable or [`None`]
379 ///
380 /// # Returns
381 ///
382 /// A
383 /// #GDBusObjectManagerClient object or [`None`] if @error is set. Free
384 /// with g_object_unref().
385 #[doc(alias = "g_dbus_object_manager_client_new_sync")]
386 #[doc(alias = "new_sync")]
387 #[allow(dead_code)]
388 pub(crate) fn new_sync_impl(
389 connection: &DBusConnection,
390 flags: DBusObjectManagerClientFlags,
391 name: Option<&str>,
392 object_path: &str,
393 get_proxy_type_func: Option<
394 Box_<
395 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type + 'static,
396 >,
397 >,
398 cancellable: Option<&impl IsA<Cancellable>>,
399 ) -> Result<DBusObjectManagerClient, glib::Error> {
400 let get_proxy_type_func_data: Box_<
401 Option<
402 Box_<
403 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
404 + 'static,
405 >,
406 >,
407 > = Box_::new(get_proxy_type_func);
408 unsafe extern "C" fn get_proxy_type_func_func(
409 manager: *mut ffi::GDBusObjectManagerClient,
410 object_path: *const std::ffi::c_char,
411 interface_name: *const std::ffi::c_char,
412 data: glib::ffi::gpointer,
413 ) -> glib::ffi::GType {
414 let manager = from_glib_borrow(manager);
415 let object_path: Borrowed<glib::GString> = from_glib_borrow(object_path);
416 let interface_name: Borrowed<Option<glib::GString>> = from_glib_borrow(interface_name);
417 let callback = &*(data as *mut Option<
418 Box_<
419 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
420 + 'static,
421 >,
422 >);
423 if let Some(ref callback) = *callback {
424 callback(
425 &manager,
426 object_path.as_str(),
427 (*interface_name).as_ref().map(|s| s.as_str()),
428 )
429 } else {
430 panic!("cannot get closure...")
431 }
432 .into_glib()
433 }
434 let get_proxy_type_func = if get_proxy_type_func_data.is_some() {
435 Some(get_proxy_type_func_func as _)
436 } else {
437 None
438 };
439 unsafe extern "C" fn get_proxy_type_destroy_notify_func(data: glib::ffi::gpointer) {
440 let _callback = Box_::from_raw(
441 data as *mut Option<
442 Box_<
443 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
444 + 'static,
445 >,
446 >,
447 );
448 }
449 let destroy_call6 = Some(get_proxy_type_destroy_notify_func as _);
450 let super_callback0: Box_<
451 Option<
452 Box_<
453 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
454 + 'static,
455 >,
456 >,
457 > = get_proxy_type_func_data;
458 unsafe {
459 let mut error = std::ptr::null_mut();
460 let ret = ffi::g_dbus_object_manager_client_new_sync(
461 connection.to_glib_none().0,
462 flags.into_glib(),
463 name.to_glib_none().0,
464 object_path.to_glib_none().0,
465 get_proxy_type_func,
466 Box_::into_raw(super_callback0) as *mut _,
467 destroy_call6,
468 cancellable.map(|p| p.as_ref()).to_glib_none().0,
469 &mut error,
470 );
471 if error.is_null() {
472 Ok(from_glib_full(ret))
473 } else {
474 Err(from_glib_full(error))
475 }
476 }
477 }
478}
479
480impl std::fmt::Display for DBusObjectManagerClient {
481 #[inline]
482 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
483 f.write_str(&DBusObjectManagerClientExt::name(self))
484 }
485}
486
487unsafe impl Send for DBusObjectManagerClient {}
488unsafe impl Sync for DBusObjectManagerClient {}
489
490/// Trait containing all [`struct@DBusObjectManagerClient`] methods.
491///
492/// # Implementors
493///
494/// [`DBusObjectManagerClient`][struct@crate::DBusObjectManagerClient]
495pub trait DBusObjectManagerClientExt: IsA<DBusObjectManagerClient> + 'static {
496 /// Gets the #GDBusConnection used by @self.
497 ///
498 /// # Returns
499 ///
500 /// A #GDBusConnection object. Do not free,
501 /// the object belongs to @self.
502 #[doc(alias = "g_dbus_object_manager_client_get_connection")]
503 #[doc(alias = "get_connection")]
504 fn connection(&self) -> DBusConnection {
505 unsafe {
506 from_glib_none(ffi::g_dbus_object_manager_client_get_connection(
507 self.as_ref().to_glib_none().0,
508 ))
509 }
510 }
511
512 /// Gets the flags that @self was constructed with.
513 ///
514 /// # Returns
515 ///
516 /// Zero of more flags from the #GDBusObjectManagerClientFlags
517 /// enumeration.
518 #[doc(alias = "g_dbus_object_manager_client_get_flags")]
519 #[doc(alias = "get_flags")]
520 fn flags(&self) -> DBusObjectManagerClientFlags {
521 unsafe {
522 from_glib(ffi::g_dbus_object_manager_client_get_flags(
523 self.as_ref().to_glib_none().0,
524 ))
525 }
526 }
527
528 /// Gets the name that @self is for, or [`None`] if not a message bus
529 /// connection.
530 ///
531 /// # Returns
532 ///
533 /// A unique or well-known name. Do not free, the string
534 /// belongs to @self.
535 #[doc(alias = "g_dbus_object_manager_client_get_name")]
536 #[doc(alias = "get_name")]
537 fn name(&self) -> glib::GString {
538 unsafe {
539 from_glib_none(ffi::g_dbus_object_manager_client_get_name(
540 self.as_ref().to_glib_none().0,
541 ))
542 }
543 }
544
545 /// The unique name that owns the name that @self is for or [`None`] if
546 /// no-one currently owns that name. You can connect to the
547 /// #GObject::notify signal to track changes to the
548 /// #GDBusObjectManagerClient:name-owner property.
549 ///
550 /// # Returns
551 ///
552 /// The name owner or [`None`] if no name owner
553 /// exists. Free with g_free().
554 #[doc(alias = "g_dbus_object_manager_client_get_name_owner")]
555 #[doc(alias = "get_name_owner")]
556 #[doc(alias = "name-owner")]
557 fn name_owner(&self) -> Option<glib::GString> {
558 unsafe {
559 from_glib_full(ffi::g_dbus_object_manager_client_get_name_owner(
560 self.as_ref().to_glib_none().0,
561 ))
562 }
563 }
564
565 /// Emitted when a D-Bus signal is received on @interface_proxy.
566 ///
567 /// This signal exists purely as a convenience to avoid having to
568 /// connect signals to all interface proxies managed by @manager.
569 ///
570 /// This signal is emitted in the thread-default main context
571 /// (see [`glib::MainContext::push_thread_default()`][crate::glib::MainContext::push_thread_default()])
572 /// that @manager was constructed in.
573 /// ## `object_proxy`
574 /// The #GDBusObjectProxy on which an interface is emitting a D-Bus signal.
575 /// ## `interface_proxy`
576 /// The #GDBusProxy that is emitting a D-Bus signal.
577 /// ## `sender_name`
578 /// The sender of the signal or NULL if the connection is not a bus connection.
579 /// ## `signal_name`
580 /// The signal name.
581 /// ## `parameters`
582 /// A #GVariant tuple with parameters for the signal.
583 #[doc(alias = "interface-proxy-signal")]
584 fn connect_interface_proxy_signal<
585 F: Fn(&Self, &DBusObjectProxy, &DBusProxy, &str, &str, &glib::Variant) + Send + Sync + 'static,
586 >(
587 &self,
588 f: F,
589 ) -> SignalHandlerId {
590 unsafe extern "C" fn interface_proxy_signal_trampoline<
591 P: IsA<DBusObjectManagerClient>,
592 F: Fn(&P, &DBusObjectProxy, &DBusProxy, &str, &str, &glib::Variant)
593 + Send
594 + Sync
595 + 'static,
596 >(
597 this: *mut ffi::GDBusObjectManagerClient,
598 object_proxy: *mut ffi::GDBusObjectProxy,
599 interface_proxy: *mut ffi::GDBusProxy,
600 sender_name: *mut std::ffi::c_char,
601 signal_name: *mut std::ffi::c_char,
602 parameters: *mut glib::ffi::GVariant,
603 f: glib::ffi::gpointer,
604 ) {
605 let f: &F = &*(f as *const F);
606 f(
607 DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref(),
608 &from_glib_borrow(object_proxy),
609 &from_glib_borrow(interface_proxy),
610 &glib::GString::from_glib_borrow(sender_name),
611 &glib::GString::from_glib_borrow(signal_name),
612 &from_glib_borrow(parameters),
613 )
614 }
615 unsafe {
616 let f: Box_<F> = Box_::new(f);
617 connect_raw(
618 self.as_ptr() as *mut _,
619 c"interface-proxy-signal".as_ptr() as *const _,
620 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
621 interface_proxy_signal_trampoline::<Self, F> as *const (),
622 )),
623 Box_::into_raw(f),
624 )
625 }
626 }
627
628 #[doc(alias = "name-owner")]
629 fn connect_name_owner_notify<F: Fn(&Self) + Send + Sync + 'static>(
630 &self,
631 f: F,
632 ) -> SignalHandlerId {
633 unsafe extern "C" fn notify_name_owner_trampoline<
634 P: IsA<DBusObjectManagerClient>,
635 F: Fn(&P) + Send + Sync + 'static,
636 >(
637 this: *mut ffi::GDBusObjectManagerClient,
638 _param_spec: glib::ffi::gpointer,
639 f: glib::ffi::gpointer,
640 ) {
641 let f: &F = &*(f as *const F);
642 f(DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref())
643 }
644 unsafe {
645 let f: Box_<F> = Box_::new(f);
646 connect_raw(
647 self.as_ptr() as *mut _,
648 c"notify::name-owner".as_ptr() as *const _,
649 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
650 notify_name_owner_trampoline::<Self, F> as *const (),
651 )),
652 Box_::into_raw(f),
653 )
654 }
655 }
656}
657
658impl<O: IsA<DBusObjectManagerClient>> DBusObjectManagerClientExt for O {}