## up-client up-client — Main client object for accessing the UPower daemon |

## Synopsis

    #define             UP_CLIENT_ERROR
    #define             UP_CLIENT_TYPE_ERROR
    void                (*_up_client_reserved1)             (void);
    void                (*_up_client_reserved2)             (void);
    void                (*_up_client_reserved3)             (void);
    void                (*_up_client_reserved4)             (void);
    void                (*_up_client_reserved5)             (void);
    void                (*_up_client_reserved6)             (void);
    void                (*_up_client_reserved7)             (void);
    void                (*_up_client_reserved8)             (void);
    void                (*changed)                          (UpDevice *device,
                                                             gpointer *obj);
    void                (*device_added)                     (UpClient *client,
                                                             UpDevice *device);
    void                (*device_changed)                   (UpClient *client,
                                                             UpDevice *device);
    void                (*device_removed)                   (UpClient *client,
                                                             UpDevice *device);
    void                (*notify_resume)                    (UpClient *client,
                                                             UpSleepKind sleep_kind);
    void                (*notify_sleep)                     (UpClient *client,
                                                             UpSleepKind sleep_kind);
    gboolean            up_client_about_to_sleep_sync       (UpClient *client,
                                                             UpSleepKind sleep_kind,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            up_client_enumerate_devices_sync    (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            up_client_get_can_hibernate         (UpClient *client);
    gboolean            up_client_get_can_suspend           (UpClient *client);
    const gchar *       up_client_get_daemon_version        (UpClient *client);
    GPtrArray *         up_client_get_devices               (UpClient *client);
    gboolean            up_client_get_is_docked             (UpClient *client);
    gboolean            up_client_get_lid_force_sleep       (UpClient *client);
    gboolean            up_client_get_lid_is_closed         (UpClient *client);
    gboolean            up_client_get_lid_is_present        (UpClient *client);
    gboolean            up_client_get_on_battery            (UpClient *client);
    gboolean            up_client_get_on_low_battery        (UpClient *client);
    gboolean            up_client_get_properties_sync       (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            up_client_hibernate_sync            (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);
    UpClient *          up_client_new                       (void);
    gboolean            up_client_suspend_sync              (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);

## Description

A helper GObject to use for accessing UPower information, and to be notified when it is changed.

See also: UpDevice

## Details

### UP_CLIENT_ERROR

    #define UP_CLIENT_ERROR			(up_client_error_quark ())

### UP_CLIENT_TYPE_ERROR

    #define UP_CLIENT_TYPE_ERROR		(up_client_error_get_type ())

### _up_client_reserved1 ()

    void                (*_up_client_reserved1)             (void);

### _up_client_reserved2 ()

    void                (*_up_client_reserved2)             (void);

### _up_client_reserved3 ()

    void                (*_up_client_reserved3)             (void);

### _up_client_reserved4 ()

    void                (*_up_client_reserved4)             (void);

### _up_client_reserved5 ()

    void                (*_up_client_reserved5)             (void);

### _up_client_reserved6 ()

    void                (*_up_client_reserved6)             (void);

### _up_client_reserved7 ()

    void                (*_up_client_reserved7)             (void);

### _up_client_reserved8 ()

    void                (*_up_client_reserved8)             (void);

### changed ()

    void                (*changed)                          (UpDevice *device,
                                                             gpointer *obj);

### device_added ()

    void                (*device_added)                     (UpClient *client,
                                                             UpDevice *device);

### device_changed ()

    void                (*device_changed)                   (UpClient *client,
                                                             UpDevice *device);

### device_removed ()

    void                (*device_removed)                   (UpClient *client,
                                                             UpDevice *device);

### notify_resume ()

    void                (*notify_resume)                    (UpClient *client,
                                                             UpSleepKind sleep_kind);

### notify_sleep ()

    void                (*notify_sleep)                     (UpClient *client,
                                                             UpSleepKind sleep_kind);

### up_client_about_to_sleep_sync ()

    gboolean            up_client_about_to_sleep_sync       (UpClient *client,
                                                             UpSleepKind sleep_kind,
                                                             GCancellable *cancellable,
                                                             GError **error);

Tells UPower that we are soon to reqest either `Suspend()` or `Hibernate()` and that session and system components should be notified of this.

`client` : | a UpClient instance.
`sleep_kind` : | a sleep type, e.g. `UP_SLEEP_KIND_SUSPEND`
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | TRUE if system suspended okay, FALSE other wise.

Since 0.9.11

### up_client_enumerate_devices_sync ()

    gboolean            up_client_enumerate_devices_sync    (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);

Enumerates all the devices from the daemon.

`client` : | a UpClient instance.
`error` : | a GError, or `NULL`.
Returns : | `TRUE` for success, else `FALSE`.

Since 0.9.0

### up_client_get_can_hibernate ()

    gboolean            up_client_get_can_hibernate         (UpClient *client);

Get whether the system is able to hibernate.

`client` : | a UpClient instance.
Returns : | TRUE if system can hibernate, FALSE other wise.

Since 0.9.0

### up_client_get_can_suspend ()

    gboolean            up_client_get_can_suspend           (UpClient *client);

Get whether the system is able to suspend.

`client` : | a UpClient instance.
Returns : | TRUE if system can suspend, FALSE other wise.

Since 0.9.0

### up_client_get_daemon_version ()

    const gchar *       up_client_get_daemon_version        (UpClient *client);

Get UPower daemon version.

`client` : | a UpClient instance.
Returns : | string containing the daemon version, e.g. 008

Since 0.9.0

### up_client_get_devices ()

    GPtrArray *         up_client_get_devices               (UpClient *client);

Get a copy of the device objects. You must have called `up_client_enumerate_devices_sync()` before calling this function.

`client` : | a UpClient instance.
Returns : | an array of UpDevice objects, free with `g_ptr_array_unref()`. [transfer full]

Since 0.9.0

### up_client_get_is_docked ()

    gboolean            up_client_get_is_docked             (UpClient *client);

Get whether the machine is docked into a docking station.

`client` : | a UpClient instance.
Returns : | `TRUE` if the machine is docked

Since 0.9.2

### up_client_get_lid_force_sleep ()

    gboolean            up_client_get_lid_force_sleep       (UpClient *client);

Get whether the laptop has to sleep when the lid is closed.

`client` : | a UpClient instance.
Returns : | `TRUE` if the session has to suspend

Since 0.9.9

### up_client_get_lid_is_closed ()

    gboolean            up_client_get_lid_is_closed         (UpClient *client);

Get whether the laptop lid is closed.

`client` : | a UpClient instance.
Returns : | `TRUE` if lid is closed or `FALSE` otherwise.

Since 0.9.0

### up_client_get_lid_is_present ()

    gboolean            up_client_get_lid_is_present        (UpClient *client);

Get whether a laptop lid is present on this machine.

`client` : | a UpClient instance.
Returns : | `TRUE` if the machine has a laptop lid

Since 0.9.2

### up_client_get_on_battery ()

    gboolean            up_client_get_on_battery            (UpClient *client);

Get whether the system is running on battery power.

`client` : | a UpClient instance.
Returns : | TRUE if the system is currently running on battery, FALSE other wise.

Since 0.9.0

### up_client_get_on_low_battery ()

    gboolean            up_client_get_on_low_battery        (UpClient *client);

Get whether the system is running on low battery power.

`client` : | a UpClient instance.
Returns : | TRUE if the system is currently on low battery power, FALSE other wise.

Since 0.9.0

### up_client_get_properties_sync ()

    gboolean            up_client_get_properties_sync       (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);

Get all the properties from UPower daemon.

`client` : | a UpClient instance.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | `TRUE` for success, else `FALSE`.

Since 0.9.0

### up_client_hibernate_sync ()

    gboolean            up_client_hibernate_sync            (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts the computer into a low power state, where state is preserved if the power is lost.

`client` : | a UpClient instance.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError.
Returns : | TRUE if system suspended okay, FALSE other wise.

Since 0.9.0

### up_client_new ()

    UpClient *          up_client_new                       (void);

Creates a new UpClient object.

Returns : | a new UpClient object.

Since 0.9.0

### up_client_suspend_sync ()

    gboolean            up_client_suspend_sync              (UpClient *client,
                                                             GCancellable *cancellable,
                                                             GError **error);

Puts the computer into a low power state, but state is not preserved if the power is lost.

NOTE: The system is still consuming a small amount of power

`client` : | a UpClient instance.
`cancellable` : | a GCancellable or `NULL`
`error` : | a GError, or `NULL`.
Returns : | TRUE if system suspended okay, FALSE other wise.

Since 0.9.0