#include "settings.h"
#include "ui-common.h"
+static gboolean scan_bluetooth_idle(ScanInfo * scan_info);
+
gint
-scan_start_search(ScanInfo * scan_info)
+scan_start_search(ScanInfo *scan_info)
{
scan_info->sid=g_idle_add((GSourceFunc)scan_bluetooth_idle, scan_info);
return 0;
}
-gboolean
-scan_bluetooth_idle(ScanInfo * scan_info)
+static gboolean
+scan_bluetooth_idle(ScanInfo *scan_info)
{
-gint devid, num_rsp;
+gint devid, num_rsp, sock;
GtkTreeIter iter;
inquiry_info *ii = NULL;
devid = hci_get_route(NULL);
+if (devid<0) {
+ popup_error(scan_info->settings_dialog, _("No bluetooth adapters found."));
+ return FALSE;
+}
ii = (inquiry_info *)malloc(255 * sizeof(inquiry_info));
num_rsp = hci_inquiry(devid, 4, 255, NULL, &ii, IREQ_CACHE_FLUSH);
popup_error(scan_info->settings_dialog, _("No bluetooth devices found."));
} else {
guint i;
- gint sock = hci_open_dev(devid);
+
+ sock = hci_open_dev(devid);
for (i = 0; i < num_rsp; i++) {
gchar addr[19] = { 0 };
gchar name[256] = { 0 };
strcpy(name, _("Unknown"));
gtk_list_store_append(scan_info->store, &iter);
- gtk_list_store_set(scan_info->store, &iter,
- 0, g_strdup(addr),
- 1, g_strdup(name), -1);
+ gtk_list_store_set(scan_info->store, &iter, 0, g_strdup(addr), 1, g_strdup(name), -1);
}
close(sock);
gtk_widget_destroy(scan_info->banner);