fn dl_edit(s: &mut Cursive, item: &str) {
    // get the settings dir
    let set_path = settings::settings_dir();
    // get the current download dir
    let dl_dir = settings::get_settings(&String::from(item)).unwrap();
    // transform the &str item to String
    let key = String::from(item);
    // Set-up the Download Dir EditView
    let edit = EditView::new()
        .content(dl_dir)
        .with_name("dl_edit")
        .fixed_width(70);

    // Create the Download Dir Dialog
    s.add_layer(
        Dialog::around(
            LinearLayout::vertical()
                .child(TextView::new("Set a path where files would be downloaded"))
                .child(edit),
        )
        .button("Ok", move |s| {
            let value = s
                .call_on_name("dl_edit", |view: &mut EditView| {
                    view.get_content().to_string()
                })
                .expect("Failed to get value");
            ok(s, &set_path, &key, value);
        })
        .button("Cancel", |s| set_tui(s))
        .title("Edit Download Directory")
        .fixed_size((70, 10)),
    );

    // Function that runs when the <Ok> button is pressed
    fn ok(s: &mut Cursive, set_path: &str, dir_key: &str, value: String) {
        settings::update_write_dir(&set_path, &dir_key, &value)
            .expect("Failed to write to database");
        s.pop_layer();
    }
}
/// Dialog box to edit the Downloads Directory

Dialog box to edit the Downloads Directory
Dialog box to edit the Downloads Directory
fn dl_edit(s: &mut Cursive, item: &str) {
    // get the settings dir
    let set_path = settings::settings_dir();
    // get the current download dir
    let dl_dir = settings::get_settings(&String::from(item)).unwrap();
    // transform the &str item to String
    let key = String::from(item);
    // Set-up the Download Dir EditView
    let edit = EditView::new()
        .content(dl_dir)
        .with_name("dl_edit")
        .fixed_width(70);
    // Create the Download Dir Dialog
    s.add_layer(
        Dialog::around(
            LinearLayout::vertical()
                .child(TextView::new("Set a path where files would be downloaded"))
                .child(edit),
        )
        .button("Ok", move |s| {
            let value = s
                .call_on_name("dl_edit", |view: &mut EditView| {
                    view.get_content().to_string()
                })
                .expect("Failed to get value");
            ok(s, &set_path, &key, value);
        })
        .button("Cancel", |s| set_tui(s))
        .title("Edit Download Directory")
        .fixed_size((70, 10)),
    );
    // Function that runs when the <Ok> button is pressed
    fn ok(s: &mut Cursive, set_path: &str, dir_key: &str, value: String) {
        settings::update_write_dir(&set_path, &dir_key, &value)
            .expect("Failed to write to database");
        s.pop_layer();
    }
}
fn dl_edit ( s : & mut Cursive , item : & str ) { // get the settings dir
 let set_path = settings :: settings_dir ( ) ; // get the current download dir
 let dl_dir = settings :: get_settings ( & String :: from ( item ) ) . unwrap ( ) ; // transform the &str item to String
 let key = String :: from ( item ) ; // Set-up the Download Dir EditView
 let edit = EditView :: new ( ) . content ( dl_dir ) . with_name ( " " ) . fixed_width ( 70 ) ; // Create the Download Dir Dialog
 s . add_layer ( Dialog :: around ( LinearLayout :: vertical ( ) . child ( TextView :: new ( " " ) ) . child ( edit ) , ) . button ( " " , move | s | { let value = s . call_on_name ( " " , | view : & mut EditView | { view . get_content ( ) . to_string ( ) } ) . expect ( " " ) ; ok ( s , & set_path , & key , value ) ; } ) . button ( " " , | s | set_tui ( s ) ) . title ( " " ) . fixed_size ( ( 70 , 10 ) ) , ) ; // Function that runs when the <Ok> button is pressed
 fn ok ( s : & mut Cursive , set_path : & str , dir_key : & str , value : String ) { settings :: update_write_dir ( & set_path , & dir_key , & value ) . expect ( " " ) ; s . pop_layer ( ) ; } }
Dialog box to edit the Downloads Directory
Dialog box to edit the Downloads Directory
s
&mut Cursive
item
&str
s
&mut Cursive
item
&str