From: Ben Pfaff Date: Thu, 11 Mar 2021 03:53:21 +0000 (-0800) Subject: gui: Label unnamed syntax windows as "Untitled" in error messages. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb2e96df2d60b9e44a01692bac8206ecbde4b940;p=pspp gui: Label unnamed syntax windows as "Untitled" in error messages. Seems a little more user-friendly than just omitted a filename entirely. --- diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 6a84318ab5..4a480a4c63 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -200,7 +200,11 @@ editor_execute_syntax (const PsppireSyntaxWindow *sw, GtkTextIter start, struct lex_reader *reader = lex_reader_for_gtk_text_buffer ( GTK_TEXT_BUFFER (sw->buffer), start, stop, sw->syntax_mode); - lex_reader_set_file_name (reader, psppire_window_get_filename (win)); + const gchar *filename = psppire_window_get_filename (win); + /* TRANSLATORS: This is part of a filename. Please avoid whitespace. */ + gchar *untitled = xasprintf ("%s.sps", _("Untitled")); + lex_reader_set_file_name (reader, filename ? filename : untitled); + free (untitled); execute_syntax (psppire_default_data_window (), reader); }