aboutsummaryrefslogtreecommitdiffstats
path: root/alert_box.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-02-11 00:55:28 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-02-11 00:55:28 +0000
commit0ae3628a21cf8805f34beaee553853439901c667 (patch)
treef8fffbcd13372b006038bc1b0bc344368f7dc429 /alert_box.c
parent566ab40b3f5b270f443d1d38e9ae404e05986470 (diff)
Add a routine to be used to put up alert boxes for invalid display
filter expressions; use that in a number of places, so we use the same alert box. (More work is needed to figure out the right way to handle some other "dfilter_compile()" failures.) Use the error message from the display filter as the primary error, as that's the message that tells you what the underlying problem is. (The GNOME HIG says "In most situations the user should only need the primary text to make a quick decision", so the primary text should tell you what's wrong with the filter, not just that it's invalid. If there are messages from the display filter code that don't give enough information, or are a bit cryptic, such as "Unexpected end of filter string," those should be fixed in the display filter code.) Improve the error used if an empty filter is used for "find frame". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10025 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'alert_box.c')
-rw-r--r--alert_box.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/alert_box.c b/alert_box.c
new file mode 100644
index 0000000000..c2f8784acc
--- /dev/null
+++ b/alert_box.c
@@ -0,0 +1,56 @@
+/* alert_box.c
+ * Routines to put up various "standard" alert boxes used in multiple
+ * places
+ *
+ * $Id: alert_box.c,v 1.1 2004/02/11 00:55:26 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+
+#include <epan/dfilter/dfilter.h>
+
+#include "alert_box.h"
+
+#include "simple_dialog.h"
+
+/*
+ * Alert box for an invalid display filter expression.
+ * Assumes "dfilter_error_msg" has been set by "dfilter_compile()" to the
+ * error message for the filter.
+ *
+ * XXX - should this have a "Help" button that pops up the display filter
+ * help?
+ */
+void
+bad_dfilter_alert_box(const char *dftext)
+{
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "%s%s%s\n"
+ "\n"
+ "The filter expression \"%s\" is not a valid display filter.\n"
+ "See the help for a description of the display filter syntax.",
+ simple_dialog_primary_start(), dfilter_error_msg,
+ simple_dialog_primary_end(), dftext);
+}