[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[datasets 01/18] gui: Always convert file names to UTF-8 for use in synt
From: |
Ben Pfaff |
Subject: |
[datasets 01/18] gui: Always convert file names to UTF-8 for use in syntax. |
Date: |
Sat, 30 Apr 2011 22:36:29 -0700 |
Syntax as understood by the lexer is always in UTF-8, so file names
have to be in UTF-8 too. (The PSPP code that opens files based on
strings from syntax should already be using utf8_to_filename() to
convert them properly before opening.)
---
src/ui/gui/psppire-data-window.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c
index 9a3470a..72f8abb 100644
--- a/src/ui/gui/psppire-data-window.c
+++ b/src/ui/gui/psppire-data-window.c
@@ -351,19 +351,18 @@ dump_rm (GtkRecentManager *rm)
static gboolean
load_file (PsppireWindow *de, const gchar *file_name)
{
- gchar *native_file_name;
+ gchar *utf8_file_name;
struct string filename;
gchar *syntax;
bool ok;
ds_init_empty (&filename);
- native_file_name =
- convert_glib_filename_to_system_filename (file_name, NULL);
+ utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
- syntax_gen_string (&filename, ss_cstr (native_file_name));
+ syntax_gen_string (&filename, ss_cstr (utf8_file_name));
- g_free (native_file_name);
+ g_free (utf8_file_name);
syntax = g_strdup_printf ("GET FILE=%s.", ds_cstr (&filename));
ds_destroy (&filename);
@@ -496,7 +495,7 @@ name_has_suffix (const gchar *name)
static void
save_file (PsppireWindow *w)
{
- gchar *native_file_name = NULL;
+ gchar *utf8_file_name = NULL;
gchar *file_name = NULL;
GString *fnx;
struct string filename ;
@@ -517,13 +516,12 @@ save_file (PsppireWindow *w)
ds_init_empty (&filename);
- native_file_name =
- convert_glib_filename_to_system_filename (fnx->str, NULL);
+ utf8_file_name = g_filename_to_utf8 (fnx->str, -1, NULL, NULL, NULL);
g_string_free (fnx, TRUE);
- syntax_gen_string (&filename, ss_cstr (native_file_name));
- g_free (native_file_name);
+ syntax_gen_string (&filename, ss_cstr (utf8_file_name));
+ g_free (utf8_file_name);
syntax = g_strdup_printf ("%s OUTFILE=%s.",
de->save_as_portable ? "EXPORT" : "SAVE",
@@ -565,16 +563,16 @@ sysfile_info (PsppireDataWindow *de)
gchar *file_name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- gchar *native_file_name =
- convert_glib_filename_to_system_filename (file_name, NULL);
+ gchar *utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL,
+ NULL);
gchar *syntax;
ds_init_empty (&filename);
- syntax_gen_string (&filename, ss_cstr (native_file_name));
+ syntax_gen_string (&filename, ss_cstr (utf8_file_name));
- g_free (native_file_name);
+ g_free (utf8_file_name);
syntax = g_strdup_printf ("SYSFILE INFO %s.", ds_cstr (&filename));
g_free (execute_syntax_string (syntax));
--
1.7.2.5
- [datasets 02/18] gui: Put a separator line before list of windows in Windows menus., (continued)
- [datasets 02/18] gui: Put a separator line before list of windows in Windows menus., Ben Pfaff, 2011/05/01
- [datasets 09/18] gui: Remove obviously unnecessary #include directives., Ben Pfaff, 2011/05/01
- [datasets 06/18] gui: Use dispose instead of finalize method in PsppireDataWindow., Ben Pfaff, 2011/05/01
- [datasets 13/18] gui: Fix File|Open in syntax editor., Ben Pfaff, 2011/05/01
- [datasets 17/18] gui: Add ellipsis to menu items that require further input., Ben Pfaff, 2011/05/01
- [datasets 07/18] psppire-window: Use g_string_append_unichar() instead of global var., Ben Pfaff, 2011/05/01
- [datasets 08/18] gui: Include only <gtk/gtk.h> to use GTK+., Ben Pfaff, 2011/05/01
- [datasets 01/18] gui: Always convert file names to UTF-8 for use in syntax.,
Ben Pfaff <=
- [datasets 14/18] gui: Fix g_object_get() memory leaks for PsppireWindow's filename., Ben Pfaff, 2011/05/01
- [datasets 03/18] gui: Fix const-ness warning for measure_to_string() return type., Ben Pfaff, 2011/05/01
- [datasets 16/18] Implement DATASET commands., Ben Pfaff, 2011/05/01
- [datasets 10/18] gui: Prefer NULL to 0 for initializing pointers., Ben Pfaff, 2011/05/01
- [datasets 18/18] gui: Change View|Data and View|Variables to radio button menu items., Ben Pfaff, 2011/05/01