summaryrefslogtreecommitdiff
path: root/libdevkit-power
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-11-08 16:13:00 +0000
committerRichard Hughes <richard@hughsie.com>2008-11-08 16:13:00 +0000
commit7382bcc1686bce63ad3b7a5c3770ebc6c90802fe (patch)
treece87752f68a41d09b3900f3027a78fe9a016a416 /libdevkit-power
parentba8eecf2b454f266561970209eeda9b71fdc33f7 (diff)
trivial: add a resolution parameter to GetHistory rather than just guessing a number on the server
Diffstat (limited to 'libdevkit-power')
-rw-r--r--libdevkit-power/dkp-client-device.c7
-rw-r--r--libdevkit-power/dkp-client-device.h3
-rw-r--r--libdevkit-power/egg-obj-list.c1
3 files changed, 7 insertions, 4 deletions
diff --git a/libdevkit-power/dkp-client-device.c b/libdevkit-power/dkp-client-device.c
index ab0512d..dc25fc5 100644
--- a/libdevkit-power/dkp-client-device.c
+++ b/libdevkit-power/dkp-client-device.c
@@ -206,7 +206,7 @@ dkp_client_device_print_history (const DkpClientDevice *device, const gchar *typ
gboolean ret = FALSE;
/* get a fair chunk of data */
- array = dkp_client_device_get_history (device, type, 120);
+ array = dkp_client_device_get_history (device, type, 120, 10);
if (array == NULL)
goto out;
@@ -270,7 +270,7 @@ out:
* Returns an array of %DkpHistoryObj's
**/
EggObjList *
-dkp_client_device_get_history (const DkpClientDevice *device, const gchar *type, guint timespec)
+dkp_client_device_get_history (const DkpClientDevice *device, const gchar *type, guint timespec, guint resolution)
{
GError *error = NULL;
GType g_type_gvalue_array;
@@ -283,6 +283,7 @@ dkp_client_device_get_history (const DkpClientDevice *device, const gchar *type,
gboolean ret;
g_return_val_if_fail (DKP_IS_CLIENT_DEVICE (device), FALSE);
+ g_return_val_if_fail (device->priv->proxy_device != NULL, FALSE);
g_type_gvalue_array = dbus_g_type_get_collection ("GPtrArray",
dbus_g_type_get_struct("GValueArray",
@@ -295,6 +296,7 @@ dkp_client_device_get_history (const DkpClientDevice *device, const gchar *type,
ret = dbus_g_proxy_call (device->priv->proxy_device, "GetHistory", &error,
G_TYPE_STRING, type,
G_TYPE_UINT, timespec,
+ G_TYPE_UINT, resolution,
G_TYPE_INVALID,
g_type_gvalue_array, &gvalue_ptr_array,
G_TYPE_INVALID);
@@ -359,6 +361,7 @@ dkp_client_device_get_statistics (const DkpClientDevice *device, const gchar *ty
gboolean ret;
g_return_val_if_fail (DKP_IS_CLIENT_DEVICE (device), FALSE);
+ g_return_val_if_fail (device->priv->proxy_device != NULL, FALSE);
g_type_gvalue_array = dbus_g_type_get_collection ("GPtrArray",
dbus_g_type_get_struct("GValueArray",
diff --git a/libdevkit-power/dkp-client-device.h b/libdevkit-power/dkp-client-device.h
index 9903fc2..a0d88d2 100644
--- a/libdevkit-power/dkp-client-device.h
+++ b/libdevkit-power/dkp-client-device.h
@@ -65,7 +65,8 @@ gboolean dkp_client_device_print (const DkpClientDevice *device);
gboolean dkp_client_device_refresh (DkpClientDevice *device);
EggObjList *dkp_client_device_get_history (const DkpClientDevice *device,
const gchar *type,
- guint timespec);
+ guint timespec,
+ guint resolution);
EggObjList *dkp_client_device_get_statistics (const DkpClientDevice *device,
const gchar *type);
diff --git a/libdevkit-power/egg-obj-list.c b/libdevkit-power/egg-obj-list.c
index d0a255e..6e3fd25 100644
--- a/libdevkit-power/egg-obj-list.c
+++ b/libdevkit-power/egg-obj-list.c
@@ -144,7 +144,6 @@ egg_obj_list_clear (EggObjList *list)
array = list->priv->array;
func_free = list->priv->func_free;
-
if (func_free != NULL)
g_ptr_array_foreach (array, (GFunc) func_free, NULL);
g_ptr_array_remove_range (array, 0, array->len);