@@ -11,7 +11,7 @@ use glib::{prelude::*, translate::*};
1111pub trait DBusMethodCall : Sized {
1212 fn parse_call (
1313 obj_path : & str ,
14- interface : & str ,
14+ interface : Option < & str > ,
1515 method : & str ,
1616 params : glib:: Variant ,
1717 ) -> Result < Self , glib:: Error > ;
@@ -46,7 +46,7 @@ impl<'a, T: DBusMethodCall> MethodCallBuilder<'a, T> {
4646 /// safer interface where the callback returns a result directly.
4747 pub fn invoke < F > ( self , f : F ) -> RegistrationBuilder < ' a >
4848 where
49- F : Fn ( DBusConnection , & str , T , DBusMethodInvocation ) + ' static ,
49+ F : Fn ( DBusConnection , Option < & str > , T , DBusMethodInvocation ) + ' static ,
5050 {
5151 self . registration . method_call (
5252 move |connection, sender, obj_path, interface, method, params, invocation| {
@@ -74,7 +74,8 @@ impl<'a, T: DBusMethodCall> MethodCallBuilder<'a, T> {
7474 /// See [`DBusMethodInvocation::return_result`] for details.
7575 pub fn invoke_and_return < F > ( self , f : F ) -> RegistrationBuilder < ' a >
7676 where
77- F : Fn ( DBusConnection , & str , T ) -> Result < Option < glib:: Variant > , glib:: Error > + ' static ,
77+ F : Fn ( DBusConnection , Option < & str > , T ) -> Result < Option < glib:: Variant > , glib:: Error >
78+ + ' static ,
7879 {
7980 self . invoke ( move |connection, sender, call, invocation| {
8081 invocation. return_result ( f ( connection, sender, call) )
@@ -97,7 +98,7 @@ impl<'a, T: DBusMethodCall> MethodCallBuilder<'a, T> {
9798 /// See [`DBusMethodInvocation::return_future_local`] for details.
9899 pub fn invoke_and_return_future_local < F , Fut > ( self , f : F ) -> RegistrationBuilder < ' a >
99100 where
100- F : Fn ( DBusConnection , & str , T ) -> Fut + ' static ,
101+ F : Fn ( DBusConnection , Option < & str > , T ) -> Fut + ' static ,
101102 Fut : Future < Output = Result < Option < glib:: Variant > , glib:: Error > > + ' static ,
102103 {
103104 self . invoke ( move |connection, sender, call, invocation| {
@@ -128,18 +129,37 @@ pub struct RegistrationBuilder<'a> {
128129 interface_info : & ' a DBusInterfaceInfo ,
129130 #[ allow( clippy:: type_complexity) ]
130131 method_call : Option <
131- Box_ < dyn Fn ( DBusConnection , & str , & str , & str , & str , glib:: Variant , DBusMethodInvocation ) > ,
132+ Box_ <
133+ dyn Fn (
134+ DBusConnection ,
135+ Option < & str > ,
136+ & str ,
137+ Option < & str > ,
138+ & str ,
139+ glib:: Variant ,
140+ DBusMethodInvocation ,
141+ ) ,
142+ > ,
132143 > ,
133144 #[ allow( clippy:: type_complexity) ]
134- get_property : Option < Box_ < dyn Fn ( DBusConnection , & str , & str , & str , & str ) -> glib:: Variant > > ,
145+ get_property :
146+ Option < Box_ < dyn Fn ( DBusConnection , Option < & str > , & str , & str , & str ) -> glib:: Variant > > ,
135147 #[ allow( clippy:: type_complexity) ]
136148 set_property :
137- Option < Box_ < dyn Fn ( DBusConnection , & str , & str , & str , & str , glib:: Variant ) -> bool > > ,
149+ Option < Box_ < dyn Fn ( DBusConnection , Option < & str > , & str , & str , & str , glib:: Variant ) -> bool > > ,
138150}
139151
140152impl < ' a > RegistrationBuilder < ' a > {
141153 pub fn method_call <
142- F : Fn ( DBusConnection , & str , & str , & str , & str , glib:: Variant , DBusMethodInvocation ) + ' static ,
154+ F : Fn (
155+ DBusConnection ,
156+ Option < & str > ,
157+ & str ,
158+ Option < & str > ,
159+ & str ,
160+ glib:: Variant ,
161+ DBusMethodInvocation ,
162+ ) + ' static ,
143163 > (
144164 mut self ,
145165 f : F ,
@@ -162,7 +182,9 @@ impl<'a> RegistrationBuilder<'a> {
162182 }
163183
164184 #[ doc( alias = "get_property" ) ]
165- pub fn property < F : Fn ( DBusConnection , & str , & str , & str , & str ) -> glib:: Variant + ' static > (
185+ pub fn property <
186+ F : Fn ( DBusConnection , Option < & str > , & str , & str , & str ) -> glib:: Variant + ' static ,
187+ > (
166188 mut self ,
167189 f : F ,
168190 ) -> Self {
@@ -171,7 +193,7 @@ impl<'a> RegistrationBuilder<'a> {
171193 }
172194
173195 pub fn set_property <
174- F : Fn ( DBusConnection , & str , & str , & str , & str , glib:: Variant ) -> bool + ' static ,
196+ F : Fn ( DBusConnection , Option < & str > , & str , & str , & str , glib:: Variant ) -> bool + ' static ,
175197 > (
176198 mut self ,
177199 f : F ,
@@ -191,9 +213,9 @@ impl<'a> RegistrationBuilder<'a> {
191213 . map ( |f| {
192214 glib:: Closure :: new_local ( move |args| {
193215 let conn = args[ 0 ] . get :: < DBusConnection > ( ) . unwrap ( ) ;
194- let sender = args[ 1 ] . get :: < & str > ( ) . unwrap ( ) ;
216+ let sender = args[ 1 ] . get :: < Option < & str > > ( ) . unwrap ( ) ;
195217 let object_path = args[ 2 ] . get :: < & str > ( ) . unwrap ( ) ;
196- let interface_name = args[ 3 ] . get :: < & str > ( ) . unwrap ( ) ;
218+ let interface_name = args[ 3 ] . get :: < Option < & str > > ( ) . unwrap ( ) ;
197219 let method_name = args[ 4 ] . get :: < & str > ( ) . unwrap ( ) ;
198220 let parameters = args[ 5 ] . get :: < glib:: Variant > ( ) . unwrap ( ) ;
199221 let invocation = args[ 6 ] . get :: < DBusMethodInvocation > ( ) . unwrap ( ) ;
@@ -215,7 +237,7 @@ impl<'a> RegistrationBuilder<'a> {
215237 . map ( |f| {
216238 glib:: Closure :: new_local ( move |args| {
217239 let conn = args[ 0 ] . get :: < DBusConnection > ( ) . unwrap ( ) ;
218- let sender = args[ 1 ] . get :: < & str > ( ) . unwrap ( ) ;
240+ let sender = args[ 1 ] . get :: < Option < & str > > ( ) . unwrap ( ) ;
219241 let object_path = args[ 2 ] . get :: < & str > ( ) . unwrap ( ) ;
220242 let interface_name = args[ 3 ] . get :: < & str > ( ) . unwrap ( ) ;
221243 let property_name = args[ 4 ] . get :: < & str > ( ) . unwrap ( ) ;
@@ -237,7 +259,7 @@ impl<'a> RegistrationBuilder<'a> {
237259 . map ( |f| {
238260 glib:: Closure :: new_local ( move |args| {
239261 let conn = args[ 0 ] . get :: < DBusConnection > ( ) . unwrap ( ) ;
240- let sender = args[ 1 ] . get :: < & str > ( ) . unwrap ( ) ;
262+ let sender = args[ 1 ] . get :: < Option < & str > > ( ) . unwrap ( ) ;
241263 let object_path = args[ 2 ] . get :: < & str > ( ) . unwrap ( ) ;
242264 let interface_name = args[ 3 ] . get :: < & str > ( ) . unwrap ( ) ;
243265 let property_name = args[ 4 ] . get :: < & str > ( ) . unwrap ( ) ;
0 commit comments