g_signal_connect_swapped (window, "delete-event", G_CALLBACK (on_delete), window);
- g_object_set (window, "icon-name", "psppicon", NULL);
+ g_object_set (window, "icon-name", "pspp", NULL);
g_signal_connect (window, "realize",
G_CALLBACK (on_realize), window);
description);
g_free (description);
- g_object_set (dialog, "icon-name", "psppicon", NULL);
+ g_object_set (dialog, "icon-name", "pspp", NULL);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("If you don't save, changes from the last %ld seconds will be permanently lost."),
return ok;
}
+
+static void
+on_selection_changed (GtkFileChooser *chooser, GtkWidget *encoding_selector)
+{
+ const gchar *sysname;
+
+ const gchar *name = gtk_file_chooser_get_filename (chooser);
+
+ if ( NULL == name )
+ return;
+
+ sysname = convert_glib_filename_to_system_filename (name, NULL);
+
+ gtk_widget_set_sensitive (encoding_selector, ! any_reader_may_open (sysname));
+}
+
GtkWidget *
psppire_window_file_chooser_dialog (PsppireWindow *toplevel)
{
+ GtkFileFilter *filter = gtk_file_filter_new ();
GtkWidget *dialog =
gtk_file_chooser_dialog_new (_("Open"),
GTK_WINDOW (toplevel),
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- GtkFileFilter *filter;
+ g_object_set (dialog, "local-only", FALSE, NULL);
- filter = gtk_file_filter_new ();
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 ();
free (dir_name);
}
- gtk_file_chooser_set_extra_widget (
- GTK_FILE_CHOOSER (dialog), psppire_encoding_selector_new ("Auto", true));
+
+ {
+ GtkWidget *encoding_selector = psppire_encoding_selector_new ("Auto", true);
+ gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), encoding_selector);
+
+ g_signal_connect (dialog, "selection-changed", G_CALLBACK (on_selection_changed), encoding_selector);
+ }
return dialog;
}