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
28 #define _(msgid) gettext (msgid)
29 #define N_(msgid) msgid
31 #include <libpspp/message.h>
32 #include <libpspp/msg-locator.h>
33 #include "message-dialog.h"
38 #include <glade/glade.h>
47 static void enqueue_msg (const struct msg *m);
50 static GQueue *message_queue;
54 message_dialog_init (void)
56 message_queue = g_queue_new();
57 msg_init (enqueue_msg);
61 message_dialog_done (void)
64 g_queue_free(message_queue);
68 dequeue_message(gpointer data)
72 /* If a pointer grab is in effect, then the combination of that, and
73 a modal dialog box, will cause an impossible situation.
74 So don't pop it up just yet.
76 if ( gdk_pointer_is_grabbed())
79 m = g_queue_pop_tail(message_queue);
92 enqueue_msg(const struct msg *msg)
94 struct msg *m = msg_dup(msg);
96 g_queue_push_head(message_queue, m);
98 g_idle_add(dequeue_message, 0);
103 popup_message(const struct msg *m)
114 message_type = GTK_MESSAGE_ERROR;
117 message_type = GTK_MESSAGE_WARNING;
121 message_type = GTK_MESSAGE_INFO;
128 msg = _("Script Error");
132 msg = _("Data File Error");
137 msg = _("PSPP Error");
141 parent = GTK_WINDOW(get_widget_assert(xml, "data_editor"));
143 dialog = gtk_message_dialog_new(parent,
149 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
152 gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
154 gtk_dialog_run(GTK_DIALOG(dialog));
156 gtk_widget_destroy (dialog);