## Spice USB device selection widget Spice USB device selection widget — USB device selection widget |

## Stability Level

Stable, unless otherwise indicated

## Functions

GtkWidget * | spice_usb_device_widget_new ()

## Properties

gchar * | device-format-string | Read / Write / Construct Only
SpiceSession * | session | Read / Write / Construct Only

## Signals

void | connect-failed | Run First

## Types and Values

struct | SpiceUsbDeviceWidget
struct | SpiceUsbDeviceWidgetClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBox
                        ╰── SpiceUsbDeviceWidget

## Implemented Interfaces

SpiceUsbDeviceWidget implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Includes

    #include <usb-device-widget.h>

## Description

SpiceUsbDeviceWidget is a gtk widget which apps can use to easily add an UI to select USB devices to redirect (or unredirect).

## Functions

### spice_usb_device_widget_new ()

    GtkWidget *
    spice_usb_device_widget_new (SpiceSession *session,
                                 const gchar *device_format_string);

#### Parameters

session | SpiceSession for which to widget will control USB redirection |
device_format_string | String passed to `spice_usb_device_get_description()`. | [allow-none]

#### Returns

a new SpiceUsbDeviceWidget instance

## Types and Values

### struct SpiceUsbDeviceWidget

    struct SpiceUsbDeviceWidget;

The SpiceUsbDeviceWidget struct is opaque and should not be accessed directly.

### struct SpiceUsbDeviceWidgetClass

    struct SpiceUsbDeviceWidgetClass {
        GtkVBoxClass parent_class;

        /* signals */
        void (*connect_failed) (SpiceUsbDeviceWidget *widget,
                                SpiceUsbDevice *device, GError *error);
    };

Class structure for SpiceUsbDeviceWidget.

#### Members

GtkVBoxClass `parent_class`; |  |
`connect_failed` () | Signal class handler for the “connect-failed” signal. |

## Property Details

### The `“device-format-string”` property

      “device-format-string”     gchar *

Format string to pass to `spice_usb_device_get_description()` for getting the device USB descriptions.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“session”` property

      “session”                  SpiceSession *

SpiceSession this SpiceUsbDeviceWidget is associated with

Flags: Read / Write / Construct Only

## Signal Details

### The `“connect-failed”` signal

    void
    user_function (SpiceUsbDeviceWidget *widget,
                   SpiceUsbDevice       *device,
                   GError               *error,
                   gpointer              user_data)

The “connect-failed” signal is emitted whenever the user has requested for a device to be redirected and this has failed.

#### Parameters

widget | The SpiceUsbDeviceWidget that emitted the signal |
device | SpiceUsbDevice boxed object corresponding to the added device |
error | GError describing the reason why the connect failed |
user_data | user data set when the signal handler was connected. |

Flags: Run First