From: John Darrington Date: Sat, 3 Sep 2011 11:29:47 +0000 (+0200) Subject: Filter file choosers by mimetype instead of file name X-Git-Tag: v0.7.9~145 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34bfbdd99ac80a84447cb8bbc46de726d0bdc7fc;p=pspp-builds.git Filter file choosers by mimetype instead of file name --- diff --git a/src/ui/gui/aggregate-dialog.c b/src/ui/gui/aggregate-dialog.c index 2ebb844e..b3ea30cc 100644 --- a/src/ui/gui/aggregate-dialog.c +++ b/src/ui/gui/aggregate-dialog.c @@ -171,14 +171,12 @@ choose_filename (struct aggregate *fd) filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("System Files (*.sav)")); - gtk_file_filter_add_pattern (filter, "*.sav"); - gtk_file_filter_add_pattern (filter, "*.SAV"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-sav"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Portable Files (*.por) ")); - gtk_file_filter_add_pattern (filter, "*.por"); - gtk_file_filter_add_pattern (filter, "*.POR"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-por"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index e51f827c..4a23cf1f 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -506,14 +506,12 @@ data_pick_filename (PsppireWindow *window) g_object_set (dialog, "local-only", FALSE, NULL); gtk_file_filter_set_name (filter, _("System Files (*.sav)")); - gtk_file_filter_add_pattern (filter, "*.sav"); - gtk_file_filter_add_pattern (filter, "*.SAV"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-sav"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Portable Files (*.por) ")); - gtk_file_filter_add_pattern (filter, "*.por"); - gtk_file_filter_add_pattern (filter, "*.POR"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-por"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new (); diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c index f2bd2d12..f6cdb7b2 100644 --- a/src/ui/gui/psppire-window.c +++ b/src/ui/gui/psppire-window.c @@ -721,24 +721,20 @@ psppire_window_file_chooser_dialog (PsppireWindow *toplevel) g_object_set (dialog, "local-only", FALSE, NULL); gtk_file_filter_set_name (filter, _("Data and Syntax Files")); - gtk_file_filter_add_pattern (filter, "*.sav"); - gtk_file_filter_add_pattern (filter, "*.SAV"); - gtk_file_filter_add_pattern (filter, "*.por"); - gtk_file_filter_add_pattern (filter, "*.POR"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-sav"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-por"); gtk_file_filter_add_pattern (filter, "*.sps"); gtk_file_filter_add_pattern (filter, "*.SPS"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("System Files (*.sav)")); - gtk_file_filter_add_pattern (filter, "*.sav"); - gtk_file_filter_add_pattern (filter, "*.SAV"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-sav"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Portable Files (*.por) ")); - gtk_file_filter_add_pattern (filter, "*.por"); - gtk_file_filter_add_pattern (filter, "*.POR"); + gtk_file_filter_add_mime_type (filter, "application/x-spss-por"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); filter = gtk_file_filter_new ();