2 PSPPIRE --- A Graphical User Interface for PSPP
3 Copyright (C) 2004,2005 Free Software Foundation
4 Written by John Darrington
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #include <libpspp/message.h>
28 #include "message-dialog.h"
33 #include <glade/glade.h>
43 vmsg(int klass, const char *fmt, va_list args)
46 gchar *text = g_strdup_vprintf (fmt, args);
53 switch (msg_class_to_severity (klass))
56 message_type = GTK_MESSAGE_ERROR;
59 message_type = GTK_MESSAGE_WARNING;
63 message_type = GTK_MESSAGE_INFO;
67 switch (msg_class_to_category (klass))
70 msg = g_strdup(_("Script Error"));
74 msg = g_strdup(_("Data File Error"));
79 msg = g_strdup(_("PSPP Error"));
83 parent = GTK_WINDOW(get_widget_assert(xml, "data_editor"));
85 dialog = gtk_message_dialog_new(parent,
91 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), text);
96 gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
98 gtk_dialog_run(GTK_DIALOG(dialog));
100 gtk_widget_destroy (dialog);
106 msg(enum msg_class klass, const char *fmt, ...)
110 vmsg(klass, fmt, ap);
116 err_msg (const struct error *e)
118 vmsg(msg_class_from_category_and_severity (e->category, e->severity),
124 err_assert_fail(const char *expr, const char *file, int line)
126 msg(ME, "Assertion failed: %s:%d; (%s)\n",file,line,expr);
129 /* Writes MESSAGE formatted with printf, to stderr, if the
130 verbosity level is at least LEVEL. */
132 verbose_msg (int level, const char *format, ...)
134 /* Do nothing for now. */
137 /* FIXME: This is a stub .
138 * A temporary workaround until getl.c is rearranged
141 err_location (struct file_locator *f)