up-client: UPower Reference Manual

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

## Functions

void | (*device_added) ()
void | (*device_removed) ()
void | (*_up_client_reserved1) ()
void | (*_up_client_reserved2) ()
void | (*_up_client_reserved3) ()
void | (*_up_client_reserved4) ()
void | (*_up_client_reserved5) ()
void | (*_up_client_reserved6) ()
void | (*_up_client_reserved7) ()
void | (*_up_client_reserved8) ()
UpClient * | up_client_new ()
UpClient * | up_client_new_full ()
UpDevice * | up_client_get_display_device ()
char * | up_client_get_critical_action ()
GPtrArray * | up_client_get_devices ()
const gchar * | up_client_get_daemon_version ()
gboolean | up_client_get_lid_is_closed ()
gboolean | up_client_get_lid_is_present ()
gboolean | up_client_get_on_battery ()

## Types and Values

#define | UP_CLIENT_ERROR
#define | UP_CLIENT_TYPE_ERROR

## Description

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

See also: UpDevice

## Functions

### device_added ()

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

### device_removed ()

    void
    (*device_removed) (UpClient *client,
                       const gchar *object_path);

### _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);

### up_client_new ()

    UpClient *
    up_client_new (void);

Creates a new UpClient object. If connecting to upowerd on D-Bus fails, this returns `NULL` and prints out a warning with the error message. Consider using `up_client_new_full()` instead which allows you to handle errors and cancelling long operations yourself.

#### Returns

a new UpClient object, or `NULL` on failure.

Since: 0.9.0

### up_client_new_full ()

    UpClient *
    up_client_new_full (GCancellable *cancellable,
                        GError **error);

Creates a new UpClient object. If connecting to upowerd on D-Bus fails, % this returns `NULL` and sets `error` .

#### Parameters

cancellable | A GCancellable or `NULL`. | [allow-none]
error | Return location for error or `NULL`. |

#### Returns

a new UpClient object, or `NULL` on failure.

Since: 0.99.5

### up_client_get_display_device ()

    UpDevice *
    up_client_get_display_device (UpClient *client);

Get the composite display device.

#### Parameters

client | a UpClient instance. |

#### Returns

a UpClient object, or `NULL` on error.

[transfer full]

Since: 1.0

### up_client_get_critical_action ()

    char *
    up_client_get_critical_action (UpClient *client);

Gets a string representing the configured critical action, depending on availability.

#### Parameters

client | a UpClient instance. |

#### Returns

the action name, or `NULL` on error.

Since: 1.0

### up_client_get_devices ()

    GPtrArray *
    up_client_get_devices (UpClient *client);

Get a copy of the device objects.

#### Parameters

client | a UpClient instance. |

#### Returns

an array of UpDevice objects, free with `g_ptr_array_unref()`.

[element-type UpDevice][transfer full]

Since: 0.9.0

### up_client_get_daemon_version ()

    const gchar *
    up_client_get_daemon_version (UpClient *client);

Get UPower daemon version.

#### Parameters

client | a UpClient instance. |

#### Returns

string containing the daemon version, e.g. 008

Since: 0.9.0

### up_client_get_lid_is_closed ()

    gboolean
    up_client_get_lid_is_closed (UpClient *client);

Get whether the laptop lid is closed.

#### Parameters

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.

#### Parameters

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.

#### Parameters

client | a UpClient instance. |

#### Returns

`TRUE` if the system is currently running on battery, `FALSE` otherwise.

Since: 0.9.0

## Types and Values

### 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 ())