11use std:: cell:: { Cell , OnceCell , RefCell } ;
2+ use std:: future:: Future ;
23use std:: rc:: Rc ;
34
45use adw:: prelude:: * ;
5- use capnp:: capability:: Promise ;
66use glib:: subclass:: prelude:: * ;
77use glib:: Properties ;
88use gtk:: { gio, glib} ;
@@ -137,9 +137,9 @@ impl Subscription {
137137 self . _set_display_name ( display_name. to_string ( ) ) ;
138138 }
139139
140- fn load ( & self ) -> Promise < ( ) , capnp :: Error > {
140+ fn load ( & self ) -> impl Future < Output = anyhow :: Result < ( ) > > {
141141 let this = self . clone ( ) ;
142- Promise :: from_future ( async move {
142+ async move {
143143 let remote_subscription = this. imp ( ) . client . get ( ) . unwrap ( ) ;
144144 let model = remote_subscription. model ( ) . await ;
145145
@@ -161,7 +161,7 @@ impl Subscription {
161161 this. handle_event ( ev) ;
162162 }
163163 Ok ( ( ) )
164- } )
164+ }
165165 }
166166
167167 fn handle_event ( & self , ev : ListenerEvent ) {
@@ -198,13 +198,13 @@ impl Subscription {
198198 self . notify_display_name ( ) ;
199199 }
200200 #[ instrument( skip_all) ]
201- pub fn set_display_name ( & self , value : String ) -> Promise < ( ) , anyhow:: Error > {
201+ pub fn set_display_name ( & self , value : String ) -> impl Future < Output = anyhow:: Result < ( ) > > {
202202 let this = self . clone ( ) ;
203- Promise :: from_future ( async move {
203+ async move {
204204 this. _set_display_name ( value) ;
205205 this. send_updated_info ( ) . await ?;
206206 Ok ( ( ) )
207- } )
207+ }
208208 }
209209
210210 async fn send_updated_info ( & self ) -> anyhow:: Result < ( ) > {
@@ -240,14 +240,14 @@ impl Subscription {
240240 self . notify_unread_count ( ) ;
241241 }
242242
243- pub fn set_muted ( & self , value : bool ) -> Promise < ( ) , anyhow:: Error > {
243+ pub fn set_muted ( & self , value : bool ) -> impl Future < Output = anyhow:: Result < ( ) > > {
244244 let this = self . clone ( ) ;
245- Promise :: from_future ( async move {
245+ async move {
246246 this. imp ( ) . muted . replace ( value) ;
247247 this. notify_muted ( ) ;
248248 this. send_updated_info ( ) . await ?;
249249 Ok ( ( ) )
250- } )
250+ }
251251 }
252252 pub async fn flag_all_as_read ( & self ) -> anyhow:: Result < ( ) > {
253253 let imp = self . imp ( ) ;
0 commit comments