diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-01-13 20:35:12 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-01-13 20:35:12 +0000 |
commit | 0a03b0f73ef7595d7281097c94cccefa13059f7e (patch) | |
tree | c255fb8cb7e40c899ad998c9846d1dabb5bb9562 /gtk/capture_prefs.c | |
parent | 649cc279d6dad12744f67a23fa335e9ee2f55627 (diff) | |
download | wireshark-0a03b0f73ef7595d7281097c94cccefa13059f7e.tar.gz |
Add a preferences page for the name resolution flags.
Separate the preferences value for those flags and the name resolution
code's value into separate variables; this means that the resolution
code no longer depends on the preferences code, and may let us
eventually have the current setting and the preference setting differ
(so that a user can temporarily override the preference setting without
causing subsequent saves of the preferences to save the temporary
value).
Add routines to create various types of widgets for preferences, and to
fetch the values for "enumerated" preferences, and use them both in the
code to handle hardwired preference pages and table-driven preference
pages.
svn path=/trunk/; revision=4536
Diffstat (limited to 'gtk/capture_prefs.c')
-rw-r--r-- | gtk/capture_prefs.c | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/gtk/capture_prefs.c b/gtk/capture_prefs.c index d7b85eda63..4ae81e22b3 100644 --- a/gtk/capture_prefs.c +++ b/gtk/capture_prefs.c @@ -1,7 +1,7 @@ /* capture_prefs.c * Dialog box for capture preferences * - * $Id: capture_prefs.c,v 1.6 2002/01/12 11:02:47 guy Exp $ + * $Id: capture_prefs.c,v 1.7 2002/01/13 20:35:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -38,17 +38,13 @@ #include "capture_prefs.h" #include "gtkglobals.h" #include "prefs.h" -#include "prefs-int.h" +#include "prefs_dlg.h" #include "ui_util.h" #include "pcap-util.h" #include "main.h" #ifdef HAVE_LIBPCAP -static void create_option_check_button(GtkWidget *main_vb, const gchar *key, - GtkWidget *main_tb, int table_position, const gchar *label_text, - gboolean active); - #define DEVICE_KEY "device" #define PROM_MODE_KEY "prom_mode" #define CAPTURE_REAL_TIME_KEY "capture_real_time" @@ -59,7 +55,7 @@ GtkWidget* capture_prefs_show(void) { GtkWidget *main_tb, *main_vb; - GtkWidget *if_cb, *if_lb; + GtkWidget *if_cb, *if_lb, *promisc_cb, *sync_cb, *auto_scroll_cb; GList *if_list; int err; char err_str[PCAP_ERRBUF_SIZE]; @@ -98,16 +94,21 @@ capture_prefs_show(void) free_interface_list(if_list); /* Promiscuous mode */ - create_option_check_button(main_vb, PROM_MODE_KEY, main_tb, 1, + promisc_cb = create_preference_check_button(main_tb, 1, "Capture packets in promiscuous mode:", prefs.capture_prom_mode); + gtk_object_set_data(GTK_OBJECT(main_vb), PROM_MODE_KEY, promisc_cb); /* Real-time capture */ - create_option_check_button(main_vb, CAPTURE_REAL_TIME_KEY, main_tb, 2, + sync_cb = create_preference_check_button(main_tb, 2, "Update list of packets in real time:", prefs.capture_real_time); + gtk_object_set_data(GTK_OBJECT(main_vb), CAPTURE_REAL_TIME_KEY, + sync_cb); /* Auto-scroll real-time capture */ - create_option_check_button(main_vb, AUTO_SCROLL_KEY, main_tb, 3, + auto_scroll_cb = create_preference_check_button(main_tb, 3, "Automatic scrolling in live capture:", prefs.capture_auto_scroll); + gtk_object_set_data(GTK_OBJECT(main_vb), AUTO_SCROLL_KEY, + auto_scroll_cb); /* Show 'em what we got */ gtk_widget_show_all(main_vb); @@ -115,26 +116,6 @@ capture_prefs_show(void) return(main_vb); } -static void -create_option_check_button(GtkWidget *main_vb, const gchar *key, - GtkWidget *main_tb, int table_position, const gchar *label_text, - gboolean active) -{ - GtkWidget *label, *check_box; - - label = gtk_label_new(label_text); - gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); - gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, - table_position, table_position + 1); - - check_box = gtk_check_button_new(); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box), active); - gtk_table_attach_defaults(GTK_TABLE(main_tb), check_box, 1, 2, - table_position, table_position + 1); - - gtk_object_set_data(GTK_OBJECT(main_vb), key, check_box); -} - void capture_prefs_fetch(GtkWidget *w) { |