X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire.c;h=e03a84b433bad7eb752c666abeac23d36384a16d;hb=e0cbdf0daefcca81be9572aab0deedf945687f5a;hp=e897c599b69bc50a5e6b0108b235ac8bb2848602;hpb=29917c4f5908454803e663d2ad78bca4bc35e805;p=pspp diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index e897c599b6..e03a84b433 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -1,5 +1,6 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011, 2012, 2013, 2014, 2016 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011, 2012, 2013, 2014, + 2016 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 @@ -139,41 +140,33 @@ psppire_quit (GApplication *app) g_application_quit (app); } -struct icon_size -{ - int resolution; /* The dimension of the images which will be used */ - size_t n_sizes; /* The number of items in the array below. */ - const GtkIconSize *usage; /* An array determining for what the icon set is used */ -}; static void -handle_msg (const struct msg *m_, void *lexer_) +handle_msg (const struct msg *m_, struct lexer *lexer) { - struct lexer *lexer = lexer_; - struct msg m = *m_; - - if (lexer != NULL && m.file_name == NULL) - { - m.file_name = CONST_CAST (char *, lex_get_file_name (lexer)); - m.first_line = lex_get_first_line_number (lexer, 0); - m.last_line = lex_get_last_line_number (lexer, 0); - m.first_column = lex_get_first_column (lexer, 0); - m.last_column = lex_get_last_column (lexer, 0); - } - m.command_name = output_get_uppercase_command_name (); + struct msg m = { + .category = m_->category, + .severity = m_->severity, + .location = (m_->location ? m_->location + : lexer ? lex_get_location (lexer, 0, 0) + : NULL), + .command_name = output_get_uppercase_command_name (), + .text = m_->text, + }; output_item_submit (message_item_create (&m)); free (m.command_name); + if (m.location != m_->location) + msg_location_destroy (m.location); } void psppire_set_lexer (struct lexer *lexer) { - msg_set_handler (handle_msg, lexer); + lex_set_message_handler (lexer, handle_msg); } - GtkWindow * psppire_preload_file (const gchar *file, GtkWindow *victim) {