summaryrefslogtreecommitdiff
path: root/ui/qt/capture_preferences_frame.cpp
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-07-25 15:48:59 -0700
committerGuy Harris <guy@alum.mit.edu>2014-07-25 22:49:35 +0000
commitab9dc4f554058345f344f2ab37a68d9385a1edf8 (patch)
tree1096287a4c11b3300ef24bc1543f39932f132180 /ui/qt/capture_preferences_frame.cpp
parent0492921adc1d6e3978b93bcac35140510228a62a (diff)
downloadwireshark-ab9dc4f554058345f344f2ab37a68d9385a1edf8.tar.gz
Don't use capture_interface_list() in this dialog.
Instead, if we have no interfaces in global_capture_opts.all_ifaces, use the refreshLocalInterfaces() method of the main WiresharkApplication to try to fetch them; that way, if we do find interfaces, a signal will be emitted to cause the rest of the UI to reflect their arrival. Change-Id: I59077ef855127fd6bddaa40126c1835a659ffc30 Reviewed-on: https://code.wireshark.org/review/3202 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/capture_preferences_frame.cpp')
-rw-r--r--ui/qt/capture_preferences_frame.cpp36
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) {