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