static void infobar_reconnect_cb(GtkMenuItem *btn, gpointer user_data) { struct iio_context *new_ctx = iio_context_clone(ctx); if (new_ctx) { application_reload(new_ctx, true); gtk_widget_set_visible(infobar, false); } }
static gint fru_connect_dialog(Dialogs *data, bool load_profile) { /* Connect Dialog */ gint ret; struct iio_context *ctx; const char *name = NULL; bool has_context = false; /* Preload the device list and FRU info only if we can use the local * backend */ ctx = get_context_from_osc(); if (ctx) name = iio_context_get_name(ctx); if (name && !strcmp(name, "local")) has_context = connect_fillin(data); while (true) { gtk_widget_set_sensitive(data->ok_btn, has_context); ret = gtk_dialog_run(GTK_DIALOG(data->connect)); switch (ret) { case GTK_RESPONSE_APPLY: widget_set_cursor(data->connect, GDK_WATCH); has_context = connect_fillin(data); widget_use_parent_cursor(data->connect); continue; case GTK_RESPONSE_OK: ctx = get_context(data); widget_set_cursor(data->connect, GDK_WATCH); widget_use_parent_cursor(data->connect); if (!ctx) continue; application_reload(ctx, load_profile); break; default: printf("unknown response (%i) in %s(%s)\n", ret, __FILE__, __func__); case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: break; } gtk_widget_hide(data->connect); return ret; } }