Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialogs.c: move the scanning process into its own thread. #490

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ static struct iio_context * get_context(Dialogs *data)
}
}

static void refresh_usb(void)

static void refresh_usb_thread(void)
{
struct iio_scan_context *ctxs;
struct iio_context_info **info;
Expand All @@ -447,6 +448,7 @@ static void refresh_usb(void)
bool scan = false;
gchar *active_uri = NULL;

gdk_threads_enter();
widget_set_cursor(dialogs.connect, GDK_WATCH);

if (gtk_combo_box_get_active(GTK_COMBO_BOX(dialogs.connect_usbd)) != -1) {
Expand Down Expand Up @@ -565,6 +567,7 @@ static void refresh_usb(void)
gtk_widget_set_sensitive(dialogs.connect_usbd, false);
/* Force a clear */
connect_clear(dialogs.connect_net);
gdk_threads_leave();
return;
}

Expand All @@ -585,6 +588,14 @@ static void refresh_usb(void)

/* Fill things in */
connect_clear(dialogs.connect_usb);
gdk_threads_leave();
AlexandraTrifan marked this conversation as resolved.
Show resolved Hide resolved

}


static void refresh_usb(void)
dNechita marked this conversation as resolved.
Show resolved Hide resolved
{
g_thread_new("Scan thread", (void *) &refresh_usb_thread, NULL);
}

#ifdef SERIAL_BACKEND
Expand Down
Loading