@@ -3,7 +3,7 @@ use std::sync::Arc;
33use oo7:: { Key , ashpd:: WindowIdentifierType , dbus:: ServiceError } ;
44use serde:: { Deserialize , Serialize } ;
55use tokio:: sync:: OnceCell ;
6- use zbus:: zvariant:: { self , Optional , OwnedObjectPath , Type , as_value} ;
6+ use zbus:: zvariant:: { self , ObjectPath , Optional , OwnedObjectPath , Type , as_value} ;
77
88use super :: secret_exchange;
99use crate :: {
@@ -126,17 +126,17 @@ enum PromptType {
126126 gen_blocking = false
127127) ]
128128pub trait Prompter {
129- fn begin_prompting ( & self , callback : & OwnedObjectPath ) -> Result < ( ) , ServiceError > ;
129+ fn begin_prompting ( & self , callback : & ObjectPath < ' _ > ) -> Result < ( ) , ServiceError > ;
130130
131131 fn perform_prompt (
132132 & self ,
133- callback : OwnedObjectPath ,
133+ callback : & ObjectPath < ' _ > ,
134134 type_ : PromptType ,
135135 properties : Properties ,
136136 exchange : & str ,
137137 ) -> Result < ( ) , ServiceError > ;
138138
139- fn stop_prompting ( & self , callback : OwnedObjectPath ) -> Result < ( ) , ServiceError > ;
139+ fn stop_prompting ( & self , callback : & ObjectPath < ' _ > ) -> Result < ( ) , ServiceError > ;
140140}
141141
142142#[ derive( Debug , Clone ) ]
@@ -178,7 +178,8 @@ impl PrompterCallback {
178178 }
179179 // Dismissed prompt
180180 Some ( Reply :: No ) => {
181- self . prompter_dismissed ( prompt. path ( ) ) . await ?;
181+ self . prompter_dismissed ( prompt. path ( ) . clone ( ) . into ( ) )
182+ . await ?;
182183 }
183184 } ;
184185 Ok ( ( ) )
@@ -224,7 +225,7 @@ impl PrompterCallback {
224225 } )
225226 }
226227
227- pub fn path ( & self ) -> & OwnedObjectPath {
228+ pub fn path ( & self ) -> & ObjectPath < ' _ > {
228229 & self . path
229230 }
230231
@@ -265,7 +266,7 @@ impl PrompterCallback {
265266 let exchange = self . exchange . get ( ) . unwrap ( ) . clone ( ) ;
266267 tokio:: spawn ( async move {
267268 prompter
268- . perform_prompt ( path, prompt_type, properties, & exchange)
269+ . perform_prompt ( & path, prompt_type, properties, & exchange)
269270 . await
270271 } ) ;
271272 Ok ( ( ) )
@@ -319,7 +320,7 @@ impl PrompterCallback {
319320 tokio:: spawn ( async move {
320321 prompter
321322 . perform_prompt (
322- path,
323+ & path,
323324 PromptType :: Password ,
324325 properties,
325326 & server_exchange,
@@ -340,9 +341,10 @@ impl PrompterCallback {
340341 }
341342
342343 let path = self . path . clone ( ) ;
343- tokio:: spawn ( async move { prompter. stop_prompting ( path) . await } ) ;
344+ let prompt_path = OwnedObjectPath :: from ( prompt. path ( ) . clone ( ) ) ;
345+ tokio:: spawn ( async move { prompter. stop_prompting ( & path) . await } ) ;
344346
345- let signal_emitter = self . service . signal_emitter ( prompt . path ( ) . clone ( ) ) ?;
347+ let signal_emitter = self . service . signal_emitter ( prompt_path ) ?;
346348 let result = zvariant:: Value :: new ( prompt. objects ( ) )
347349 . try_to_owned ( )
348350 . unwrap ( ) ;
@@ -372,18 +374,18 @@ impl PrompterCallback {
372374 . map ( |( parent, _) | parent) ?;
373375 let collection = self
374376 . service
375- . collection_from_path ( & OwnedObjectPath :: try_from ( path) . unwrap ( ) )
377+ . collection_from_path ( & ObjectPath :: try_from ( path) . unwrap ( ) )
376378 . await ?;
377379
378380 Some ( collection. label ( ) . await )
379381 }
380382
381- async fn prompter_dismissed ( & self , prompt_path : & OwnedObjectPath ) -> Result < ( ) , ServiceError > {
383+ async fn prompter_dismissed ( & self , prompt_path : OwnedObjectPath ) -> Result < ( ) , ServiceError > {
382384 let path = self . path . clone ( ) ;
383385 let prompter = PrompterProxy :: new ( self . service . connection ( ) ) . await ?;
384386
385- tokio:: spawn ( async move { prompter. stop_prompting ( path) . await } ) ;
386- let signal_emitter = self . service . signal_emitter ( prompt_path. clone ( ) ) ?;
387+ tokio:: spawn ( async move { prompter. stop_prompting ( & path) . await } ) ;
388+ let signal_emitter = self . service . signal_emitter ( prompt_path) ?;
387389 let result = zvariant:: Value :: new :: < Vec < OwnedObjectPath > > ( vec ! [ ] )
388390 . try_to_owned ( )
389391 . unwrap ( ) ;
0 commit comments