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 "message-dialog.h"
37 #include <glade/glade.h>
46 static void enqueue_msg(const struct msg *m);
49 static GQueue *message_queue;
52 message_dialog_init (void)
54 message_queue = g_queue_new();
55 msg_init(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),
151 gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
153 gtk_dialog_run(GTK_DIALOG(dialog));
155 gtk_widget_destroy (dialog);
158 /* FIXME: This is a stub .
159 * A temporary workaround until getl.c is rearranged
162 msg_location (struct msg_locator *loc)
165 loc->line_number = -1;