2 * Routines to put up various "standard" alert boxes used in multiple
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 /* With MSVC and a libethereal.dll this file needs to import some variables
27 in a special way. Therefore _NEED_VAR_IMPORT_ is defined. */
28 #define _NEED_VAR_IMPORT_
38 #include <epan/filesystem.h>
39 #include <epan/dfilter/dfilter.h>
41 #include "alert_box.h"
43 #include "simple_dialog.h"
46 * Alert box for general errors.
49 failure_alert_box(const char *msg_format, va_list ap)
51 vsimple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, msg_format, ap);
55 * Alert box for a failed attempt to open or create a file.
56 * "err" is assumed to be a UNIX-style errno; "for_writing" is TRUE if
57 * the file is being opened for writing and FALSE if it's being opened
60 * XXX - add explanatory secondary text for at least some of the errors;
61 * various HIGs suggest that you should, for example, suggest that the
62 * user remove files if the file system is full. Perhaps that's because
63 * they're providing guidelines for people less sophisticated than the
64 * typical Ethereal user is, but....
67 open_failure_alert_box(const char *filename, int err, gboolean for_writing)
69 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
70 file_open_error_message(err, for_writing), filename);
74 * Alert box for a failed attempt to read a file.
75 * "err" is assumed to be a UNIX-style errno.
78 read_failure_alert_box(const char *filename, int err)
80 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
81 "An error occurred while reading from the file \"%s\": %s.",
82 filename, strerror(err));
86 * Alert box for a failed attempt to write to a file.
87 * "err" is assumed to be a UNIX-style errno.
89 * XXX - add explanatory secondary text for at least some of the errors;
90 * various HIGs suggest that you should, for example, suggest that the
91 * user remove files if the file system is full. Perhaps that's because
92 * they're providing guidelines for people less sophisticated than the
93 * typical Ethereal user is, but....
96 write_failure_alert_box(const char *filename, int err)
98 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
99 file_write_error_message(err), filename);
103 * Alert box for an invalid display filter expression.
104 * Assumes "dfilter_error_msg" has been set by "dfilter_compile()" to the
105 * error message for the filter.
107 * XXX - should this have a "Help" button that pops up the display filter
111 bad_dfilter_alert_box(const char *dftext)
113 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
116 "The filter expression \"%s\" isn't a valid display filter.\n"
117 "See the help for a description of the display filter syntax.",
118 simple_dialog_primary_start(), dfilter_error_msg,
119 simple_dialog_primary_end(), dftext);