diff options
-rw-r--r-- | ui/gtk/capture_dlg.c | 5 | ||||
-rw-r--r-- | ui/qt/remote_capture_dialog.cpp | 10 | ||||
-rw-r--r-- | ui/recent.c | 6 | ||||
-rw-r--r-- | ui/recent.h | 8 |
4 files changed, 17 insertions, 12 deletions
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c index 41c4313fe9..efc0bccbd8 100644 --- a/ui/gtk/capture_dlg.c +++ b/ui/gtk/capture_dlg.c @@ -1162,10 +1162,9 @@ iftype_combo_box_new(void) iftype_cbx = gtk_combo_box_text_new_with_entry(); - ht = get_remote_host_list(); - if (g_hash_table_size (ht) > 0) { + if (recent_get_remote_host_list_size() > 0) { /* Add remote hosts */ - g_hash_table_foreach (ht, iftype_combo_box_add_remote_host, iftype_cbx); + remote_host_list_foreach (iftype_combo_box_add_remote_host, iftype_cbx); iftype_combo_box_add_remote_separators (iftype_cbx); } diff --git a/ui/qt/remote_capture_dialog.cpp b/ui/qt/remote_capture_dialog.cpp index 98cc35ed10..7ec8a2f190 100644 --- a/ui/qt/remote_capture_dialog.cpp +++ b/ui/qt/remote_capture_dialog.cpp @@ -82,11 +82,13 @@ static void fillBox(gpointer key, gpointer, gpointer user_data) void RemoteCaptureDialog::fillComboBox() { - GHashTable *ht = get_remote_host_list(); + int remote_host_list_size; + ui->hostCombo->addItem(QString("")); - if (recent_get_remote_host_list_size() > 0) { - g_hash_table_foreach(ht, fillBox, ui->hostCombo); - ui->hostCombo->insertSeparator(g_hash_table_size(ht)+1); + remote_host_list_size = recent_get_remote_host_list_size(); + if (remote_host_list_size > 0) { + remote_host_list_foreach(fillBox, ui->hostCombo); + ui->hostCombo->insertSeparator(remote_host_list_size+1); ui->hostCombo->addItem(QString(tr("Clear list"))); } } diff --git a/ui/recent.c b/ui/recent.c index 01204f5d72..3408cd8405 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -412,9 +412,11 @@ free_remote_host (gpointer key _U_, gpointer value, gpointer user _U_) return TRUE; } -GHashTable *get_remote_host_list(void) +void +remote_host_list_foreach(GHFunc func, gpointer user_data) { - return remote_host_list; + if (remote_host_list != NULL) + g_hash_table_foreach(remote_host_list, func, user_data); } static void diff --git a/ui/recent.h b/ui/recent.h index 20b4701262..e027c6ba57 100644 --- a/ui/recent.h +++ b/ui/recent.h @@ -225,11 +225,13 @@ extern struct remote_host *recent_get_remote_host(const gchar *host); extern int recent_get_remote_host_list_size(void); /** - * Get the pointer of the remote_host_list. + * Iterate over all items in the remote_host_list, calling a + * function for each member * - * @return Pointer to the hash table + * @param func Function to be called + * @param user_data Argument to pass as user data to the function */ -extern GHashTable *get_remote_host_list(void); +extern void remote_host_list_foreach(GHFunc func, gpointer user_data); /** * Free all entries of the remote_host_list. |