aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2009-06-09 20:08:47 +0000
committerGerald Combs <gerald@wireshark.org>2009-06-09 20:08:47 +0000
commitcaa884723ce3d8152959cbab782305b8c6717cc4 (patch)
treeb69ece707167d48e33bcc4ef3642622b87791397
parent0db429e50c2239eff4ac4fc3dc2f7d620f223906 (diff)
For interfaces that don't support PacketOpenAdapter (such as TurboCap),
disable the "Details" button in the interface list. Update an error dialog to try to be more helpful. svn path=/trunk/; revision=28675
-rw-r--r--capture_wpcap_packet.c13
-rw-r--r--gtk/airpcap_gui_utils.c2
-rw-r--r--gtk/capture_if_details_dlg_win32.c26
-rw-r--r--gtk/capture_if_details_dlg_win32.h5
-rw-r--r--gtk/capture_if_dlg.c6
5 files changed, 48 insertions, 4 deletions
diff --git a/capture_wpcap_packet.c b/capture_wpcap_packet.c
index 5da76ea9c9..a4b903084f 100644
--- a/capture_wpcap_packet.c
+++ b/capture_wpcap_packet.c
@@ -319,3 +319,16 @@ wpcap_packet_load(void)
}
#endif /* HAVE_LIBPCAP */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: tabs
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=4 noexpandtab
+ * :indentSize=4:tabSize=4:noTabs=false:
+ */ \ No newline at end of file
diff --git a/gtk/airpcap_gui_utils.c b/gtk/airpcap_gui_utils.c
index c2c29a96fd..7c03ff6830 100644
--- a/gtk/airpcap_gui_utils.c
+++ b/gtk/airpcap_gui_utils.c
@@ -715,7 +715,7 @@ airpcap_if_is_any(airpcap_if_info_t* if_info)
void
airpcap_update_channel_combo(GtkWidget* channel_cb, airpcap_if_info_t* if_info)
{
- if(!if_info || airpcap_if_is_any(if_info))
+ if(!if_info || airpcap_if_is_any(if_info) || !airpcap_if_selected)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(channel_cb), -1);
change_airpcap_settings = FALSE;
diff --git a/gtk/capture_if_details_dlg_win32.c b/gtk/capture_if_details_dlg_win32.c
index 48f55e039b..64f7e91a31 100644
--- a/gtk/capture_if_details_dlg_win32.c
+++ b/gtk/capture_if_details_dlg_win32.c
@@ -2330,9 +2330,15 @@ capture_if_details_open_win(char *iface)
/* open the network adapter */
adapter = wpcap_packet_open(iface);
if(adapter == NULL) {
+ /*
+ * We have an adapter that is not exposed through normal APIs (e.g. TurboCap)
+ * or an adapter that isn't plugged in.
+ *
+ * XXX - We should use the TurboCap API to get info about TurboCap adapters.
+ */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "%sCould not open adapter: %s!%s"
- "\n\nThe adapter might be removed from the system in the meantime!",
+ "%sCould not open adapter %s!%s"
+ "\n\nHas it been unplugged?",
simple_dialog_primary_start(), iface, simple_dialog_primary_end());
return;
}
@@ -2496,5 +2502,21 @@ capture_if_details_open(char *iface)
}
}
+gboolean
+capture_if_has_details(char *iface) {
+ LPADAPTER adapter;
+
+ if (!iface) {
+ return FALSE;
+ }
+
+ adapter = wpcap_packet_open(iface);
+ if (adapter) {
+ wpcap_packet_close(adapter);
+ return TRUE;
+ }
+
+ return FALSE;
+}
#endif /* HAVE_LIBPCAP && _WIN32 */
diff --git a/gtk/capture_if_details_dlg_win32.h b/gtk/capture_if_details_dlg_win32.h
index 8017aebc04..c2f2a2da8e 100644
--- a/gtk/capture_if_details_dlg_win32.h
+++ b/gtk/capture_if_details_dlg_win32.h
@@ -33,3 +33,8 @@
*/
extern void capture_if_details_open(char *iface);
+/** See if we have a detail-able interface.
+ *
+ * @param iface the interface name to test
+ */
+extern gboolean capture_if_has_details(char *iface);
diff --git a/gtk/capture_if_dlg.c b/gtk/capture_if_dlg.c
index a75c7ad15f..3cb7c16215 100644
--- a/gtk/capture_if_dlg.c
+++ b/gtk/capture_if_dlg.c
@@ -774,10 +774,14 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
/* details button */
#ifdef _WIN32
if_dlg_data->details_bt = gtk_button_new_from_stock(WIRESHARK_STOCK_CAPTURE_DETAILS);
- g_signal_connect(if_dlg_data->details_bt, "clicked", G_CALLBACK(capture_details_cb), if_dlg_data);
gtk_tooltips_set_tip(tooltips, if_dlg_data->details_bt,
"Open the capture details dialog of this interface.", NULL);
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->details_bt, 8, 9, row, row+1);
+ if (capture_if_has_details(if_dlg_data->device)) {
+ g_signal_connect(if_dlg_data->details_bt, "clicked", G_CALLBACK(capture_details_cb), if_dlg_data);
+ } else {
+ gtk_widget_set_sensitive(if_dlg_data->details_bt, FALSE);
+ }
#endif
if_data = g_list_append(if_data, if_dlg_data);