For interfaces that don't support PacketOpenAdapter (such as TurboCap),
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 9 Jun 2009 20:08:47 +0000 (20:08 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 9 Jun 2009 20:08:47 +0000 (20:08 +0000)
disable the "Details" button in the interface list. Update an error
dialog to try to be more helpful.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28675 f5534014-38df-0310-8fa8-9805f1628bb7

capture_wpcap_packet.c
gtk/airpcap_gui_utils.c
gtk/capture_if_details_dlg_win32.c
gtk/capture_if_details_dlg_win32.h
gtk/capture_if_dlg.c

index 5da76ea9c996eca8c63cf9f19fee9b7e41a4586e..a4b903084fd289e83785f63ed7e55b63a390e53b 100644 (file)
@@ -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
index c2c29a96fde773617d8cd0b6cbce76d34e8c6f99..7c03ff6830c6541a5751116d9db21de82490be91 100644 (file)
@@ -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;
index 48f55e039b53f540861edcde96ce77b48ffe68af..64f7e91a311e63428223de637990fafb17b437a3 100644 (file)
@@ -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 */
index 8017aebc04a7b9c572ff6b7d10f3cfa472aaed87..c2f2a2da8e7c3d9ec41b0e3132847594bd164ce1 100644 (file)
@@ -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);
index a75c7ad15f4d8d7d69ce2008596ce5f9017bca23..3cb7c162151fa82cbf44abc2b54fedb8de995448 100644 (file)
@@ -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);