Quoted strings in generated syntax.
[pspp-builds.git] / src / ui / gui / window-manager.c
index f25a97ab85ab0127107e7deba02770796777aee1..0bdc2390b1edfd0c17e4e8dffaf6f4cd2cd353b5 100644 (file)
@@ -18,6 +18,8 @@
     02110-1301, USA. */
 
 
+#include <config.h>
+
 #include <glib.h>
 #include "syntax-editor.h"
 #include "data-editor.h"
@@ -123,11 +125,12 @@ set_window_name (struct editor_window *e,
   gchar *title ;
   g_free (e->name);
 
+  e->name = NULL;
 
   if ( name )
     {
-      e->name = g_strdup (name);
-      return ;
+      e->name =  g_strdup (name);
+      return;
     }
 
   switch (e->type )
@@ -150,16 +153,19 @@ set_window_name (struct editor_window *e,
 }
 
 
+/* Set the name of this window based on FILENAME.
+   FILENAME is in "filename encoding" */
 void
 window_set_name_from_filename (struct editor_window *e,
-                              const gchar *filename)
+                              const gchar *fn)
 {
   gchar *title;
+  gchar *filename = g_filename_to_utf8 (fn, -1, NULL, NULL, NULL);
   gchar *basename = g_path_get_basename (filename);
 
   set_window_name (e, filename);
 
-  switch (e->type )
+  switch (e->type)
     {
     case WINDOW_SYNTAX:
       title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), basename);
@@ -175,6 +181,7 @@ window_set_name_from_filename (struct editor_window *e,
   gtk_window_set_title (GTK_WINDOW (e->window), title);
 
   g_free (title);
+  g_free (filename);
 }
 
 const gchar *