X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fwindow-manager.c;h=b78a341a0336d723ac4145e4ece3db2fcd39cc28;hb=b0edc00b3466899dab038e27452125315c859b37;hp=a4f5064d1801122bb714696d202e529fb1e8e3bc;hpb=8f157150f5fe225224e407161fb7f899d34b8b18;p=pspp-builds.git diff --git a/src/ui/gui/window-manager.c b/src/ui/gui/window-manager.c index a4f5064d..b78a341a 100644 --- a/src/ui/gui/window-manager.c +++ b/src/ui/gui/window-manager.c @@ -18,6 +18,10 @@ 02110-1301, USA. */ +#include + +#include "relocatable.h" + #include #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 *