@@ -218,6 +218,10 @@ impl DistroShelfWindow {
218218 . set_child ( Some ( & tasks_button) ) ;
219219 }
220220
221+ fn add_toast ( & self , toast : adw:: Toast ) {
222+ self . imp ( ) . toast_overlay . add_toast ( toast) ;
223+ }
224+
221225 pub fn build_container_header ( & self , container : & Container ) -> gtk:: Box {
222226 // Create labels for the title and subtitle
223227 let title_label = gtk:: Label :: new ( Some ( & container. name ( ) ) ) ;
@@ -237,12 +241,12 @@ impl DistroShelfWindow {
237241 copy_btn. add_css_class ( "xs" ) ;
238242 // Capture a clone of the image URL for the closure
239243 let image_url = container. image ( ) . to_string ( ) ;
240- let toast_overlay = self . imp ( ) . toast_overlay . clone ( ) ;
244+ let this = self . clone ( ) ;
241245 copy_btn. connect_clicked ( move |_| {
242246 if let Some ( display) = gdk:: Display :: default ( ) {
243247 let clipboard = display. primary_clipboard ( ) ;
244248 clipboard. set_text ( & image_url) ;
245- toast_overlay . add_toast ( adw:: Toast :: new ( "Image URL copied" ) ) ;
249+ this . add_toast ( adw:: Toast :: new ( "Image URL copied" ) ) ;
246250 }
247251 } ) ;
248252
@@ -318,10 +322,25 @@ impl DistroShelfWindow {
318322 #[ weak( rename_to = this) ]
319323 self ,
320324 move |_| {
321- this. root_store( )
325+ let task = this. root_store( )
322326 . selected_container( )
323327 . unwrap( )
324328 . spawn_terminal( ) ;
329+ task. connect_status_notify( move |task| {
330+ if let Some ( _) = & * task. error( ) {
331+ let toast = adw:: Toast :: new( "Check your terminal settings." ) ;
332+ toast. set_button_label( Some ( "Preferences" ) ) ;
333+ toast. connect_button_clicked( clone!(
334+ #[ weak]
335+ this,
336+ move |_| {
337+ this. root_store( )
338+ . set_current_dialog( TaggedObject :: new( "preferences" ) ) ;
339+ }
340+ ) ) ;
341+ this. add_toast( toast) ;
342+ }
343+ } ) ;
325344 }
326345 ) ) ;
327346 status_child. append ( & terminal_btn) ;
@@ -562,15 +581,11 @@ impl DistroShelfWindow {
562581
563582 let page = adw:: PreferencesPage :: new ( ) ;
564583
565- let preferences_group = adw:: PreferencesGroup :: new ( ) ;
566- preferences_group. set_title ( "General" ) ;
567-
568584 let terminal_group = adw:: PreferencesGroup :: new ( ) ;
569585 terminal_group. set_title ( "Terminal Settings" ) ;
570586 terminal_group. add ( & TerminalComboRow :: new_with_params ( self . root_store ( ) ) ) ;
571587 page. add ( & terminal_group) ;
572588
573- page. add ( & preferences_group) ;
574589 dialog. add ( & page) ;
575590 dialog. upcast ( )
576591 }
0 commit comments