## Spice GTK Session Spice GTK Session — handles GTK connection details |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <spice-gtk-session.h>

    struct              SpiceGtkSession;
    struct              SpiceGtkSessionClass;
    SpiceGtkSession *   spice_gtk_session_get               (SpiceSession *session);
    void                spice_gtk_session_copy_to_guest     (SpiceGtkSession *self);
    void                spice_gtk_session_paste_from_guest  (SpiceGtkSession *self);

## Object Hierarchy

      GObject
       +----SpiceGtkSession

## Properties

      "auto-clipboard"           gboolean              : Read / Write / Construct
      "auto-usbredir"            gboolean              : Read / Write / Construct
      "session"                  SpiceSession*         : Read / Write / Construct Only

## Description

The SpiceGtkSession class is the spice-client-gtk counter part of SpiceSession. It contains functionality which should be handled per session rather then per SpiceDisplay (one session can have multiple displays), but which cannot live in SpiceSession as it depends on GTK. For example the clipboard functionality.

There should always be a 1:1 relation between SpiceGtkSession objects and SpiceSession objects. Therefor there is no spice_gtk_session_new, instead there is `spice_gtk_session_get()` which ensures this 1:1 relation.

Client and guest clipboards will be shared automatically if "auto-clipboard" is set to TRUE. Alternatively, you can send / receive clipboard data from client to guest with `spice_gtk_session_copy_to_guest()` / `spice_gtk_session_paste_from_guest()`.

## Details

### struct SpiceGtkSession

    struct SpiceGtkSession;

### struct SpiceGtkSessionClass

    struct SpiceGtkSessionClass {
        GObjectClass parent_class;

        /* signals */
    };

### spice_gtk_session_get ()

    SpiceGtkSession *   spice_gtk_session_get               (SpiceSession *session);

Gets the SpiceGtkSession associated with the passed in SpiceSession. A new SpiceGtkSession instance will be created the first time this function is called for a certain SpiceSession.

Note that this function returns a weak reference, which should not be used after the SpiceSession itself has been unref-ed by the caller.

`session` : | SpiceSession for which to get the SpiceGtkSession
Returns : | a weak reference to the SpiceGtkSession associated with the passed in SpiceSession Since 0.8. [transfer none]

### spice_gtk_session_copy_to_guest ()

    void                spice_gtk_session_copy_to_guest     (SpiceGtkSession *self);

Copy client-side clipboard to guest clipboard.

Since 0.8

### spice_gtk_session_paste_from_guest ()

    void                spice_gtk_session_paste_from_guest  (SpiceGtkSession *self);

Copy guest clipboard to client-side clipboard.

Since 0.8

## Property Details

### The `"auto-clipboard"` property

      "auto-clipboard"           gboolean              : Read / Write / Construct

When this is true the clipboard gets automatically shared between host and guest.

Default value: TRUE

Since 0.8

### The `"auto-usbredir"` property

      "auto-usbredir"            gboolean              : Read / Write / Construct

Automatically redirect newly plugged in USB devices. Note the auto redirection only happens when a SpiceDisplay associated with the session had keyboard focus.

Default value: FALSE

Since 0.8

### The `"session"` property

      "session"                  SpiceSession*         : Read / Write / Construct Only

SpiceSession this SpiceGtkSession is associated with

Since 0.8

## See Also

SpiceSession, and the GTK widget SpiceDisplay