gio/auto/
dbus_interface.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::{ffi, DBusInterfaceInfo, DBusObject};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GDBusInterface")]
10    pub struct DBusInterface(Interface<ffi::GDBusInterface, ffi::GDBusInterfaceIface>);
11
12    match fn {
13        type_ => || ffi::g_dbus_interface_get_type(),
14    }
15}
16
17impl DBusInterface {
18    pub const NONE: Option<&'static DBusInterface> = None;
19}
20
21mod sealed {
22    pub trait Sealed {}
23    impl<T: super::IsA<super::DBusInterface>> Sealed for T {}
24}
25
26pub trait DBusInterfaceExt: IsA<DBusInterface> + sealed::Sealed + 'static {
27    #[doc(alias = "g_dbus_interface_dup_object")]
28    #[doc(alias = "dup_object")]
29    fn get(&self) -> Option<DBusObject> {
30        unsafe {
31            from_glib_full(ffi::g_dbus_interface_dup_object(
32                self.as_ref().to_glib_none().0,
33            ))
34        }
35    }
36
37    #[doc(alias = "g_dbus_interface_get_info")]
38    #[doc(alias = "get_info")]
39    fn info(&self) -> DBusInterfaceInfo {
40        unsafe {
41            from_glib_none(ffi::g_dbus_interface_get_info(
42                self.as_ref().to_glib_none().0,
43            ))
44        }
45    }
46
47    #[doc(alias = "g_dbus_interface_set_object")]
48    fn set_object(&self, object: Option<&impl IsA<DBusObject>>) {
49        unsafe {
50            ffi::g_dbus_interface_set_object(
51                self.as_ref().to_glib_none().0,
52                object.map(|p| p.as_ref()).to_glib_none().0,
53            );
54        }
55    }
56}
57
58impl<O: IsA<DBusInterface>> DBusInterfaceExt for O {}