Filter file choosers by mimetype instead of file name
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 3 Sep 2011 11:29:47 +0000 (13:29 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 3 Sep 2011 11:29:47 +0000 (13:29 +0200)
src/ui/gui/aggregate-dialog.c
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-window.c

index 2ebb844ed5422273713dff074c04c445583b4649..b3ea30ccca7f60f7bb31e4814e0b3664302584c9 100644 (file)
@@ -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);
 
 
index e51f827cf3f30fb10c88cedd4c838ccc798450a0..4a23cf1f401b766d8065ac5ae271dd5410022a41 100644 (file)
@@ -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 ();
index f2bd2d120ffe469b8f6a17c91e1f7af9bac40f21..f6cdb7b24368f5686832569799a3beb522ec05a7 100644 (file)
@@ -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 ();