projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RUNS: Correct calculation of significance.
[pspp]
/
src
/
ui
/
gui
/
psppire-data-window.c
diff --git
a/src/ui/gui/psppire-data-window.c
b/src/ui/gui/psppire-data-window.c
index ca4f21e2219236f07db4bbeb626ad6d9eda59908..28ec605205106c9f8e4ee7e3924a66279572ef4f 100644
(file)
--- a/
src/ui/gui/psppire-data-window.c
+++ b/
src/ui/gui/psppire-data-window.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation
+ Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013
, 2014
Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-35,6
+35,7
@@
#include "ui/gui/helper.h"
#include "ui/gui/psppire-data-window.h"
#include "ui/gui/psppire-dialog-action.h"
#include "ui/gui/helper.h"
#include "ui/gui/psppire-data-window.h"
#include "ui/gui/psppire-dialog-action.h"
+#include "ui/gui/psppire-encoding-selector.h"
#include "ui/gui/psppire-syntax-window.h"
#include "ui/gui/psppire-window.h"
#include "ui/gui/psppire.h"
#include "ui/gui/psppire-syntax-window.h"
#include "ui/gui/psppire-window.h"
#include "ui/gui/psppire.h"
@@
-331,7
+332,8
@@
name_has_suffix (const gchar *name)
}
static gboolean
}
static gboolean
-load_file (PsppireWindow *de, const gchar *file_name, gpointer syn)
+load_file (PsppireWindow *de, const gchar *file_name, const char *encoding,
+ gpointer syn)
{
const char *mime_type = NULL;
gchar *syntax = NULL;
{
const char *mime_type = NULL;
gchar *syntax = NULL;
@@
-341,17
+343,23
@@
load_file (PsppireWindow *de, const gchar *file_name, gpointer syn)
{
gchar *utf8_file_name;
struct string filename;
{
gchar *utf8_file_name;
struct string filename;
- ds_init_empty (&filename);
utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
-
+
+ if (NULL == utf8_file_name)
+ return FALSE;
+
+ ds_init_empty (&filename);
syntax_gen_string (&filename, ss_cstr (utf8_file_name));
g_free (utf8_file_name);
syntax_gen_string (&filename, ss_cstr (utf8_file_name));
g_free (utf8_file_name);
-
- syntax = g_strdup_printf ("GET FILE=%s.", ds_cstr (&filename));
- ds_destroy (&filename);
+ if (encoding && encoding[0])
+ syntax = g_strdup_printf ("GET FILE=%s ENCODING='%s'.",
+ ds_cstr (&filename), encoding);
+ else
+ syntax = g_strdup_printf ("GET FILE=%s.", ds_cstr (&filename));
+ ds_destroy (&filename);
}
else
{
}
else
{
@@
-369,7
+377,7
@@
load_file (PsppireWindow *de, const gchar *file_name, gpointer syn)
else if (name_has_sav_suffix (file_name))
mime_type = "application/x-spss-sav";
else if (name_has_sav_suffix (file_name))
mime_type = "application/x-spss-sav";
- add_most_recent (file_name, mime_type);
+ add_most_recent (file_name, mime_type
, encoding
);
}
return ok;
}
return ok;
@@
-443,10
+451,12
@@
sysfile_info (PsppireDataWindow *de)
struct string filename;
gchar *file_name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
struct string filename;
gchar *file_name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
gchar *utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL,
NULL);
gchar *utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL,
NULL);
+ const gchar *encoding = psppire_encoding_selector_get_encoding (
+ gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog)));
+
gchar *syntax;
ds_init_empty (&filename);
gchar *syntax;
ds_init_empty (&filename);
@@
-455,7
+465,11
@@
sysfile_info (PsppireDataWindow *de)
g_free (utf8_file_name);
g_free (utf8_file_name);
- syntax = g_strdup_printf ("SYSFILE INFO %s.", ds_cstr (&filename));
+ if (encoding)
+ syntax = g_strdup_printf ("SYSFILE INFO %s ENCODING='%s'.",
+ ds_cstr (&filename), encoding);
+ else
+ syntax = g_strdup_printf ("SYSFILE INFO %s.", ds_cstr (&filename));
g_free (execute_syntax_string (de, syntax));
}
g_free (execute_syntax_string (de, syntax));
}
@@
-753,7
+767,7
@@
on_recent_data_select (GtkMenuShell *menushell,
g_free (uri);
g_free (uri);
- open_data_window (window, file, NULL);
+ open_data_window (window, file, NULL
, NULL
);
g_free (file);
}
g_free (file);
}
@@
-816,7
+830,7
@@
on_recent_files_select (GtkMenuShell *menushell, gpointer user_data)
free (encoding);
free (encoding);
- if ( psppire_window_load (PSPPIRE_WINDOW (se), file, NULL) )
+ if ( psppire_window_load (PSPPIRE_WINDOW (se), file,
encoding,
NULL) )
gtk_widget_show (se);
else
gtk_widget_destroy (se);
gtk_widget_show (se);
else
gtk_widget_destroy (se);
@@
-1359,7
+1373,8
@@
create_data_window (void)
}
void
}
void
-open_data_window (PsppireWindow *victim, const char *file_name, gpointer hint)
+open_data_window (PsppireWindow *victim, const char *file_name,
+ const char *encoding, gpointer hint)
{
GtkWidget *window;
{
GtkWidget *window;
@@
-1372,7
+1387,7
@@
open_data_window (PsppireWindow *victim, const char *file_name, gpointer hint)
else
window = psppire_data_window_new (NULL);
else
window = psppire_data_window_new (NULL);
- psppire_window_load (PSPPIRE_WINDOW (window), file_name, hint);
+ psppire_window_load (PSPPIRE_WINDOW (window), file_name,
encoding,
hint);
gtk_widget_show_all (window);
}
gtk_widget_show_all (window);
}