Made the datasheet number cases from 1 instead of zero.
[pspp-builds.git] / src / ui / gui / window-manager.c
index a4f5064d1801122bb714696d202e529fb1e8e3bc..b78a341a0336d723ac4145e4ece3db2fcd39cc28 100644 (file)
     02110-1301, USA. */
 
 
+#include <config.h>
+
+#include "relocatable.h"
+
 #include <glib.h>
 #include "syntax-editor.h"
 #include "data-editor.h"
@@ -98,7 +102,7 @@ window_create (enum window_type type, const gchar *name)
 
 
   gtk_window_set_icon_from_file (GTK_WINDOW (e->window),
-                                PKGDATADIR "/psppicon.png", 0);
+                                relocate (PKGDATADIR "/psppicon.png"), 0);
 
   g_signal_connect (e->window, "destroy",
                    G_CALLBACK (deregister_window), e);
@@ -110,6 +114,11 @@ window_create (enum window_type type, const gchar *name)
   return e;
 }
 
+void
+default_window_name (struct editor_window *w)
+{
+  set_window_name (w, NULL);
+}
 
 static void
 set_window_name (struct editor_window *e,
@@ -118,11 +127,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 )
@@ -145,16 +155,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);
@@ -170,6 +183,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 *