diff options
-rw-r--r-- | ui/qt/capture_preferences_frame.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/ui/qt/capture_preferences_frame.cpp b/ui/qt/capture_preferences_frame.cpp index 9c5643a5f8..acaf23a07a 100644 --- a/ui/qt/capture_preferences_frame.cpp +++ b/ui/qt/capture_preferences_frame.cpp @@ -29,6 +29,7 @@ #include "capture_preferences_frame.h" #include "ui_capture_preferences_frame.h" +#include "wireshark_application.h" #include <QSpacerItem> @@ -73,28 +74,25 @@ void CapturePreferencesFrame::showEvent(QShowEvent *evt) void CapturePreferencesFrame::updateWidgets() { #ifdef HAVE_LIBPCAP - GList *if_list, *combo_list, *combo_entry; - int err; + interface_t device; ui->defaultInterfaceComboBox->clear(); - if (global_capture_opts.all_ifaces->len > 0) { - interface_t device; - for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { - device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); - - /* Continue if capture device is hidden */ - if (device.hidden) { - continue; - } - ui->defaultInterfaceComboBox->addItem(QString((const char *)device.display_name)); - } - } else { - if_list = capture_interface_list(&err, NULL,main_window_update); - combo_list = build_capture_combo_list(if_list, FALSE); - free_interface_list(if_list); - for (combo_entry = combo_list; combo_entry != NULL && combo_entry->data != NULL; combo_entry = g_list_next(combo_entry)) { - ui->defaultInterfaceComboBox->addItem(QString((const char *)combo_entry->data)); + if (global_capture_opts.all_ifaces->len == 0) { + /* + * No interfaces - try refreshing the local interfaces, to + * see whether any have showed up (or privileges have changed + * to allow us to access them). + */ + wsApp->refreshLocalInterfaces(); + } + for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { + device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); + + /* Continue if capture device is hidden */ + if (device.hidden) { + continue; } + ui->defaultInterfaceComboBox->addItem(QString((const char *)device.display_name)); } if (pref_device_->stashed_val.string) { |