gio/auto/
dbus_object_proxy.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, DBusConnection, DBusObject};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GDBusObjectProxy")]
10    pub struct DBusObjectProxy(Object<ffi::GDBusObjectProxy, ffi::GDBusObjectProxyClass>) @implements DBusObject;
11
12    match fn {
13        type_ => || ffi::g_dbus_object_proxy_get_type(),
14    }
15}
16
17impl DBusObjectProxy {
18    pub const NONE: Option<&'static DBusObjectProxy> = None;
19
20    #[doc(alias = "g_dbus_object_proxy_new")]
21    pub fn new(connection: &DBusConnection, object_path: &str) -> DBusObjectProxy {
22        unsafe {
23            from_glib_full(ffi::g_dbus_object_proxy_new(
24                connection.to_glib_none().0,
25                object_path.to_glib_none().0,
26            ))
27        }
28    }
29}
30
31pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + 'static {
32    #[doc(alias = "g_dbus_object_proxy_get_connection")]
33    #[doc(alias = "get_connection")]
34    fn connection(&self) -> DBusConnection {
35        unsafe {
36            from_glib_none(ffi::g_dbus_object_proxy_get_connection(
37                self.as_ref().to_glib_none().0,
38            ))
39        }
40    }
41
42    #[doc(alias = "g-connection")]
43    fn g_connection(&self) -> Option<DBusConnection> {
44        ObjectExt::property(self.as_ref(), "g-connection")
45    }
46
47    #[doc(alias = "g-object-path")]
48    fn g_object_path(&self) -> Option<glib::GString> {
49        ObjectExt::property(self.as_ref(), "g-object-path")
50    }
51}
52
53impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}