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    /// A `GDBusObjectProxy` is an object used to represent a remote object
10    /// with one or more D-Bus interfaces. Normally, you don’t instantiate
11    /// a `GDBusObjectProxy` yourself — typically `Gio::DBusObjectManagerClient`
12    /// is used to obtain it.
13    ///
14    /// ## Properties
15    ///
16    ///
17    /// #### `g-connection`
18    ///  The connection of the proxy.
19    ///
20    /// Readable | Writeable | Construct Only
21    ///
22    ///
23    /// #### `g-object-path`
24    ///  The object path of the proxy.
25    ///
26    /// Readable | Writeable | Construct Only
27    ///
28    /// # Implements
29    ///
30    /// [`DBusObjectProxyExt`][trait@crate::prelude::DBusObjectProxyExt], [`trait@glib::ObjectExt`], [`DBusObjectExt`][trait@crate::prelude::DBusObjectExt]
31    #[doc(alias = "GDBusObjectProxy")]
32    pub struct DBusObjectProxy(Object<ffi::GDBusObjectProxy, ffi::GDBusObjectProxyClass>) @implements DBusObject;
33
34    match fn {
35        type_ => || ffi::g_dbus_object_proxy_get_type(),
36    }
37}
38
39impl DBusObjectProxy {
40    pub const NONE: Option<&'static DBusObjectProxy> = None;
41
42    /// Creates a new #GDBusObjectProxy for the given connection and
43    /// object path.
44    /// ## `connection`
45    /// a #GDBusConnection
46    /// ## `object_path`
47    /// the object path
48    ///
49    /// # Returns
50    ///
51    /// a new #GDBusObjectProxy
52    #[doc(alias = "g_dbus_object_proxy_new")]
53    pub fn new(connection: &DBusConnection, object_path: &str) -> DBusObjectProxy {
54        unsafe {
55            from_glib_full(ffi::g_dbus_object_proxy_new(
56                connection.to_glib_none().0,
57                object_path.to_glib_none().0,
58            ))
59        }
60    }
61}
62
63mod sealed {
64    pub trait Sealed {}
65    impl<T: super::IsA<super::DBusObjectProxy>> Sealed for T {}
66}
67
68/// Trait containing all [`struct@DBusObjectProxy`] methods.
69///
70/// # Implementors
71///
72/// [`DBusObjectProxy`][struct@crate::DBusObjectProxy]
73pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + sealed::Sealed + 'static {
74    /// Gets the connection that @self is for.
75    ///
76    /// # Returns
77    ///
78    /// A #GDBusConnection. Do not free, the
79    ///   object is owned by @self.
80    #[doc(alias = "g_dbus_object_proxy_get_connection")]
81    #[doc(alias = "get_connection")]
82    fn connection(&self) -> DBusConnection {
83        unsafe {
84            from_glib_none(ffi::g_dbus_object_proxy_get_connection(
85                self.as_ref().to_glib_none().0,
86            ))
87        }
88    }
89
90    /// The connection of the proxy.
91    #[doc(alias = "g-connection")]
92    fn g_connection(&self) -> Option<DBusConnection> {
93        ObjectExt::property(self.as_ref(), "g-connection")
94    }
95
96    /// The object path of the proxy.
97    #[doc(alias = "g-object-path")]
98    fn g_object_path(&self) -> Option<glib::GString> {
99        ObjectExt::property(self.as_ref(), "g-object-path")
100    }
101}
102
103impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}