gio/auto/
dbus_method_invocation.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
5#[cfg(unix)]
6#[cfg_attr(docsrs, doc(cfg(unix)))]
7use crate::UnixFDList;
8use crate::{ffi, DBusConnection, DBusMessage, DBusMethodInfo, DBusPropertyInfo};
9#[cfg(unix)]
10#[cfg_attr(docsrs, doc(cfg(unix)))]
11use glib::prelude::*;
12use glib::translate::*;
13
14glib::wrapper! {
15    #[doc(alias = "GDBusMethodInvocation")]
16    pub struct DBusMethodInvocation(Object<ffi::GDBusMethodInvocation>);
17
18    match fn {
19        type_ => || ffi::g_dbus_method_invocation_get_type(),
20    }
21}
22
23impl DBusMethodInvocation {
24    #[doc(alias = "g_dbus_method_invocation_get_connection")]
25    #[doc(alias = "get_connection")]
26    pub fn connection(&self) -> DBusConnection {
27        unsafe {
28            from_glib_none(ffi::g_dbus_method_invocation_get_connection(
29                self.to_glib_none().0,
30            ))
31        }
32    }
33
34    #[doc(alias = "g_dbus_method_invocation_get_interface_name")]
35    #[doc(alias = "get_interface_name")]
36    pub fn interface_name(&self) -> Option<glib::GString> {
37        unsafe {
38            from_glib_none(ffi::g_dbus_method_invocation_get_interface_name(
39                self.to_glib_none().0,
40            ))
41        }
42    }
43
44    #[doc(alias = "g_dbus_method_invocation_get_message")]
45    #[doc(alias = "get_message")]
46    pub fn message(&self) -> DBusMessage {
47        unsafe {
48            from_glib_none(ffi::g_dbus_method_invocation_get_message(
49                self.to_glib_none().0,
50            ))
51        }
52    }
53
54    #[doc(alias = "g_dbus_method_invocation_get_method_info")]
55    #[doc(alias = "get_method_info")]
56    pub fn method_info(&self) -> Option<DBusMethodInfo> {
57        unsafe {
58            from_glib_none(ffi::g_dbus_method_invocation_get_method_info(
59                self.to_glib_none().0,
60            ))
61        }
62    }
63
64    #[doc(alias = "g_dbus_method_invocation_get_method_name")]
65    #[doc(alias = "get_method_name")]
66    pub fn method_name(&self) -> glib::GString {
67        unsafe {
68            from_glib_none(ffi::g_dbus_method_invocation_get_method_name(
69                self.to_glib_none().0,
70            ))
71        }
72    }
73
74    #[doc(alias = "g_dbus_method_invocation_get_object_path")]
75    #[doc(alias = "get_object_path")]
76    pub fn object_path(&self) -> glib::GString {
77        unsafe {
78            from_glib_none(ffi::g_dbus_method_invocation_get_object_path(
79                self.to_glib_none().0,
80            ))
81        }
82    }
83
84    #[doc(alias = "g_dbus_method_invocation_get_parameters")]
85    #[doc(alias = "get_parameters")]
86    pub fn parameters(&self) -> glib::Variant {
87        unsafe {
88            from_glib_none(ffi::g_dbus_method_invocation_get_parameters(
89                self.to_glib_none().0,
90            ))
91        }
92    }
93
94    #[doc(alias = "g_dbus_method_invocation_get_property_info")]
95    #[doc(alias = "get_property_info")]
96    pub fn property_info(&self) -> Option<DBusPropertyInfo> {
97        unsafe {
98            from_glib_none(ffi::g_dbus_method_invocation_get_property_info(
99                self.to_glib_none().0,
100            ))
101        }
102    }
103
104    #[doc(alias = "g_dbus_method_invocation_get_sender")]
105    #[doc(alias = "get_sender")]
106    pub fn sender(&self) -> Option<glib::GString> {
107        unsafe {
108            from_glib_none(ffi::g_dbus_method_invocation_get_sender(
109                self.to_glib_none().0,
110            ))
111        }
112    }
113
114    //#[doc(alias = "g_dbus_method_invocation_get_user_data")]
115    //#[doc(alias = "get_user_data")]
116    //pub fn user_data(&self) -> /*Unimplemented*/Option<Basic: Pointer> {
117    //    unsafe { TODO: call ffi:g_dbus_method_invocation_get_user_data() }
118    //}
119
120    #[doc(alias = "g_dbus_method_invocation_return_dbus_error")]
121    pub fn return_dbus_error(self, error_name: &str, error_message: &str) {
122        unsafe {
123            ffi::g_dbus_method_invocation_return_dbus_error(
124                self.into_glib_ptr(),
125                error_name.to_glib_none().0,
126                error_message.to_glib_none().0,
127            );
128        }
129    }
130
131    //#[doc(alias = "g_dbus_method_invocation_return_error")]
132    //pub fn return_error(self, domain: glib::Quark, code: i32, format: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
133    //    unsafe { TODO: call ffi:g_dbus_method_invocation_return_error() }
134    //}
135
136    //#[doc(alias = "g_dbus_method_invocation_return_error_valist")]
137    //pub fn return_error_valist(self, domain: glib::Quark, code: i32, format: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
138    //    unsafe { TODO: call ffi:g_dbus_method_invocation_return_error_valist() }
139    //}
140
141    #[doc(alias = "g_dbus_method_invocation_return_value")]
142    pub fn return_value(self, parameters: Option<&glib::Variant>) {
143        unsafe {
144            ffi::g_dbus_method_invocation_return_value(
145                self.into_glib_ptr(),
146                parameters.to_glib_none().0,
147            );
148        }
149    }
150
151    #[cfg(unix)]
152    #[cfg_attr(docsrs, doc(cfg(unix)))]
153    #[doc(alias = "g_dbus_method_invocation_return_value_with_unix_fd_list")]
154    pub fn return_value_with_unix_fd_list(
155        self,
156        parameters: Option<&glib::Variant>,
157        fd_list: Option<&impl IsA<UnixFDList>>,
158    ) {
159        unsafe {
160            ffi::g_dbus_method_invocation_return_value_with_unix_fd_list(
161                self.into_glib_ptr(),
162                parameters.to_glib_none().0,
163                fd_list.map(|p| p.as_ref()).to_glib_none().0,
164            );
165        }
166    }
167}