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