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
63/// Trait containing all [`struct@DBusObjectProxy`] methods.
64///
65/// # Implementors
66///
67/// [`DBusObjectProxy`][struct@crate::DBusObjectProxy]
68pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + 'static {
69    /// Gets the connection that @self is for.
70    ///
71    /// # Returns
72    ///
73    /// A #GDBusConnection. Do not free, the
74    ///   object is owned by @self.
75    #[doc(alias = "g_dbus_object_proxy_get_connection")]
76    #[doc(alias = "get_connection")]
77    fn connection(&self) -> DBusConnection {
78        unsafe {
79            from_glib_none(ffi::g_dbus_object_proxy_get_connection(
80                self.as_ref().to_glib_none().0,
81            ))
82        }
83    }
84
85    /// The connection of the proxy.
86    #[doc(alias = "g-connection")]
87    fn g_connection(&self) -> Option<DBusConnection> {
88        ObjectExt::property(self.as_ref(), "g-connection")
89    }
90
91    /// The object path of the proxy.
92    #[doc(alias = "g-object-path")]
93    fn g_object_path(&self) -> Option<glib::GString> {
94        ObjectExt::property(self.as_ref(), "g-object-path")
95    }
96}
97
98impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}