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 AsyncInitable, AsyncResult, BusType, Cancellable, DBusConnection, DBusObjectManager,
7 DBusObjectManagerClientFlags, DBusObjectProxy, DBusProxy, Initable, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
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 unsafe {
294 let manager = from_glib_borrow(manager);
295 let object_path: Borrowed<glib::GString> = from_glib_borrow(object_path);
296 let interface_name: Borrowed<Option<glib::GString>> =
297 from_glib_borrow(interface_name);
298 let callback = &*(data as *mut Option<
299 Box_<
300 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
301 + 'static,
302 >,
303 >);
304 if let Some(ref callback) = *callback {
305 callback(
306 &manager,
307 object_path.as_str(),
308 (*interface_name).as_ref().map(|s| s.as_str()),
309 )
310 } else {
311 panic!("cannot get closure...")
312 }
313 .into_glib()
314 }
315 }
316 let get_proxy_type_func = if get_proxy_type_func_data.is_some() {
317 Some(get_proxy_type_func_func as _)
318 } else {
319 None
320 };
321 unsafe extern "C" fn get_proxy_type_destroy_notify_func(data: glib::ffi::gpointer) {
322 unsafe {
323 let _callback = Box_::from_raw(
324 data as *mut Option<
325 Box_<
326 dyn Fn(
327 &DBusObjectManagerClient,
328 &str,
329 Option<&str>,
330 ) -> glib::types::Type
331 + 'static,
332 >,
333 >,
334 );
335 }
336 }
337 let destroy_call6 = Some(get_proxy_type_destroy_notify_func as _);
338 let super_callback0: Box_<
339 Option<
340 Box_<
341 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
342 + 'static,
343 >,
344 >,
345 > = get_proxy_type_func_data;
346 unsafe {
347 let mut error = std::ptr::null_mut();
348 let ret = ffi::g_dbus_object_manager_client_new_for_bus_sync(
349 bus_type.into_glib(),
350 flags.into_glib(),
351 name.to_glib_none().0,
352 object_path.to_glib_none().0,
353 get_proxy_type_func,
354 Box_::into_raw(super_callback0) as *mut _,
355 destroy_call6,
356 cancellable.map(|p| p.as_ref()).to_glib_none().0,
357 &mut error,
358 );
359 if error.is_null() {
360 Ok(from_glib_full(ret))
361 } else {
362 Err(from_glib_full(error))
363 }
364 }
365 }
366
367 /// Creates a new #GDBusObjectManagerClient object.
368 ///
369 /// This is a synchronous failable constructor - the calling thread is
370 /// blocked until a reply is received. See g_dbus_object_manager_client_new()
371 /// for the asynchronous version.
372 /// ## `connection`
373 /// A #GDBusConnection.
374 /// ## `flags`
375 /// Zero or more flags from the #GDBusObjectManagerClientFlags enumeration.
376 /// ## `name`
377 /// The owner of the control object (unique or well-known name), or [`None`] when not using a message bus connection.
378 /// ## `object_path`
379 /// The object path of the control object.
380 /// ## `get_proxy_type_func`
381 /// A #GDBusProxyTypeFunc function or [`None`] to always construct #GDBusProxy proxies.
382 /// ## `get_proxy_type_user_data`
383 /// User data to pass to @get_proxy_type_func.
384 /// ## `get_proxy_type_destroy_notify`
385 /// Free function for @get_proxy_type_user_data or [`None`].
386 /// ## `cancellable`
387 /// A #GCancellable or [`None`]
388 ///
389 /// # Returns
390 ///
391 /// A
392 /// #GDBusObjectManagerClient object or [`None`] if @error is set. Free
393 /// with g_object_unref().
394 #[doc(alias = "g_dbus_object_manager_client_new_sync")]
395 #[doc(alias = "new_sync")]
396 #[allow(dead_code)]
397 pub(crate) fn new_sync_impl(
398 connection: &DBusConnection,
399 flags: DBusObjectManagerClientFlags,
400 name: Option<&str>,
401 object_path: &str,
402 get_proxy_type_func: Option<
403 Box_<
404 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type + 'static,
405 >,
406 >,
407 cancellable: Option<&impl IsA<Cancellable>>,
408 ) -> Result<DBusObjectManagerClient, glib::Error> {
409 let get_proxy_type_func_data: Box_<
410 Option<
411 Box_<
412 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
413 + 'static,
414 >,
415 >,
416 > = Box_::new(get_proxy_type_func);
417 unsafe extern "C" fn get_proxy_type_func_func(
418 manager: *mut ffi::GDBusObjectManagerClient,
419 object_path: *const std::ffi::c_char,
420 interface_name: *const std::ffi::c_char,
421 data: glib::ffi::gpointer,
422 ) -> glib::ffi::GType {
423 unsafe {
424 let manager = from_glib_borrow(manager);
425 let object_path: Borrowed<glib::GString> = from_glib_borrow(object_path);
426 let interface_name: Borrowed<Option<glib::GString>> =
427 from_glib_borrow(interface_name);
428 let callback = &*(data as *mut Option<
429 Box_<
430 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
431 + 'static,
432 >,
433 >);
434 if let Some(ref callback) = *callback {
435 callback(
436 &manager,
437 object_path.as_str(),
438 (*interface_name).as_ref().map(|s| s.as_str()),
439 )
440 } else {
441 panic!("cannot get closure...")
442 }
443 .into_glib()
444 }
445 }
446 let get_proxy_type_func = if get_proxy_type_func_data.is_some() {
447 Some(get_proxy_type_func_func as _)
448 } else {
449 None
450 };
451 unsafe extern "C" fn get_proxy_type_destroy_notify_func(data: glib::ffi::gpointer) {
452 unsafe {
453 let _callback = Box_::from_raw(
454 data as *mut Option<
455 Box_<
456 dyn Fn(
457 &DBusObjectManagerClient,
458 &str,
459 Option<&str>,
460 ) -> glib::types::Type
461 + 'static,
462 >,
463 >,
464 );
465 }
466 }
467 let destroy_call6 = Some(get_proxy_type_destroy_notify_func as _);
468 let super_callback0: Box_<
469 Option<
470 Box_<
471 dyn Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
472 + 'static,
473 >,
474 >,
475 > = get_proxy_type_func_data;
476 unsafe {
477 let mut error = std::ptr::null_mut();
478 let ret = ffi::g_dbus_object_manager_client_new_sync(
479 connection.to_glib_none().0,
480 flags.into_glib(),
481 name.to_glib_none().0,
482 object_path.to_glib_none().0,
483 get_proxy_type_func,
484 Box_::into_raw(super_callback0) as *mut _,
485 destroy_call6,
486 cancellable.map(|p| p.as_ref()).to_glib_none().0,
487 &mut error,
488 );
489 if error.is_null() {
490 Ok(from_glib_full(ret))
491 } else {
492 Err(from_glib_full(error))
493 }
494 }
495 }
496}
497
498impl std::fmt::Display for DBusObjectManagerClient {
499 #[inline]
500 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
501 f.write_str(&DBusObjectManagerClientExt::name(self))
502 }
503}
504
505unsafe impl Send for DBusObjectManagerClient {}
506unsafe impl Sync for DBusObjectManagerClient {}
507
508/// Trait containing all [`struct@DBusObjectManagerClient`] methods.
509///
510/// # Implementors
511///
512/// [`DBusObjectManagerClient`][struct@crate::DBusObjectManagerClient]
513pub trait DBusObjectManagerClientExt: IsA<DBusObjectManagerClient> + 'static {
514 /// Gets the #GDBusConnection used by @self.
515 ///
516 /// # Returns
517 ///
518 /// A #GDBusConnection object. Do not free,
519 /// the object belongs to @self.
520 #[doc(alias = "g_dbus_object_manager_client_get_connection")]
521 #[doc(alias = "get_connection")]
522 fn connection(&self) -> DBusConnection {
523 unsafe {
524 from_glib_none(ffi::g_dbus_object_manager_client_get_connection(
525 self.as_ref().to_glib_none().0,
526 ))
527 }
528 }
529
530 /// Gets the flags that @self was constructed with.
531 ///
532 /// # Returns
533 ///
534 /// Zero of more flags from the #GDBusObjectManagerClientFlags
535 /// enumeration.
536 #[doc(alias = "g_dbus_object_manager_client_get_flags")]
537 #[doc(alias = "get_flags")]
538 fn flags(&self) -> DBusObjectManagerClientFlags {
539 unsafe {
540 from_glib(ffi::g_dbus_object_manager_client_get_flags(
541 self.as_ref().to_glib_none().0,
542 ))
543 }
544 }
545
546 /// Gets the name that @self is for, or [`None`] if not a message bus
547 /// connection.
548 ///
549 /// # Returns
550 ///
551 /// A unique or well-known name. Do not free, the string
552 /// belongs to @self.
553 #[doc(alias = "g_dbus_object_manager_client_get_name")]
554 #[doc(alias = "get_name")]
555 fn name(&self) -> glib::GString {
556 unsafe {
557 from_glib_none(ffi::g_dbus_object_manager_client_get_name(
558 self.as_ref().to_glib_none().0,
559 ))
560 }
561 }
562
563 /// The unique name that owns the name that @self is for or [`None`] if
564 /// no-one currently owns that name. You can connect to the
565 /// #GObject::notify signal to track changes to the
566 /// #GDBusObjectManagerClient:name-owner property.
567 ///
568 /// # Returns
569 ///
570 /// The name owner or [`None`] if no name owner
571 /// exists. Free with g_free().
572 #[doc(alias = "g_dbus_object_manager_client_get_name_owner")]
573 #[doc(alias = "get_name_owner")]
574 #[doc(alias = "name-owner")]
575 fn name_owner(&self) -> Option<glib::GString> {
576 unsafe {
577 from_glib_full(ffi::g_dbus_object_manager_client_get_name_owner(
578 self.as_ref().to_glib_none().0,
579 ))
580 }
581 }
582
583 /// Emitted when a D-Bus signal is received on @interface_proxy.
584 ///
585 /// This signal exists purely as a convenience to avoid having to
586 /// connect signals to all interface proxies managed by @manager.
587 ///
588 /// This signal is emitted in the thread-default main context
589 /// (see [`glib::MainContext::push_thread_default()`][crate::glib::MainContext::push_thread_default()])
590 /// that @manager was constructed in.
591 /// ## `object_proxy`
592 /// The #GDBusObjectProxy on which an interface is emitting a D-Bus signal.
593 /// ## `interface_proxy`
594 /// The #GDBusProxy that is emitting a D-Bus signal.
595 /// ## `sender_name`
596 /// The sender of the signal or NULL if the connection is not a bus connection.
597 /// ## `signal_name`
598 /// The signal name.
599 /// ## `parameters`
600 /// A #GVariant tuple with parameters for the signal.
601 #[doc(alias = "interface-proxy-signal")]
602 fn connect_interface_proxy_signal<
603 F: Fn(&Self, &DBusObjectProxy, &DBusProxy, &str, &str, &glib::Variant) + Send + Sync + 'static,
604 >(
605 &self,
606 f: F,
607 ) -> SignalHandlerId {
608 unsafe extern "C" fn interface_proxy_signal_trampoline<
609 P: IsA<DBusObjectManagerClient>,
610 F: Fn(&P, &DBusObjectProxy, &DBusProxy, &str, &str, &glib::Variant)
611 + Send
612 + Sync
613 + 'static,
614 >(
615 this: *mut ffi::GDBusObjectManagerClient,
616 object_proxy: *mut ffi::GDBusObjectProxy,
617 interface_proxy: *mut ffi::GDBusProxy,
618 sender_name: *mut std::ffi::c_char,
619 signal_name: *mut std::ffi::c_char,
620 parameters: *mut glib::ffi::GVariant,
621 f: glib::ffi::gpointer,
622 ) {
623 unsafe {
624 let f: &F = &*(f as *const F);
625 f(
626 DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref(),
627 &from_glib_borrow(object_proxy),
628 &from_glib_borrow(interface_proxy),
629 &glib::GString::from_glib_borrow(sender_name),
630 &glib::GString::from_glib_borrow(signal_name),
631 &from_glib_borrow(parameters),
632 )
633 }
634 }
635 unsafe {
636 let f: Box_<F> = Box_::new(f);
637 connect_raw(
638 self.as_ptr() as *mut _,
639 c"interface-proxy-signal".as_ptr() as *const _,
640 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
641 interface_proxy_signal_trampoline::<Self, F> as *const (),
642 )),
643 Box_::into_raw(f),
644 )
645 }
646 }
647
648 #[doc(alias = "name-owner")]
649 fn connect_name_owner_notify<F: Fn(&Self) + Send + Sync + 'static>(
650 &self,
651 f: F,
652 ) -> SignalHandlerId {
653 unsafe extern "C" fn notify_name_owner_trampoline<
654 P: IsA<DBusObjectManagerClient>,
655 F: Fn(&P) + Send + Sync + 'static,
656 >(
657 this: *mut ffi::GDBusObjectManagerClient,
658 _param_spec: glib::ffi::gpointer,
659 f: glib::ffi::gpointer,
660 ) {
661 unsafe {
662 let f: &F = &*(f as *const F);
663 f(DBusObjectManagerClient::from_glib_borrow(this).unsafe_cast_ref())
664 }
665 }
666 unsafe {
667 let f: Box_<F> = Box_::new(f);
668 connect_raw(
669 self.as_ptr() as *mut _,
670 c"notify::name-owner".as_ptr() as *const _,
671 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
672 notify_name_owner_trampoline::<Self, F> as *const (),
673 )),
674 Box_::into_raw(f),
675 )
676 }
677 }
678}
679
680impl<O: IsA<DBusObjectManagerClient>> DBusObjectManagerClientExt for O {}