Added a preference to turn of capture filter syntax check.
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 29 Jun 2011 10:42:29 +0000 (10:42 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 29 Jun 2011 10:42:29 +0000 (10:42 +0000)
This can be used to disable the effect in bug 5356.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37830 f5534014-38df-0310-8fa8-9805f1628bb7

epan/prefs.c
epan/prefs.h
gtk/capture_dlg.c
gtk/prefs_capture.c

index 9f7d8be5433d9182a11ee5788edd3c4b631d4603..7339a96809908489e321e36692635182cf96dcfe 100644 (file)
@@ -1302,6 +1302,7 @@ init_prefs(void) {
   prefs.capture_real_time             = TRUE;
   prefs.capture_auto_scroll           = TRUE;
   prefs.capture_show_info             = FALSE;
+  prefs.capture_syntax_check_filter   = TRUE;
 
 /* set the default values for the name resolution dialog box */
   prefs.name_resolve             = RESOLV_ALL ^ RESOLV_NETWORK;
@@ -1861,6 +1862,7 @@ prefs_capture_device_monitor_mode(const char *name)
 #define PRS_CAP_REAL_TIME            "capture.real_time_update"
 #define PRS_CAP_AUTO_SCROLL          "capture.auto_scroll"
 #define PRS_CAP_SHOW_INFO            "capture.show_info"
+#define PRS_CAP_SYNTAX_CHECK_FILTER  "capture.syntax_check_filter"
 
 #define RED_COMPONENT(x)   (guint16) (((((x) >> 16) & 0xff) * 65535 / 255))
 #define GREEN_COMPONENT(x) (guint16) (((((x) >>  8) & 0xff) * 65535 / 255))
@@ -2350,6 +2352,8 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_,
     prefs.capture_auto_scroll = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
   } else if (strcmp(pref_name, PRS_CAP_SHOW_INFO) == 0) {
     prefs.capture_show_info = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
+  } else if (strcmp(pref_name, PRS_CAP_SYNTAX_CHECK_FILTER) == 0) {
+    prefs.capture_syntax_check_filter = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
 
 /* handle the global options */
   } else if (strcmp(pref_name, PRS_NAME_RESOLVE) == 0 ||
@@ -3277,6 +3281,11 @@ write_prefs(char **pf_path_return)
   fprintf(pf, PRS_CAP_SHOW_INFO ": %s\n",
          prefs.capture_show_info == TRUE ? "TRUE" : "FALSE");
 
+  fprintf(pf, "\n# Syntax check capture filter?\n");
+  fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
+  fprintf(pf, PRS_CAP_SYNTAX_CHECK_FILTER ": %s\n",
+         prefs.capture_syntax_check_filter == TRUE ? "TRUE" : "FALSE");
+
   fprintf (pf, "\n######## Printing ########\n");
 
   fprintf (pf, "\n# Can be one of \"text\" or \"postscript\".\n"
@@ -3422,6 +3431,7 @@ copy_prefs(e_prefs *dest, e_prefs *src)
   dest->capture_real_time = src->capture_real_time;
   dest->capture_auto_scroll = src->capture_auto_scroll;
   dest->capture_show_info = src->capture_show_info;
+  dest->capture_syntax_check_filter = src->capture_syntax_check_filter;
   dest->name_resolve = src->name_resolve;
   dest->name_resolve_concurrency = src->name_resolve_concurrency;
   dest->display_hidden_proto_items = src->display_hidden_proto_items;
index 925961cbeaf5073ead5b63bfe059399bb1419717..ae5639c3739973f7134d7c0d57ce781259ed4ca3 100644 (file)
@@ -160,6 +160,7 @@ typedef struct _e_prefs {
   gboolean capture_real_time;
   gboolean capture_auto_scroll;
   gboolean capture_show_info;
+  gboolean capture_syntax_check_filter;
   guint    rtp_player_max_visible;
   guint    tap_update_interval;
   gboolean display_hidden_proto_items;
index b0331ee2c4a316c0a96b365af73f6762118a3e3c..2975e8d06d6ce6ac13c698aaf15d2df5e5b825aa 100644 (file)
@@ -264,6 +264,9 @@ capture_filter_check_syntax_cb(GtkWidget *w _U_, gpointer user_data _U_)
   GtkTreeModel *model;
 #endif
 
+  if (!prefs.capture_syntax_check_filter)
+    return;
+
   filter_cm = g_object_get_data(G_OBJECT(top_level), E_CFILTER_CM_KEY);
   filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
 #if GTK_CHECK_VERSION(2,24,0)
@@ -2257,12 +2260,14 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
 #if GTK_CHECK_VERSION(2,12,0)
   gtk_widget_set_tooltip_text(filter_cm,
     "Enter a capture filter to reduce the amount of packets to be captured. "
-    "See \"Capture Filters\" in the online help for further information how to use it."
+    "See \"Capture Filters\" in the online help for further information how to use it. "
+    "Syntax checking can be disabled in Preferences -> Capture -> Syntax check capture filter."
     );
 #else
   gtk_tooltips_set_tip(tooltips, filter_cm,
     "Enter a capture filter to reduce the amount of packets to be captured. "
     "See \"Capture Filters\" in the online help for further information how to use it.",
+    "Syntax checking can be disabled in Preferences -> Capture -> Syntax check capture filter."
     NULL);
 #endif
   gtk_box_pack_start(GTK_BOX(filter_hb), filter_cm, TRUE, TRUE, 3);
index 753d63ad867f576951b31b7d01e786d0c295bec4..fc9a41fa66ee18dbc08511e535d07dc7702be2ef 100644 (file)
@@ -54,6 +54,7 @@
 #define CAPTURE_REAL_TIME_KEY  "capture_real_time"
 #define AUTO_SCROLL_KEY                "auto_scroll"
 #define SHOW_INFO_KEY           "show_info"
+#define SYNTAX_CHECK_FILTER_KEY "syntax_check_filter"
 
 #define CAPTURE_TABLE_ROWS 6
 
@@ -98,7 +99,7 @@ GtkWidget*
 capture_prefs_show(void)
 {
        GtkWidget       *main_tb, *main_vb;
-       GtkWidget       *if_cbxe, *if_lb, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
+       GtkWidget       *if_cbxe, *if_lb, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb, *syntax_check_filter_cb;
        GtkWidget       *ifopts_lb, *ifopts_bt;
        GList           *if_list, *combo_list;
        int             err;
@@ -206,6 +207,13 @@ capture_prefs_show(void)
            !prefs.capture_show_info);
        g_object_set_data(G_OBJECT(main_vb), SHOW_INFO_KEY, show_info_cb);
 
+       /* Syntax check capture filter */
+       syntax_check_filter_cb = create_preference_check_button(main_tb, row++,
+           "Syntax check capture filter:",
+           "Syntax check capture filter. Turn this off if you experience delay when writing capture filters.",
+           prefs.capture_syntax_check_filter);
+       g_object_set_data(G_OBJECT(main_vb), SYNTAX_CHECK_FILTER_KEY, syntax_check_filter_cb);
+
        /* Show 'em what we got */
        gtk_widget_show_all(main_vb);
 
@@ -215,7 +223,7 @@ capture_prefs_show(void)
 void
 capture_prefs_fetch(GtkWidget *w)
 {
-       GtkWidget *if_cbxe, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
+       GtkWidget *if_cbxe, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb, *syntax_check_filter_cb;
        gchar   *if_text;
 
        if_cbxe    = (GtkWidget *)g_object_get_data(G_OBJECT(w), DEVICE_KEY);
@@ -224,6 +232,7 @@ capture_prefs_fetch(GtkWidget *w)
        sync_cb    = (GtkWidget *)g_object_get_data(G_OBJECT(w), CAPTURE_REAL_TIME_KEY);
        auto_scroll_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), AUTO_SCROLL_KEY);
         show_info_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), SHOW_INFO_KEY);
+        syntax_check_filter_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), SYNTAX_CHECK_FILTER_KEY);
 
        if (prefs.capture_device != NULL) {
                g_free(prefs.capture_device);
@@ -250,6 +259,7 @@ capture_prefs_fetch(GtkWidget *w)
        prefs.capture_auto_scroll = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(auto_scroll_cb));
 
        prefs.capture_show_info = !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(show_info_cb)));
+       prefs.capture_syntax_check_filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(syntax_check_filter_cb));
 }
 
 void