Skip to content

Commit 0bd73c2

Browse files
committed
gui2/tfile_dialog: Disable the Delete button when the .. entry is selected
It doesn't do anything in that case anyway, and it really shouldn't.
1 parent fdd7b98 commit 0bd73c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/gui/dialogs/file_dialog.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ void tfile_dialog::refresh_fileview(twindow& window)
503503
//
504504

505505
tlistbox& filelist = find_widget<tlistbox>(&window, "filelist", false);
506+
tbutton& rm_button = find_widget<tbutton>(&window, "delete_file", false);
506507

507508
filelist.clear();
508509

@@ -513,6 +514,9 @@ void tfile_dialog::refresh_fileview(twindow& window)
513514
push_fileview_row(filelist, label_parent, icon_parent, false);
514515
if(current_entry_ == PARENT_DIR || current_entry_.empty()) {
515516
filelist.select_row(0, true);
517+
rm_button.set_active(false);
518+
} else {
519+
rm_button.set_active(true);
516520
}
517521
}
518522

@@ -600,6 +604,7 @@ void tfile_dialog::on_row_selected(twindow& window)
600604
{
601605
tlistbox& filelist = find_widget<tlistbox>(&window, "filelist", false);
602606
ttext_box& file_textbox = find_widget<ttext_box>(&window, "filename", false);
607+
tbutton& rm_button = find_widget<tbutton>(&window, "delete_file", false);
603608

604609
// Don't use register_new_selection() here, we don't want any parsing to be
605610
// performed at this point.
@@ -608,8 +613,10 @@ void tfile_dialog::on_row_selected(twindow& window)
608613
// Clear the textbox when selecting ..
609614
if(current_entry_ != PARENT_DIR) {
610615
set_input_text(file_textbox, current_entry_);
616+
rm_button.set_active(true);
611617
} else {
612618
clear_input_text(file_textbox);
619+
rm_button.set_active(false);
613620
}
614621

615622
// Need to do this every time so that input can still be sent to the

0 commit comments

Comments
 (0)