Skip to content

Instantly share code, notes, and snippets.

@chebert
Created July 23, 2014 05:30
Show Gist options
  • Select an option

  • Save chebert/2fd3fa55209652d65dbd to your computer and use it in GitHub Desktop.

Select an option

Save chebert/2fd3fa55209652d65dbd to your computer and use it in GitHub Desktop.
struct FileChooserDialog {
private:
struct FileCompare {
bool operator() (const Glib::RefPtr<Gio::File>& a, const Glib::RefPtr<Gio::File>& b) const {
std::clog << (a->equal(b) ? "equal" : "not equal") << std::endl;
return a->equal(b);
}
};
public:
std::set<Glib::RefPtr<Gio::File>, FileCompare> chosen_files;
};
void add_files_button_clicked_handler() {
auto& dialog = app_data.file_chooser_dialog;
for (auto file : dialog.dialog->get_files()) {
auto& chosen_files = dialog.chosen_files;
if (chosen_files.count(file) == 0) {
chosen_files.insert(file);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment