gio/auto/
dbus_object_proxy.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{ffi, DBusConnection, DBusObject};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    /// A `GDBusObjectProxy` is an object used to represent a remote object
    /// with one or more D-Bus interfaces. Normally, you don’t instantiate
    /// a `GDBusObjectProxy` yourself — typically `Gio::DBusObjectManagerClient`
    /// is used to obtain it.
    ///
    /// ## Properties
    ///
    ///
    /// #### `g-connection`
    ///  The connection of the proxy.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `g-object-path`
    ///  The object path of the proxy.
    ///
    /// Readable | Writeable | Construct Only
    ///
    /// # Implements
    ///
    /// [`DBusObjectProxyExt`][trait@crate::prelude::DBusObjectProxyExt], [`trait@glib::ObjectExt`], [`DBusObjectExt`][trait@crate::prelude::DBusObjectExt]
    #[doc(alias = "GDBusObjectProxy")]
    pub struct DBusObjectProxy(Object<ffi::GDBusObjectProxy, ffi::GDBusObjectProxyClass>) @implements DBusObject;

    match fn {
        type_ => || ffi::g_dbus_object_proxy_get_type(),
    }
}

impl DBusObjectProxy {
    pub const NONE: Option<&'static DBusObjectProxy> = None;

    /// Creates a new #GDBusObjectProxy for the given connection and
    /// object path.
    /// ## `connection`
    /// a #GDBusConnection
    /// ## `object_path`
    /// the object path
    ///
    /// # Returns
    ///
    /// a new #GDBusObjectProxy
    #[doc(alias = "g_dbus_object_proxy_new")]
    pub fn new(connection: &DBusConnection, object_path: &str) -> DBusObjectProxy {
        unsafe {
            from_glib_full(ffi::g_dbus_object_proxy_new(
                connection.to_glib_none().0,
                object_path.to_glib_none().0,
            ))
        }
    }
}

/// Trait containing all [`struct@DBusObjectProxy`] methods.
///
/// # Implementors
///
/// [`DBusObjectProxy`][struct@crate::DBusObjectProxy]
pub trait DBusObjectProxyExt: IsA<DBusObjectProxy> + 'static {
    /// Gets the connection that @self is for.
    ///
    /// # Returns
    ///
    /// A #GDBusConnection. Do not free, the
    ///   object is owned by @self.
    #[doc(alias = "g_dbus_object_proxy_get_connection")]
    #[doc(alias = "get_connection")]
    fn connection(&self) -> DBusConnection {
        unsafe {
            from_glib_none(ffi::g_dbus_object_proxy_get_connection(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// The connection of the proxy.
    #[doc(alias = "g-connection")]
    fn g_connection(&self) -> Option<DBusConnection> {
        ObjectExt::property(self.as_ref(), "g-connection")
    }

    /// The object path of the proxy.
    #[doc(alias = "g-object-path")]
    fn g_object_path(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "g-object-path")
    }
}

impl<O: IsA<DBusObjectProxy>> DBusObjectProxyExt for O {}