diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-26 09:18:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-26 09:18:23 -0700 |
commit | c3a484419731e680e343153f9fd32ed9e2695747 (patch) | |
tree | c689ec817d64597e998e4d3d2d251fa486e83191 /gtk-gui.c | |
parent | d81553e1514e158f59c1d7aba6ece46de9764163 (diff) | |
download | subsurface-c3a484419731e680e343153f9fd32ed9e2695747.tar.gz |
Add a xml file filter to the file open dialog
My home directory is a mess. Don't show all the crap, just the stuff
that might be relevant.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r-- | gtk-gui.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -87,6 +87,8 @@ void report_error(GError* error) static void file_open(GtkWidget *w, gpointer data) { GtkWidget *dialog; + GtkFileFilter *filter; + dialog = gtk_file_chooser_dialog_new("Open File", GTK_WINDOW(main_window), GTK_FILE_CHOOSER_ACTION_OPEN, @@ -95,6 +97,13 @@ static void file_open(GtkWidget *w, gpointer data) NULL); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); + filter = gtk_file_filter_new(); + gtk_file_filter_add_pattern(filter, "*.xml"); + gtk_file_filter_add_pattern(filter, "*.XML"); + gtk_file_filter_add_mime_type(filter, "text/xml"); + gtk_file_filter_set_name(filter, "XML file"); + gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { GSList *filenames; char *filename; |