Convert filename encodings when opening files.
[pspp-builds.git] / src / ui / gui / psppire-syntax-window.c
index 86d87bb92b22a4f7a5086215b8ba7e26eb8e4745..03b4093bbba6eb930b3c5e3f27efc7b44b7e6e3e 100644 (file)
@@ -414,10 +414,10 @@ on_text_changed (GtkTextBuffer *buffer, PsppireSyntaxWindow *window)
 static void
 on_modified_changed (GtkTextBuffer *buffer, PsppireWindow *window)
 {
-  psppire_window_set_unsaved (window, gtk_text_buffer_get_modified (buffer));
+  if (gtk_text_buffer_get_modified (buffer))
+    psppire_window_set_unsaved (window);
 }
 
-
 extern struct source_stream *the_source_stream ;
 
 static void
@@ -563,26 +563,14 @@ syntax_load (PsppireWindow *window, const gchar *filename)
   GtkTextIter iter;
   PsppireSyntaxWindow *sw = PSPPIRE_SYNTAX_WINDOW (window);
 
-  gchar *glibfilename = g_filename_from_utf8 (filename, -1, 0, 0, NULL);
-
-  if ( ! glibfilename )
-    return FALSE;
-
   /* FIXME: What if it's a very big file ? */
-  if ( ! g_file_get_contents (glibfilename, &text, NULL, NULL) )
-    {
-      g_free (glibfilename);
-      return FALSE;
-    }
-
-  g_free (glibfilename);
+  if ( ! g_file_get_contents (filename, &text, NULL, NULL) )
+    return FALSE;
 
   gtk_text_buffer_get_iter_at_line (sw->buffer, &iter, 0);
 
   gtk_text_buffer_insert (sw->buffer, &iter, text, -1);
 
-  psppire_window_set_filename (window, filename);
-
   gtk_text_buffer_set_modified (sw->buffer, FALSE);
 
   return TRUE;