preference setting for the option to "avoid" the capture info dialog
svn path=/trunk/; revision=11195
This commit is contained in:
parent
7e8187df20
commit
17ca623b0f
|
@ -1,7 +1,7 @@
|
|||
/* capture_prefs.c
|
||||
* Dialog box for capture preferences
|
||||
*
|
||||
* $Id: capture_prefs.c,v 1.37 2004/06/12 07:47:14 guy Exp $
|
||||
* $Id: capture_prefs.c,v 1.38 2004/06/20 14:48:23 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -49,8 +49,9 @@
|
|||
#define PROM_MODE_KEY "prom_mode"
|
||||
#define CAPTURE_REAL_TIME_KEY "capture_real_time"
|
||||
#define AUTO_SCROLL_KEY "auto_scroll"
|
||||
#define SHOW_INFO_KEY "show_info"
|
||||
|
||||
#define CAPTURE_TABLE_ROWS 5
|
||||
#define CAPTURE_TABLE_ROWS 6
|
||||
|
||||
#define IFOPTS_CALLER_PTR_KEY "ifopts_caller_ptr"
|
||||
#define IFOPTS_DIALOG_PTR_KEY "ifopts_dialog_ptr"
|
||||
|
@ -80,11 +81,13 @@ GtkWidget*
|
|||
capture_prefs_show(void)
|
||||
{
|
||||
GtkWidget *main_tb, *main_vb;
|
||||
GtkWidget *if_cb, *if_lb, *promisc_cb, *sync_cb, *auto_scroll_cb;
|
||||
GtkWidget *if_cb, *if_lb, *promisc_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
|
||||
GtkWidget *ifopts_lb, *ifopts_bt;
|
||||
GList *if_list, *combo_list;
|
||||
int err;
|
||||
char err_str[PCAP_ERRBUF_SIZE];
|
||||
int row = 0;
|
||||
GtkTooltips *tooltips = gtk_tooltips_new();
|
||||
|
||||
/* Main vertical box */
|
||||
main_vb = gtk_vbox_new(FALSE, 7);
|
||||
|
@ -99,7 +102,7 @@ capture_prefs_show(void)
|
|||
|
||||
/* Default device */
|
||||
if_lb = gtk_label_new("Default interface:");
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), if_lb, 0, 1, 0, 1);
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), if_lb, 0, 1, row, row+1);
|
||||
gtk_misc_set_alignment(GTK_MISC(if_lb), 1.0, 0.5);
|
||||
gtk_widget_show(if_lb);
|
||||
|
||||
|
@ -117,38 +120,63 @@ capture_prefs_show(void)
|
|||
if (prefs.capture_device)
|
||||
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry),
|
||||
prefs.capture_device);
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), if_cb, 1, 2, 0, 1);
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), if_cb, 1, 2, row, row+1);
|
||||
gtk_tooltips_set_tip(tooltips, GTK_COMBO(if_cb)->entry,
|
||||
"The default interface to be captured from.", NULL);
|
||||
gtk_widget_show(if_cb);
|
||||
OBJECT_SET_DATA(main_vb, DEVICE_KEY, if_cb);
|
||||
row++;
|
||||
|
||||
/* Interface properties */
|
||||
ifopts_lb = gtk_label_new("Interfaces:");
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), ifopts_lb, 0, 1, 1, 2);
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), ifopts_lb, 0, 1, row, row+1);
|
||||
gtk_misc_set_alignment(GTK_MISC(ifopts_lb), 1.0, 0.5);
|
||||
gtk_widget_show(ifopts_lb);
|
||||
|
||||
ifopts_bt = BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_EDIT);
|
||||
gtk_tooltips_set_tip(tooltips, ifopts_bt,
|
||||
"Open a dialog box to set various interface options.", NULL);
|
||||
SIGNAL_CONNECT(ifopts_bt, "clicked", ifopts_edit_cb, NULL);
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), ifopts_bt, 1, 2, 1, 2 );
|
||||
gtk_table_attach_defaults(GTK_TABLE(main_tb), ifopts_bt, 1, 2, row, row+1);
|
||||
row++;
|
||||
|
||||
/* Promiscuous mode */
|
||||
promisc_cb = create_preference_check_button(main_tb, 2,
|
||||
promisc_cb = create_preference_check_button(main_tb, row++,
|
||||
"Capture packets in promiscuous mode:", NULL,
|
||||
prefs.capture_prom_mode);
|
||||
gtk_tooltips_set_tip(tooltips, promisc_cb,
|
||||
"Usually a network card will only capture the traffic sent to its own network address. "
|
||||
"If you want to capture all traffic that the network card can \"see\", mark this option. "
|
||||
"See the FAQ for some more details of capturing packets from a switched network.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, PROM_MODE_KEY, promisc_cb);
|
||||
|
||||
/* Real-time capture */
|
||||
sync_cb = create_preference_check_button(main_tb, 3,
|
||||
sync_cb = create_preference_check_button(main_tb, row++,
|
||||
"Update list of packets in real time:", NULL,
|
||||
prefs.capture_real_time);
|
||||
gtk_tooltips_set_tip(tooltips, sync_cb,
|
||||
"Update the list of packets while capture is in progress. "
|
||||
"Don't use this option if you notice packet drops.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, CAPTURE_REAL_TIME_KEY, sync_cb);
|
||||
|
||||
/* Auto-scroll real-time capture */
|
||||
auto_scroll_cb = create_preference_check_button(main_tb, 4,
|
||||
auto_scroll_cb = create_preference_check_button(main_tb, row++,
|
||||
"Automatic scrolling in live capture:", NULL,
|
||||
prefs.capture_auto_scroll);
|
||||
gtk_tooltips_set_tip(tooltips, auto_scroll_cb,
|
||||
"Automatic scrolling of the packet list while live capture is in progress. ", NULL);
|
||||
OBJECT_SET_DATA(main_vb, AUTO_SCROLL_KEY, auto_scroll_cb);
|
||||
|
||||
/* Show capture info dialog */
|
||||
show_info_cb = create_preference_check_button(main_tb, row++,
|
||||
"Hide capture info dialog:", NULL,
|
||||
!prefs.capture_show_info);
|
||||
gtk_tooltips_set_tip(tooltips, show_info_cb,
|
||||
"Hide the capture info dialog while capturing. "
|
||||
"Will only take effect, if the \"Update list of packets in real time\" "
|
||||
"option is also used.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, SHOW_INFO_KEY, show_info_cb);
|
||||
|
||||
/* Show 'em what we got */
|
||||
gtk_widget_show_all(main_vb);
|
||||
|
||||
|
@ -158,13 +186,14 @@ capture_prefs_show(void)
|
|||
void
|
||||
capture_prefs_fetch(GtkWidget *w)
|
||||
{
|
||||
GtkWidget *if_cb, *promisc_cb, *sync_cb, *auto_scroll_cb;
|
||||
GtkWidget *if_cb, *promisc_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
|
||||
gchar *if_text;
|
||||
|
||||
if_cb = (GtkWidget *)OBJECT_GET_DATA(w, DEVICE_KEY);
|
||||
promisc_cb = (GtkWidget *)OBJECT_GET_DATA(w, PROM_MODE_KEY);
|
||||
sync_cb = (GtkWidget *)OBJECT_GET_DATA(w, CAPTURE_REAL_TIME_KEY);
|
||||
auto_scroll_cb = (GtkWidget *)OBJECT_GET_DATA(w, AUTO_SCROLL_KEY);
|
||||
show_info_cb = (GtkWidget *)OBJECT_GET_DATA(w, SHOW_INFO_KEY);
|
||||
|
||||
if (prefs.capture_device != NULL) {
|
||||
g_free(prefs.capture_device);
|
||||
|
@ -187,6 +216,8 @@ capture_prefs_fetch(GtkWidget *w)
|
|||
prefs.capture_real_time = GTK_TOGGLE_BUTTON (sync_cb)->active;
|
||||
|
||||
prefs.capture_auto_scroll = GTK_TOGGLE_BUTTON (auto_scroll_cb)->active;
|
||||
|
||||
prefs.capture_show_info = !(GTK_TOGGLE_BUTTON (show_info_cb)->active);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.443 2004/06/20 13:39:44 ulfl Exp $
|
||||
* $Id: main.c,v 1.444 2004/06/20 14:48:24 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1653,7 +1653,7 @@ main(int argc, char *argv[])
|
|||
/* And do the same for "Automatic scrolling in live capture" mode. */
|
||||
auto_scroll_live = prefs->capture_auto_scroll;
|
||||
|
||||
capture_opts.show_info = TRUE;
|
||||
capture_opts.show_info = prefs->capture_show_info;
|
||||
#endif
|
||||
|
||||
/* Set the name resolution code's flags from the preferences. */
|
||||
|
|
12
prefs.c
12
prefs.c
|
@ -1,7 +1,7 @@
|
|||
/* prefs.c
|
||||
* Routines for handling preferences
|
||||
*
|
||||
* $Id: prefs.c,v 1.135 2004/05/30 18:27:52 ulfl Exp $
|
||||
* $Id: prefs.c,v 1.136 2004/06/20 14:48:23 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1023,6 +1023,7 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
|
|||
prefs.capture_prom_mode = TRUE;
|
||||
prefs.capture_real_time = FALSE;
|
||||
prefs.capture_auto_scroll = FALSE;
|
||||
prefs.capture_show_info = TRUE;
|
||||
prefs.name_resolve = RESOLV_ALL ^ RESOLV_NETWORK;
|
||||
prefs.name_resolve_concurrency = 500;
|
||||
}
|
||||
|
@ -1343,6 +1344,7 @@ prefs_set_pref(char *prefarg)
|
|||
#define PRS_CAP_PROM_MODE "capture.prom_mode"
|
||||
#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 RED_COMPONENT(x) (guint16) (((((x) >> 16) & 0xff) * 65535 / 255))
|
||||
#define GREEN_COMPONENT(x) (guint16) (((((x) >> 8) & 0xff) * 65535 / 255))
|
||||
|
@ -1668,6 +1670,8 @@ set_pref(gchar *pref_name, gchar *value)
|
|||
prefs.capture_real_time = ((strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
||||
} else if (strcmp(pref_name, PRS_CAP_AUTO_SCROLL) == 0) {
|
||||
prefs.capture_auto_scroll = ((strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
||||
} else if (strcmp(pref_name, PRS_CAP_SHOW_INFO) == 0) {
|
||||
prefs.capture_show_info = ((strcasecmp(value, "true") == 0)?TRUE:FALSE);
|
||||
|
||||
/* handle the global options */
|
||||
} else if (strcmp(pref_name, PRS_NAME_RESOLVE) == 0 ||
|
||||
|
@ -2285,6 +2289,11 @@ write_prefs(char **pf_path_return)
|
|||
fprintf(pf, PRS_CAP_AUTO_SCROLL ": %s\n",
|
||||
prefs.capture_auto_scroll == TRUE ? "TRUE" : "FALSE");
|
||||
|
||||
fprintf(pf, "\n# Show capture info dialog while capturing?\n");
|
||||
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
|
||||
fprintf(pf, PRS_CAP_SHOW_INFO ": %s\n",
|
||||
prefs.capture_show_info == TRUE ? "TRUE" : "FALSE");
|
||||
|
||||
fprintf (pf, "\n######## Printing ########\n");
|
||||
|
||||
fprintf (pf, "\n# Can be one of \"text\" or \"postscript\".\n"
|
||||
|
@ -2380,6 +2389,7 @@ copy_prefs(e_prefs *dest, e_prefs *src)
|
|||
dest->capture_prom_mode = src->capture_prom_mode;
|
||||
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->name_resolve = src->name_resolve;
|
||||
dest->name_resolve_concurrency = src->name_resolve_concurrency;
|
||||
|
||||
|
|
3
prefs.h
3
prefs.h
|
@ -1,7 +1,7 @@
|
|||
/* prefs.h
|
||||
* Definitions for preference handling routines
|
||||
*
|
||||
* $Id: prefs.h,v 1.64 2004/05/24 02:25:20 guy Exp $
|
||||
* $Id: prefs.h,v 1.65 2004/06/20 14:48:23 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -140,6 +140,7 @@ typedef struct _e_prefs {
|
|||
gboolean capture_prom_mode;
|
||||
gboolean capture_real_time;
|
||||
gboolean capture_auto_scroll;
|
||||
gboolean capture_show_info;
|
||||
} e_prefs;
|
||||
|
||||
ETH_VAR_IMPORT e_prefs prefs;
|
||||
|
|
Loading…
Reference in New Issue