@@ -12,7 +12,7 @@ use crate::sidebar_row::SidebarRow;
1212use std:: path:: PathBuf ;
1313use std:: { cell:: RefCell , rc:: Rc } ;
1414
15- use crate :: image_row_item;
15+ use crate :: { distro_icon , image_row_item} ;
1616use glib:: clone;
1717use gtk:: glib:: { derived_properties, Properties } ;
1818
@@ -534,17 +534,18 @@ impl CreateDistroboxDialog {
534534 let stack = gtk:: Stack :: new ( ) ;
535535 stack. add_named ( & scrolled_window, Some ( "list" ) ) ;
536536
537- let empty_page = adw:: StatusPage :: new ( ) ;
538- empty_page. set_title ( "No images found" ) ;
539- empty_page. set_description ( Some ( "You can use a custom image" ) ) ;
540- empty_page. set_icon_name ( Some ( "system-search-symbolic" ) ) ;
541-
542- let custom_image_btn = gtk:: Button :: with_label ( "Use custom image" ) ;
543- custom_image_btn. add_css_class ( "pill" ) ;
544- custom_image_btn. add_css_class ( "suggested-action" ) ;
545- custom_image_btn. set_halign ( gtk:: Align :: Center ) ;
537+ let empty_page = gtk:: Box :: new ( gtk:: Orientation :: Vertical , 4 ) ;
538+
539+ let custom_list = gtk:: ListBox :: new ( ) ;
540+ custom_list. add_css_class ( "navigation-sidebar" ) ;
541+ custom_list. set_selection_mode ( gtk:: SelectionMode :: None ) ;
542+
543+ let custom_row_item = image_row_item:: ImageRowItem :: new ( ) ;
544+ distro_icon:: remove_color ( & custom_row_item. imp ( ) . icon ) ;
546545
547- empty_page. set_child ( Some ( & custom_image_btn) ) ;
546+ custom_list. append ( & custom_row_item) ;
547+
548+ empty_page. append ( & custom_list) ;
548549 stack. add_named ( & empty_page, Some ( "empty" ) ) ;
549550
550551 view. set_content ( Some ( & stack) ) ;
@@ -564,33 +565,34 @@ impl CreateDistroboxDialog {
564565 stack. set_visible_child_name ( "empty" ) ;
565566 }
566567
567- // Update button label
568+ // Update custom row
568569 search_entry. connect_search_changed ( clone ! (
569570 #[ weak]
570- custom_image_btn,
571+ custom_row_item,
572+ #[ weak]
573+ custom_list,
571574 move |entry| {
572575 let text = entry. text( ) ;
573576 if text. is_empty( ) {
574- custom_image_btn. set_label( "Use custom image" ) ;
575- custom_image_btn. set_sensitive( false ) ;
577+ custom_list. set_sensitive( false ) ;
576578 } else {
577- custom_image_btn . set_label ( & format! ( "Use '{}'" , text ) ) ;
578- custom_image_btn . set_sensitive ( true ) ;
579+ custom_list . set_sensitive ( true ) ;
580+ custom_row_item . set_image ( & text ) ;
579581 }
580582 }
581583 ) ) ;
582584 // Initial button state
583585 if search_entry. text ( ) . is_empty ( ) {
584- custom_image_btn . set_sensitive ( false ) ;
586+ custom_list . set_sensitive ( false ) ;
585587 }
586588
587589 // Handle custom image selection
588- custom_image_btn . connect_clicked ( clone ! (
590+ custom_list . connect_row_activated ( clone ! (
589591 #[ weak( rename_to=this) ]
590592 self ,
591593 #[ weak]
592594 search_entry,
593- move |_| {
595+ move |_, _ | {
594596 let image = search_entry. text( ) ;
595597 if !image. is_empty( ) {
596598 this. imp( ) . selected_image. replace( image. to_string( ) ) ;
0 commit comments