X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fwindow-manager.c;h=cea00fed1c0ff3c56f786cd3b33478676e79686d;hb=d52355bcda20563736bd83aed3ab58e534672cb5;hp=d7c543a40e70d7944cc6f381491eb6959d4b06a1;hpb=5023955f3e48b1b0a703a38d654467360c0794a6;p=pspp-builds.git diff --git a/src/ui/gui/window-manager.c b/src/ui/gui/window-manager.c index d7c543a4..cea00fed 100644 --- a/src/ui/gui/window-manager.c +++ b/src/ui/gui/window-manager.c @@ -1,3 +1,24 @@ +/* PSPPIRE - a graphical user interface for PSPP. + Copyright (C) 2006, 2007 Free Software Foundation + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + + +#include + +#include "relocatable.h" + #include #include "syntax-editor.h" #include "data-editor.h" @@ -78,18 +99,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, @@ -98,11 +124,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 ) @@ -125,16 +152,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); @@ -150,6 +180,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 *