- // parse filters
- wxArrayString wildDescriptions, wildFilters;
- if (!wxParseCommonDialogsFilter(wildCard, wildDescriptions, wildFilters))
- {
- wxFAIL_MSG( wxT("wxFileDialog::SetWildCard - bad wildcard string") );
- }
- else
- {
- // Parsing went fine. Set m_wildCard to be returned by wxFileDialogBase::GetWildcard
- m_wildCard = wildCard;
-
- GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
-
- // empty current filter list:
- GSList* ifilters = gtk_file_chooser_list_filters(chooser);
- GSList* filters = ifilters;
-
- while (ifilters)
- {
- gtk_file_chooser_remove_filter(chooser,GTK_FILE_FILTER(ifilters->data));
- ifilters = ifilters->next;
- }
- g_slist_free(filters);
-
- // add parsed to GtkChooser
- for (size_t n = 0; n < wildFilters.GetCount(); ++n)
- {
- GtkFileFilter* filter = gtk_file_filter_new();
- gtk_file_filter_set_name(filter, wxGTK_CONV(wildDescriptions[n]));
-
- wxStringTokenizer exttok(wildFilters[n], wxT(";"));
- while (exttok.HasMoreTokens())
- {
- wxString token = exttok.GetNextToken();
- gtk_file_filter_add_pattern(filter, wxGTK_CONV(token));
- }
-
- gtk_file_chooser_add_filter(chooser, filter);
- }
-
- // Reset the filter index
- SetFilterIndex(0);
- }