Made the code relocatable (using the relocate function from gnulib).
[pspp-builds.git] / src / ui / gui / window-manager.c
index 507fe0db391e3398586354372ea911ae60ef49d4..b78a341a0336d723ac4145e4ece3db2fcd39cc28 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <config.h>
 
+#include "relocatable.h"
+
 #include <glib.h>
 #include "syntax-editor.h"
 #include "data-editor.h"
@@ -100,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);
@@ -157,14 +159,15 @@ set_window_name (struct editor_window *e,
    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);
@@ -180,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 *