summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libupower-glib/up-client.c27
-rw-r--r--libupower-glib/up-client.h6
-rw-r--r--libupower-glib/up-device.c14
-rw-r--r--libupower-glib/up-device.h8
-rw-r--r--libupower-glib/up-wakeups.c32
-rw-r--r--libupower-glib/up-wakeups.h13
-rw-r--r--tools/up-tool.c10
7 files changed, 82 insertions, 28 deletions
diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
index 5fddf69..b60510a 100644
--- a/libupower-glib/up-client.c
+++ b/libupower-glib/up-client.c
@@ -156,6 +156,7 @@ up_client_get_devices_private (UpClient *client, GError **error)
/**
* up_client_suspend_sync:
* @client: a #UpClient instance.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError, or %NULL.
*
* Puts the computer into a low power state, but state is not preserved if the
@@ -168,7 +169,7 @@ up_client_get_devices_private (UpClient *client, GError **error)
* Since: 0.9.0
**/
gboolean
-up_client_suspend_sync (UpClient *client, GError **error)
+up_client_suspend_sync (UpClient *client, GCancellable *cancellable, GError **error)
{
gboolean ret;
GError *error_local = NULL;
@@ -199,6 +200,7 @@ out:
/**
* up_client_hibernate_sync:
* @client: a #UpClient instance.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError.
*
* Puts the computer into a low power state, where state is preserved if the
@@ -209,7 +211,7 @@ out:
* Since: 0.9.0
**/
gboolean
-up_client_hibernate_sync (UpClient *client, GError **error)
+up_client_hibernate_sync (UpClient *client, GCancellable *cancellable, GError **error)
{
gboolean ret;
GError *error_local = NULL;
@@ -240,6 +242,7 @@ out:
/**
* up_client_get_properties_sync:
* @client: a #UpClient instance.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError, or %NULL.
*
* Get all the properties from UPower daemon.
@@ -249,7 +252,7 @@ out:
* Since: 0.9.0
**/
gboolean
-up_client_get_properties_sync (UpClient *client, GError **error)
+up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GError **error)
{
gboolean ret = TRUE;
GHashTable *props;
@@ -367,7 +370,7 @@ const gchar *
up_client_get_daemon_version (UpClient *client)
{
g_return_val_if_fail (UP_IS_CLIENT (client), NULL);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
return client->priv->daemon_version;
}
@@ -385,7 +388,7 @@ gboolean
up_client_get_can_hibernate (UpClient *client)
{
g_return_val_if_fail (UP_IS_CLIENT (client), FALSE);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
return client->priv->can_hibernate;
}
@@ -401,7 +404,7 @@ gboolean
up_client_get_lid_is_closed (UpClient *client)
{
g_return_val_if_fail (UP_IS_CLIENT (client), FALSE);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
return client->priv->lid_is_closed;
}
@@ -419,7 +422,7 @@ gboolean
up_client_get_can_suspend (UpClient *client)
{
g_return_val_if_fail (UP_IS_CLIENT (client), FALSE);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
return client->priv->can_suspend;
}
@@ -437,7 +440,7 @@ gboolean
up_client_get_on_battery (UpClient *client)
{
g_return_val_if_fail (UP_IS_CLIENT (client), FALSE);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
return client->priv->on_battery;
}
@@ -455,7 +458,7 @@ gboolean
up_client_get_on_low_battery (UpClient *client)
{
g_return_val_if_fail (UP_IS_CLIENT (client), FALSE);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
return client->priv->on_low_battery;
}
@@ -470,7 +473,7 @@ up_client_add (UpClient *client, const gchar *object_path)
/* create new device */
device = up_device_new ();
- ret = up_device_set_object_path_sync (device, object_path, NULL);
+ ret = up_device_set_object_path_sync (device, object_path, NULL, NULL);
if (!ret)
goto out;
@@ -535,7 +538,7 @@ up_client_get_property (GObject *object,
UpClient *client;
client = UP_CLIENT (object);
- up_client_get_properties_sync (client, NULL);
+ up_client_get_properties_sync (client, NULL, NULL);
switch (prop_id) {
case PROP_DAEMON_VERSION:
@@ -754,7 +757,7 @@ up_client_class_init (UpClientClass *klass)
* Since: 0.9.0
**/
gboolean
-up_client_enumerate_devices_sync (UpClient *client, GError **error)
+up_client_enumerate_devices_sync (UpClient *client, GCancellable *cancellable, GError **error)
{
const gchar *object_path;
GPtrArray *devices;
diff --git a/libupower-glib/up-client.h b/libupower-glib/up-client.h
index 5df072b..54b55b1 100644
--- a/libupower-glib/up-client.h
+++ b/libupower-glib/up-client.h
@@ -27,6 +27,8 @@
#define __UP_CLIENT_H
#include <glib-object.h>
+#include <gio/gio.h>
+
#include <libupower-glib/up-device.h>
G_BEGIN_DECLS
@@ -76,12 +78,16 @@ UpClient *up_client_new (void);
/* sync versions */
gboolean up_client_get_properties_sync (UpClient *client,
+ GCancellable *cancellable,
GError **error);
gboolean up_client_enumerate_devices_sync (UpClient *client,
+ GCancellable *cancellable,
GError **error);
gboolean up_client_suspend_sync (UpClient *client,
+ GCancellable *cancellable,
GError **error);
gboolean up_client_hibernate_sync (UpClient *client,
+ GCancellable *cancellable,
GError **error);
/* accessors */
diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c
index cfbe9ba..3aecfd3 100644
--- a/libupower-glib/up-device.c
+++ b/libupower-glib/up-device.c
@@ -262,6 +262,7 @@ up_device_changed_cb (DBusGProxy *proxy, UpDevice *device)
* up_device_set_object_path_sync:
* @device: a #UpDevice instance.
* @object_path: The UPower object path.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError, or %NULL.
*
* Sets the object path of the object and fills up initial properties.
@@ -271,7 +272,7 @@ up_device_changed_cb (DBusGProxy *proxy, UpDevice *device)
* Since: 0.9.0
**/
gboolean
-up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GError **error)
+up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GCancellable *cancellable, GError **error)
{
GError *error_local = NULL;
gboolean ret = FALSE;
@@ -357,7 +358,7 @@ up_device_to_text_history (UpDevice *device, GString *string, const gchar *type)
UpHistoryItem *item;
/* get a fair chunk of data */
- array = up_device_get_history_sync (device, type, 120, 10, NULL);
+ array = up_device_get_history_sync (device, type, 120, 10, NULL, NULL);
if (array == NULL)
return;
@@ -520,6 +521,7 @@ up_device_to_text (UpDevice *device)
/**
* up_device_refresh_sync:
* @device: a #UpDevice instance.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError, or %NULL.
*
* Refreshes properties on the device.
@@ -530,7 +532,7 @@ up_device_to_text (UpDevice *device)
* Since: 0.9.0
**/
gboolean
-up_device_refresh_sync (UpDevice *device, GError **error)
+up_device_refresh_sync (UpDevice *device, GCancellable *cancellable, GError **error)
{
GError *error_local = NULL;
gboolean ret;
@@ -556,6 +558,7 @@ out:
* @type: The type of history, known values are "rate" and "charge".
* @timespec: the amount of time to look back into time.
* @resolution: the resolution of data.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError, or %NULL.
*
* Gets the device history.
@@ -565,7 +568,7 @@ out:
* Since: 0.9.0
**/
GPtrArray *
-up_device_get_history_sync (UpDevice *device, const gchar *type, guint timespec, guint resolution, GError **error)
+up_device_get_history_sync (UpDevice *device, const gchar *type, guint timespec, guint resolution, GCancellable *cancellable, GError **error)
{
GError *error_local = NULL;
GType g_type_gvalue_array;
@@ -640,6 +643,7 @@ out:
* up_device_get_statistics_sync:
* @device: a #UpDevice instance.
* @type: the type of statistics.
+ * @cancellable: a #GCancellable or %NULL
* @error: a #GError, or %NULL.
*
* Gets the device current statistics.
@@ -649,7 +653,7 @@ out:
* Since: 0.9.0
**/
GPtrArray *
-up_device_get_statistics_sync (UpDevice *device, const gchar *type, GError **error)
+up_device_get_statistics_sync (UpDevice *device, const gchar *type, GCancellable *cancellable, GError **error)
{
GError *error_local = NULL;
GType g_type_gvalue_array;
diff --git a/libupower-glib/up-device.h b/libupower-glib/up-device.h
index e75c871..231bcb2 100644
--- a/libupower-glib/up-device.h
+++ b/libupower-glib/up-device.h
@@ -27,7 +27,9 @@
#define __UP_DEVICE_H
#include <glib-object.h>
-#include <up-types.h>
+#include <gio/gio.h>
+
+#include <libupower-glib/up-types.h>
G_BEGIN_DECLS
@@ -72,17 +74,21 @@ gchar *up_device_to_text (UpDevice *device);
/* sync versions */
gboolean up_device_refresh_sync (UpDevice *device,
+ GCancellable *cancellable,
GError **error);
gboolean up_device_set_object_path_sync (UpDevice *device,
const gchar *object_path,
+ GCancellable *cancellable,
GError **error);
GPtrArray *up_device_get_history_sync (UpDevice *device,
const gchar *type,
guint timespec,
guint resolution,
+ GCancellable *cancellable,
GError **error);
GPtrArray *up_device_get_statistics_sync (UpDevice *device,
const gchar *type,
+ GCancellable *cancellable,
GError **error);
/* accessors */
diff --git a/libupower-glib/up-wakeups.c b/libupower-glib/up-wakeups.c
index cb1a8e2..1388eab 100644
--- a/libupower-glib/up-wakeups.c
+++ b/libupower-glib/up-wakeups.c
@@ -56,6 +56,8 @@ G_DEFINE_TYPE (UpWakeups, up_wakeups, G_TYPE_OBJECT)
/**
* up_wakeups_get_total_sync:
* @wakeups: a #UpWakeups instance.
+ * @cancellable: a #GCancellable or %NULL
+ * @error: a #GError, or %NULL.
*
* Gets the the total number of wakeups per second from the daemon.
*
@@ -64,7 +66,7 @@ G_DEFINE_TYPE (UpWakeups, up_wakeups, G_TYPE_OBJECT)
* Since: 0.9.1
**/
guint
-up_wakeups_get_total_sync (UpWakeups *wakeups, GError **error)
+up_wakeups_get_total_sync (UpWakeups *wakeups, GCancellable *cancellable, GError **error)
{
guint total = 0;
gboolean ret;
@@ -88,6 +90,8 @@ up_wakeups_get_total_sync (UpWakeups *wakeups, GError **error)
/**
* up_wakeups_get_data_sync:
* @wakeups: a #UpWakeups instance.
+ * @cancellable: a #GCancellable or %NULL
+ * @error: a #GError, or %NULL.
*
* Gets the wakeups data from the daemon.
*
@@ -96,7 +100,7 @@ up_wakeups_get_total_sync (UpWakeups *wakeups, GError **error)
* Since: 0.9.1
**/
GPtrArray *
-up_wakeups_get_data_sync (UpWakeups *wakeups, GError **error)
+up_wakeups_get_data_sync (UpWakeups *wakeups, GCancellable *cancellable, GError **error)
{
GError *error_local = NULL;
GType g_type_gvalue_array;
@@ -221,7 +225,27 @@ out:
}
/**
- * up_wakeups_has_capability_sync:
+ * up_wakeups_get_properties_sync:
+ * @wakeups: a #UpWakeups instance.
+ * @cancellable: a #GCancellable or %NULL
+ * @error: a #GError, or %NULL.
+ *
+ * Gets properties from the daemon about wakeup data.
+ *
+ * Return value: %TRUE if supported
+ *
+ * Since: 0.9.1
+ **/
+gboolean
+up_wakeups_get_properties_sync (UpWakeups *wakeups, GCancellable *cancellable, GError **error)
+{
+ g_return_val_if_fail (UP_IS_WAKEUPS (wakeups), FALSE);
+ up_wakeups_ensure_properties (wakeups);
+ return TRUE;
+}
+
+/**
+ * up_wakeups_get_has_capability:
* @wakeups: a #UpWakeups instance.
*
* Returns if the daemon supports getting the wakeup data.
@@ -231,7 +255,7 @@ out:
* Since: 0.9.1
**/
gboolean
-up_wakeups_has_capability_sync (UpWakeups *wakeups)
+up_wakeups_get_has_capability (UpWakeups *wakeups)
{
g_return_val_if_fail (UP_IS_WAKEUPS (wakeups), FALSE);
up_wakeups_ensure_properties (wakeups);
diff --git a/libupower-glib/up-wakeups.h b/libupower-glib/up-wakeups.h
index a44fb2b..745971b 100644
--- a/libupower-glib/up-wakeups.h
+++ b/libupower-glib/up-wakeups.h
@@ -27,6 +27,8 @@
#define __UP_WAKEUPS_H
#include <glib-object.h>
+#include <gio/gio.h>
+
#include <libupower-glib/up-types.h>
#include <libupower-glib/up-device.h>
#include <libupower-glib/up-wakeup-item.h>
@@ -60,11 +62,20 @@ typedef struct
GType up_wakeups_get_type (void);
UpWakeups *up_wakeups_new (void);
+
+/* sync versions */
guint up_wakeups_get_total_sync (UpWakeups *wakeups,
+ GCancellable *cancellable,
GError **error);
GPtrArray *up_wakeups_get_data_sync (UpWakeups *wakeups,
+ GCancellable *cancellable,
GError **error);
-gboolean up_wakeups_has_capability_sync (UpWakeups *wakeups);
+gboolean up_wakeups_get_properties_sync (UpWakeups *wakeups,
+ GCancellable *cancellable,
+ GError **error);
+
+/* accessors */
+gboolean up_wakeups_get_has_capability (UpWakeups *wakeups);
G_END_DECLS
diff --git a/tools/up-tool.c b/tools/up-tool.c
index 0f2a79f..abc8cf1 100644
--- a/tools/up-tool.c
+++ b/tools/up-tool.c
@@ -212,18 +212,18 @@ up_tool_show_wakeups (void)
wakeups = up_wakeups_new ();
/* do we have support? */
- ret = up_wakeups_has_capability_sync (wakeups);
+ ret = up_wakeups_get_has_capability (wakeups);
if (!ret) {
g_print ("No wakeup capability\n");
goto out;
}
/* get total */
- total = up_wakeups_get_total_sync (wakeups, NULL);
+ total = up_wakeups_get_total_sync (wakeups, NULL, NULL);
g_print ("Total wakeups per minute: %i\n", total);
/* get data */
- array = up_wakeups_get_data_sync (wakeups, NULL);
+ array = up_wakeups_get_data_sync (wakeups, NULL, NULL);
if (array == NULL)
goto out;
g_print ("Wakeup sources:\n");
@@ -303,7 +303,7 @@ main (int argc, char **argv)
if (opt_enumerate || opt_dump) {
GPtrArray *devices;
- ret = up_client_enumerate_devices_sync (client, &error);
+ ret = up_client_enumerate_devices_sync (client, NULL, &error);
if (!ret) {
egg_warning ("failed to enumerate: %s", error->message);
goto out;
@@ -338,7 +338,7 @@ main (int argc, char **argv)
if (opt_show_info != NULL) {
device = up_device_new ();
- ret = up_device_set_object_path_sync (device, opt_show_info, &error);
+ ret = up_device_set_object_path_sync (device, opt_show_info, NULL, &error);
if (!ret) {
g_print ("failed to set path: %s\n", error->message);
g_error_free (error);