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;
53 msg_location (struct msg_locator *loc)
55 loc->file_name = NULL;
56 loc->line_number = -1;
61 message_dialog_init (void)
63 message_queue = g_queue_new();
64 msg_init (enqueue_msg, msg_location);
69 message_dialog_done (void)
72 g_queue_free(message_queue);
76 dequeue_message(gpointer data)
80 /* If a pointer grab is in effect, then the combination of that, and
81 a modal dialog box, will cause an impossible situation.
82 So don't pop it up just yet.
84 if ( gdk_pointer_is_grabbed())
87 m = g_queue_pop_tail(message_queue);
100 enqueue_msg(const struct msg *msg)
102 struct msg *m = msg_dup(msg);
104 g_queue_push_head(message_queue, m);
106 g_idle_add(dequeue_message, 0);
111 popup_message(const struct msg *m)
122 message_type = GTK_MESSAGE_ERROR;
125 message_type = GTK_MESSAGE_WARNING;
129 message_type = GTK_MESSAGE_INFO;
136 msg = _("Script Error");
140 msg = _("Data File Error");
145 msg = _("PSPP Error");
149 parent = GTK_WINDOW(get_widget_assert(xml, "data_editor"));
151 dialog = gtk_message_dialog_new(parent,
157 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
160 gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
162 gtk_dialog_run(GTK_DIALOG(dialog));
164 gtk_widget_destroy (dialog);