along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+#include <gl/relocatable.h>
#include "psppire-window.h"
#include "psppire-window-base.h"
#define N_(msgid) msgid
#include "data/any-reader.h"
-#include "data/file-name.h"
+#include "data/file-handle-def.h"
#include "data/dataset.h"
+#include "libpspp/version.h"
#include "helper.h"
#include "psppire-data-window.h"
#include "psppire-encoding-selector.h"
#include "psppire-syntax-window.h"
#include "psppire-window-register.h"
-#include "psppire.h"
static void psppire_window_base_init (PsppireWindowClass *class);
static void psppire_window_class_init (PsppireWindowClass *class);
static void
menu_toggled (GtkCheckMenuItem *mi, gpointer data)
{
+#if GTK3_TRANSITION
/* Prohibit changes to the state */
mi->active = !mi->active;
+#endif
}
gtk_menu_shell_append (window->menu, item);
+#if GTK3_TRANSITION
/* Set the state without emitting a signal */
GTK_CHECK_MENU_ITEM (item)->active =
(psppire_window_register_lookup (psppire_window_register_new (), key) == window);
+#endif
g_hash_table_insert (window->menuitem_table, key, item);
}
GTK_RESPONSE_REJECT);
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL,
+ _("Cancel"),
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dialog),
- GTK_STOCK_SAVE,
+ _("Save"),
GTK_RESPONSE_APPLY);
gtk_widget_grab_focus (cancel_button);
gtk_file_chooser_dialog_new (_("Open"),
GTK_WINDOW (toplevel),
GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ _("Cancel"), GTK_RESPONSE_CANCEL,
+ _("Open"), GTK_RESPONSE_ACCEPT,
NULL);
g_object_set (dialog, "local-only", FALSE, NULL);
{
GtkWidget *dialog = psppire_window_file_chooser_dialog (de);
+ gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), relocate (examples_dir), NULL);
+
switch (gtk_dialog_run (GTK_DIALOG (dialog)))
{
case GTK_RESPONSE_ACCEPT:
gchar *name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- gchar *sysname = convert_glib_filename_to_system_filename (name, NULL);
+ const gchar **cs = NULL;
+ g_get_filename_charsets (&cs);
gchar *encoding = psppire_encoding_selector_get_encoding (
gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog)));
- enum detect_result res = any_reader_may_open (sysname);
- if (ANY_YES == res)
+ struct file_handle *fh = fh_create_file (NULL, name, cs[0], fh_default_properties ());
+
+ int retval = any_reader_detect (fh, NULL);
+ if (retval == 1)
open_data_window (de, name, encoding, NULL);
- else if (ANY_NO == res)
+ else if (retval == 0)
open_syntax_window (name, encoding);
g_free (encoding);
- g_free (sysname);
+ fh_unref (fh);
g_free (name);
}
break;