diff options
author | Gerald Combs <gerald@wireshark.org> | 2006-10-31 01:44:11 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2006-10-31 01:44:11 +0000 |
commit | 2fcb67b4961a6e983d591629186f9cc9b19c3e33 (patch) | |
tree | 01de9558a386f04a12d3b44485ed804382c41b84 /gtk | |
parent | b61a0b3d16895a559c85b3dbe7252b7a32817726 (diff) |
From Giorgio Tino: Add a "Don't show this message again" option to an
AirPcap warning dialog. Fix a callback bug in simple_dialog.c.
svn path=/trunk/; revision=19747
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/main.c | 54 | ||||
-rw-r--r-- | gtk/recent.c | 18 | ||||
-rw-r--r-- | gtk/recent.h | 1 | ||||
-rw-r--r-- | gtk/simple_dialog.c | 6 |
4 files changed, 66 insertions, 13 deletions
diff --git a/gtk/main.c b/gtk/main.c index 496fe75c94..ae27f96290 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -193,6 +193,8 @@ static GtkWidget *menubar, *main_vbox, *main_tb, *pkt_scrollw, *stat_hbox, *fi #ifdef HAVE_AIRPCAP GtkWidget *airpcap_tb; +GtkWidget *driver_warning_dialog; +int airpcap_dll_ret_val = -1; #endif static GtkWidget *info_bar; @@ -2084,7 +2086,6 @@ main(int argc, char *argv[]) int status; #ifdef HAVE_AIRPCAP - int airpcap_dll_ret_val; char err_str[AIRPCAP_ERRBUF_SIZE]; gchar *cant_get_if_list_errstr; #endif @@ -2145,17 +2146,14 @@ main(int argc, char *argv[]) /* select the first ad default (THIS SHOULD BE CHANGED) */ airpcap_if_active = airpcap_get_default_if(airpcap_if_list); } - else if(airpcap_dll_ret_val == AIRPCAP_DLL_OLD) - { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", - "WARNING: The version of AirPcap on this system\n" - "does not support driver-level decryption. Please\n" - "download a more recent version from\n" "http://www.cacetech.com/support/downloads.htm \n"); - } /* * XXX - Maybe we need to warn the user if one of the following happens??? */ -/* else if(airpcap_dll_ret_val == AIRPCAP_DLL_ERROR) +/* else if(airpcap_dll_ret_val == AIRPCAP_DLL_OLD) + { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_OLD\n"); + } + else if(airpcap_dll_ret_val == AIRPCAP_DLL_ERROR) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_ERROR\n"); } @@ -4310,6 +4308,15 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs) gtk_widget_show(welcome_pane); } +static +void driver_warning_dialog_cb(gpointer dialog _U_, gint btn, gpointer data) +{ + gboolean r; + + r = simple_dialog_check_get(dialog); + recent.airpcap_driver_check_show = !r; +} + static void show_main_window(gboolean doing_work) { @@ -4341,5 +4348,34 @@ else /* Keys from lists are equals, or wireshark has got no keys */ { airpcap_load_decryption_keys(airpcap_if_list); } + +if(airpcap_dll_ret_val == AIRPCAP_DLL_OLD) +{ +if(recent.airpcap_driver_check_show) + { + driver_warning_dialog = simple_dialog(ESD_TYPE_ERROR + , ESD_BTN_OK, "%s", + "WARNING: The version of AirPcap on this system\n" + "does not support driver-level decryption. Please\n" + "download a more recent version from\n" "http://www.cacetech.com/support/downloads.htm \n"); + simple_dialog_check_set(driver_warning_dialog,"Don't show this message again."); + simple_dialog_set_cb(driver_warning_dialog, driver_warning_dialog_cb, (gpointer) driver_warning_dialog); + } +} +/* + * XXX - Maybe we need to warn the user if one of the following happens??? + */ +/* else if(airpcap_dll_ret_val == AIRPCAP_DLL_OK) +{ + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_OK\n"); +} +else if(airpcap_dll_ret_val == AIRPCAP_DLL_ERROR) +{ + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_ERROR\n"); +} +else if(airpcap_dll_ret_val == AIRPCAP_DLL_NOT_FOUND) +{ + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DDL_NOT_FOUND\n"); +}*/ #endif } diff --git a/gtk/recent.c b/gtk/recent.c index 8e8c19e849..d1c10a59b5 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -51,6 +51,7 @@ #define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show" #define RECENT_KEY_FILTER_TOOLBAR_SHOW "gui.filter_toolbar_show" #define RECENT_KEY_AIRPCAP_TOOLBAR_SHOW "gui.airpcap_toolbar_show" +#define RECENT_KEY_DRIVER_CHECK_SHOW "gui.airpcap_driver_check_show" #define RECENT_KEY_PACKET_LIST_SHOW "gui.packet_list_show" #define RECENT_KEY_TREE_VIEW_SHOW "gui.tree_view_show" #define RECENT_KEY_BYTE_VIEW_SHOW "gui.byte_view_show" @@ -173,6 +174,13 @@ write_recent(void) recent.airpcap_toolbar_show == TRUE ? "TRUE" : "FALSE"); #endif +#ifdef HAVE_AIRPCAP + fprintf(rf, "\n# Show (hide) old AirPcap driver warning dialog box.\n"); + fprintf(rf, "# TRUE or FALSE (case-insensitive).\n"); + fprintf(rf, RECENT_KEY_DRIVER_CHECK_SHOW ": %s\n", + recent.airpcap_driver_check_show == TRUE ? "TRUE" : "FALSE"); +#endif + fprintf(rf, "\n# Packet list show (hide).\n"); fprintf(rf, "# TRUE or FALSE (case-insensitive).\n"); fprintf(rf, RECENT_KEY_PACKET_LIST_SHOW ": %s\n", @@ -316,7 +324,14 @@ read_set_recent_pair_static(gchar *key, gchar *value) else { recent.airpcap_toolbar_show = FALSE; } - } else if (strcmp(key, RECENT_KEY_PACKET_LIST_SHOW) == 0) { + } else if (strcmp(key, RECENT_KEY_DRIVER_CHECK_SHOW) == 0) { + if (strcasecmp(value, "true") == 0) { + recent.airpcap_driver_check_show = TRUE; + } + else { + recent.airpcap_driver_check_show = FALSE; + } + }else if (strcmp(key, RECENT_KEY_PACKET_LIST_SHOW) == 0) { if (strcasecmp(value, "true") == 0) { recent.packet_list_show = TRUE; } @@ -505,6 +520,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return) recent.main_toolbar_show = TRUE; recent.filter_toolbar_show = TRUE; recent.airpcap_toolbar_show = FALSE; + recent.airpcap_driver_check_show = TRUE; recent.packet_list_show = TRUE; recent.tree_view_show = TRUE; recent.byte_view_show = TRUE; diff --git a/gtk/recent.h b/gtk/recent.h index e1ecb3de95..f1a003c918 100644 --- a/gtk/recent.h +++ b/gtk/recent.h @@ -44,6 +44,7 @@ typedef struct recent_settings_tag { gboolean main_toolbar_show; gboolean filter_toolbar_show; gboolean airpcap_toolbar_show; + gboolean airpcap_driver_check_show; gboolean packet_list_show; gboolean tree_view_show; gboolean byte_view_show; diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c index 4f9f34fa1d..fe288dd7b4 100644 --- a/gtk/simple_dialog.c +++ b/gtk/simple_dialog.c @@ -373,10 +373,10 @@ simple_dialog_cancel_cb(GtkWidget *w, gpointer win) { simple_dialog_cb_t callback_fct = OBJECT_GET_DATA(win, CALLBACK_FCT_KEY); gpointer data = OBJECT_GET_DATA(win, CALLBACK_DATA_KEY); - window_destroy(GTK_WIDGET(win)); - if (callback_fct) (callback_fct) (win, button, data); + + window_destroy(GTK_WIDGET(win)); } void @@ -403,7 +403,7 @@ void simple_dialog_check_set(gpointer dialog, gchar *text) { } gboolean simple_dialog_check_get(gpointer dialog) { - GtkWidget *ask_cb = OBJECT_GET_DATA(dialog, CHECK_BUTTON); + GtkWidget *ask_cb = OBJECT_GET_DATA(GTK_WIDGET(dialog), CHECK_BUTTON); return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ask_cb)); } |