diff options
author | Gerald Combs <gerald@wireshark.org> | 2006-10-20 23:22:53 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2006-10-20 23:22:53 +0000 |
commit | fd2d2df09f16a93e8cbbeb486d95985333e1d7b1 (patch) | |
tree | 0a77204b8b95e08cbe212b3a30aa923da9e8efb8 /gtk | |
parent | ca3d2d22e0a6bf0a51a46426c71346c866bb1050 (diff) |
AirPcap fixes from Giorgio Tino:
1) When choosing to Merge, Import or Keep decryption keys, key lists will be saved to the preferences file AND into the registry.
2) Now if you check/uncheck the WEP deccryption checkbox in the Preferences..., the AirPcap toolbar will be modified as well.
svn path=/trunk/; revision=19646
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/airpcap_dlg.c | 6 | ||||
-rwxr-xr-x | gtk/airpcap_gui_utils.h | 2 | ||||
-rw-r--r-- | gtk/main.c | 2 | ||||
-rw-r--r-- | gtk/prefs_dlg.c | 71 |
4 files changed, 79 insertions, 2 deletions
diff --git a/gtk/airpcap_dlg.c b/gtk/airpcap_dlg.c index 8cd7cc2fd6..1a50de2c7a 100644 --- a/gtk/airpcap_dlg.c +++ b/gtk/airpcap_dlg.c @@ -3308,6 +3308,9 @@ n_merged_keys = g_list_length(merged_list); /* Set up this new list as default for Wireshark and Adapters... */ airpcap_save_decryption_keys(merged_list,airpcap_if_list); +/* Write the preferences to the preferences file */ +write_prefs_to_file(); + free_key_list(wireshark_keys); gtk_widget_destroy(keys_check_w); @@ -3372,6 +3375,9 @@ n_merged_keys = g_list_length(merged_list); /* Set up this new list as default for Wireshark and Adapters... */ airpcap_save_decryption_keys(merged_list,airpcap_if_list); +/* Write the preferences to the preferences file */ +write_prefs_to_file(); + free_key_list(wireshark_keys); gtk_widget_destroy(keys_check_w); diff --git a/gtk/airpcap_gui_utils.h b/gtk/airpcap_gui_utils.h index 2c2f256540..c953c31209 100755 --- a/gtk/airpcap_gui_utils.h +++ b/gtk/airpcap_gui_utils.h @@ -38,7 +38,7 @@ #define AIRPCAP_LINK_TYPE_NAME_UNKNOWN "Unknown" #define AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK "Wireshark" -#define AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP "AirPcap" +#define AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP "Driver" #define AIRPCAP_DECRYPTION_TYPE_STRING_NONE "None" #define NO_ROW_SELECTED -1 diff --git a/gtk/main.c b/gtk/main.c index 4fa68ed5eb..2f3ba8f944 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -4108,7 +4108,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs) gtk_toolbar_append_space(GTK_TOOLBAR(airpcap_tb)); /* Advanced button */ - advanced_bt = gtk_button_new_with_label("Advanced Wireless Settings..."); + advanced_bt = gtk_button_new_with_label("Wireless Settings"); OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_ADVANCED_KEY,advanced_bt); SIGNAL_CONNECT(advanced_bt, "clicked", toolbar_display_airpcap_advanced_cb, airpcap_tb); diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c index 969781afa3..ea1fa31d23 100644 --- a/gtk/prefs_dlg.c +++ b/gtk/prefs_dlg.c @@ -50,6 +50,7 @@ #include "simple_dialog.h" #include "compat_macros.h" #include "help_dlg.h" +#include "keys.h" #include <epan/prefs-int.h> @@ -1076,6 +1077,67 @@ module_prefs_fetch(module_t *module, gpointer user_data) return 0; /* keep fetching module preferences */ } +#ifdef HAVE_AIRPCAP +/* + * This function is used to apply changes and update the Wireless Toolbar + * whenever we apply some changes to the WEP preferences + */ +static void +prefs_airpcap_update() +{ +GtkWidget *decryption_cm; +GtkWidget *decryption_en; +gboolean wireshark_decryption_was_enabled; +gboolean airpcap_decryption_was_enabled; +gboolean wireshark_decryption_is_now_enabled; + +decryption_cm = GTK_WIDGET(OBJECT_GET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_DECRYPTION_KEY)); +decryption_en = GTK_WIDGET(GTK_ENTRY(GTK_COMBO(decryption_cm)->entry)); + +if( g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0 ) +{ +wireshark_decryption_was_enabled = TRUE; +airpcap_decryption_was_enabled = FALSE; +} +else if( g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP) == 0 ) +{ +wireshark_decryption_was_enabled = FALSE; +airpcap_decryption_was_enabled = TRUE; +} +else if( g_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_NONE) == 0 ) +{ +wireshark_decryption_was_enabled = FALSE; +airpcap_decryption_was_enabled = FALSE; +} + +wireshark_decryption_is_now_enabled = wireshark_decryption_on(); + +if(wireshark_decryption_is_now_enabled && airpcap_decryption_was_enabled) + { + set_airpcap_decryption(FALSE); + gtk_entry_set_text(GTK_ENTRY(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK); + } +if(wireshark_decryption_is_now_enabled && !airpcap_decryption_was_enabled) + { + set_airpcap_decryption(FALSE); + gtk_entry_set_text(GTK_ENTRY(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK); + } +else if(!wireshark_decryption_is_now_enabled && wireshark_decryption_was_enabled) + { + if(airpcap_decryption_was_enabled) + { + set_airpcap_decryption(TRUE); + gtk_entry_set_text(GTK_ENTRY(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP); + } + else + { + set_airpcap_decryption(FALSE); + gtk_entry_set_text(GTK_ENTRY(decryption_en),AIRPCAP_DECRYPTION_TYPE_STRING_NONE); + } + } +} +#endif + static guint pref_clean(pref_t *pref, gpointer user_data _U_) { @@ -1309,6 +1371,10 @@ prefs_main_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) prefs_main_apply_all(parent_w); + #ifdef HAVE_AIRPCAP + prefs_airpcap_update(); + #endif + /* Now destroy the "Preferences" dialog. */ window_destroy(GTK_WIDGET(parent_w)); @@ -1316,6 +1382,7 @@ prefs_main_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) /* Redissect all the packets, and re-evaluate the display filter. */ cf_redissect_packets(&cfile); } + } static void @@ -1333,6 +1400,10 @@ prefs_main_apply_cb(GtkWidget *apply_bt _U_, gpointer parent_w) prefs_main_apply_all(parent_w); + #ifdef HAVE_AIRPCAP + prefs_airpcap_update(); + #endif + if (must_redissect) { /* Redissect all the packets, and re-evaluate the display filter. */ cf_redissect_packets(&cfile); |