X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fwindow-manager.c;h=b78a341a0336d723ac4145e4ece3db2fcd39cc28;hb=9f472ebb86d3a1b4903bdde1c1371add0b70669a;hp=51fc95a91de9df69f0f26b000a25c4a75f0880a2;hpb=09a1109ddc398f36fe720208e1d38053850cbd2a;p=pspp-builds.git diff --git a/src/ui/gui/window-manager.c b/src/ui/gui/window-manager.c index 51fc95a9..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,18 +102,23 @@ 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); register_window (e); - gtk_widget_show (e->window); + gtk_widget_show (GTK_WIDGET (e->window)); 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 *