UniqueBackend

## UniqueBackend UniqueBackend — Backend abstraction |

## Synopsis

                        UniqueBackend;
                        UniqueBackendClass;
    UniqueBackend *     unique_backend_create               (void);
    const gchar *       unique_backend_get_name             (UniqueBackend *backend);
    void                unique_backend_set_name             (UniqueBackend *backend,
                                                             const gchar *name);
    const gchar *       unique_backend_get_startup_id       (UniqueBackend *backend);
    void                unique_backend_set_startup_id       (UniqueBackend *backend,
                                                             const gchar *startup_id);
    GdkScreen *         unique_backend_get_screen           (UniqueBackend *backend);
    void                unique_backend_set_screen           (UniqueBackend *backend,
                                                             GdkScreen *screen);
    guint               unique_backend_get_workspace        (UniqueBackend *backend);
    gboolean            unique_backend_request_name         (UniqueBackend *backend);
    UniqueResponse      unique_backend_send_message         (UniqueBackend *backend,
                                                             gint command_id,
                                                             UniqueMessageData *message_data,
                                                             guint time_);

## Object Hierarchy

      GObject
       +----UniqueBackend

## Description

UniqueBackend is the base, abstract class implemented by the different IPC mechanisms used by Unique. Each UniqueApp instance creates a UniqueBackend to request the name or to send messages.

## Details

### UniqueBackend

    typedef struct _UniqueBackend UniqueBackend;

The UniqueBackend structure contains only private data and should only be accessed using the provided functions.

### UniqueBackendClass

    typedef struct {
      /* vtable, not signals */
      gboolean       (* request_name) (UniqueBackend     *backend);
      UniqueResponse (* send_message) (UniqueBackend     *backend,
                                       gint               command_id,
                                       UniqueMessageData *message_data,
                                       guint              time_);
    } UniqueBackendClass;

The class that should be implemented by every backend for UniqueApp.

`request_name` () | This method should be used to request the name for the instance set using `unique_backend_set_name()`
`send_message` () | This method should be used to send a message to a running instance

### unique_backend_create ()

    UniqueBackend *     unique_backend_create               (void);

Creates a UniqueBackend using the default backend defined at compile time. You can override the default backend by setting the `UNIQUE_BACKEND` environment variable with the name of the desired backend.

Returns : | the newly created UniqueBackend instance

### unique_backend_get_name ()

    const gchar *       unique_backend_get_name             (UniqueBackend *backend);

FIXME

`backend` : | FIXME
Returns : | FIXME

### unique_backend_set_name ()

    void                unique_backend_set_name             (UniqueBackend *backend,
                                                             const gchar *name);

FIXME

`backend` : | FIXME
`name` : | FIXME

### unique_backend_get_startup_id ()

    const gchar *       unique_backend_get_startup_id       (UniqueBackend *backend);

FIXME

`backend` : | FIXME
Returns : | FIXME

### unique_backend_set_startup_id ()

    void                unique_backend_set_startup_id       (UniqueBackend *backend,
                                                             const gchar *startup_id);

FIXME

`backend` : | FIXME
`startup_id` : | FIXME

### unique_backend_get_screen ()

    GdkScreen *         unique_backend_get_screen           (UniqueBackend *backend);

FIXME

`backend` : | FIXME
Returns : | FIXME

### unique_backend_set_screen ()

    void                unique_backend_set_screen           (UniqueBackend *backend,
                                                             GdkScreen *screen);

FIXME

`backend` : | FIXME
`screen` : | FIXME

### unique_backend_get_workspace ()

    guint               unique_backend_get_workspace        (UniqueBackend *backend);

Retrieves the current workspace.

`backend` : | a UniqueBackend
Returns : | a workspace number

### unique_backend_request_name ()

    gboolean            unique_backend_request_name         (UniqueBackend *backend);

Requests the name set using `unique_backend_set_name()` using `backend`.

`backend` : | a UniqueBackend
Returns : | `TRUE` if the name was assigned to us, `FALSE` if there already is a registered name

### unique_backend_send_message ()

    UniqueResponse      unique_backend_send_message         (UniqueBackend *backend,
                                                             gint command_id,
                                                             UniqueMessageData *message_data,
                                                             guint time_);

Sends `command_id`, and optionally `message_data`, to a running instance using `backend`.

`backend` : | a UniqueBackend
`command_id` : | command to send
`message_data` : | message to send, or `NULL`
`time_` : | time of the command emission, or 0 for the current time
Returns : | a UniqueResponse value sent by the running instance