Skip to content

Commit

Permalink
gui2/tfile_dialog: Avoid redundant grid pointer retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
irydacea committed Oct 5, 2016
1 parent ef09ef9 commit c89b759
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gui/dialogs/file_dialog.cpp
Expand Up @@ -425,18 +425,16 @@ void tfile_dialog::push_fileview_row(tlistbox& filelist, const std::string& name
std::map<std::string, string_map> data;
data["icon"]["label"] = icon;
data["file"]["label"] = label;
filelist.add_row(data);

tgrid& last_grid = filelist.add_row(data);
const unsigned last_pos = filelist.get_item_count() - 1;
tgrid* const last_grid = filelist.get_row_grid(last_pos);
assert(last_grid);

//
// Crummy hack around the lack of an option to hook into row double click
// events for all rows using the GUI2 listbox API. Assign a special retval to
// each row that triggers a special check during dialog exit.
//
find_widget<ttoggle_panel>(last_grid, "item_panel", false)
find_widget<ttoggle_panel>(&last_grid, "item_panel", false)
.set_retval(FILE_DIALOG_ITEM_RETVAL);

if(check_selection && name == current_entry_) {
Expand Down

0 comments on commit c89b759

Please sign in to comment.