2 PSPPIRE --- A Graphical User Interface for PSPP
3 Copyright (C) 2004,2005 Free Software Foundation
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #define _(msgid) gettext (msgid)
28 #define N_(msgid) msgid
30 #include <libpspp/message.h>
31 #include <libpspp/msg-locator.h>
32 #include "message-dialog.h"
37 #include <glade/glade.h>
46 static void enqueue_msg (const struct msg *m);
49 static GQueue *message_queue;
53 message_dialog_init (struct source_stream *ss)
55 message_queue = g_queue_new();
56 msg_init (ss, enqueue_msg);
60 message_dialog_done (void)
63 g_queue_free(message_queue);
67 dequeue_message(gpointer data)
71 /* If a pointer grab is in effect, then the combination of that, and
72 a modal dialog box, will cause an impossible situation.
73 So don't pop it up just yet.
75 if ( gdk_pointer_is_grabbed())
78 m = g_queue_pop_tail(message_queue);
91 enqueue_msg(const struct msg *msg)
93 struct msg *m = msg_dup(msg);
95 g_queue_push_head(message_queue, m);
97 g_idle_add(dequeue_message, 0);
102 popup_message(const struct msg *m)
113 message_type = GTK_MESSAGE_ERROR;
116 message_type = GTK_MESSAGE_WARNING;
120 message_type = GTK_MESSAGE_INFO;
127 msg = _("Script Error");
131 msg = _("Data File Error");
136 msg = _("PSPP Error");
140 parent = GTK_WINDOW(get_widget_assert(xml, "data_editor"));
142 dialog = gtk_message_dialog_new(parent,
148 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
149 _("%s (line %d) %s"),
151 m->where.line_number,
154 gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
156 gtk_dialog_run(GTK_DIALOG(dialog));
158 gtk_widget_destroy (dialog);