[gnome-power-manager] Fix use of GVariant types and DBus signatures
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Fix use of GVariant types and DBus signatures
- Date: Thu, 28 Oct 2010 12:32:42 +0000 (UTC)
commit 83fb163c1156b9c9bc73305198f7985e08105ade
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Oct 27 22:39:45 2010 +0200
Fix use of GVariant types and DBus signatures
Prevent an assertion by using a GVariantBuilder for "as", and correctly
pass a guint when a "u" is expected instead of a "s"
https://bugzilla.gnome.org/show_bug.cgi?id=622920
Signed-off-by: Richard Hughes <richard hughsie com>
src/gpm-disks.c | 5 +++--
src/gpm-screensaver.c | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/gpm-disks.c b/src/gpm-disks.c
index 9c917c3..d9811dc 100644
--- a/src/gpm-disks.c
+++ b/src/gpm-disks.c
@@ -86,8 +86,8 @@ gpm_disks_register (GpmDisks *disks, gint timeout)
{
gboolean ret = FALSE;
GVariant *retval = NULL;
+ GVariantBuilder array;
GError *error = NULL;
- const gchar **options = {NULL};
/* no UDisks */
if (disks->priv->proxy == NULL) {
@@ -96,11 +96,12 @@ gpm_disks_register (GpmDisks *disks, gint timeout)
}
/* set spindown timeouts */
+ g_variant_builder_init (&array, G_VARIANT_TYPE ("as"));
retval = g_dbus_proxy_call_sync (disks->priv->proxy,
"DriveSetAllSpindownTimeouts",
g_variant_new ("(ias)",
timeout,
- options),
+ &array),
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
if (retval == NULL) {
diff --git a/src/gpm-screensaver.c b/src/gpm-screensaver.c
index cc21ae9..842ea7c 100644
--- a/src/gpm-screensaver.c
+++ b/src/gpm-screensaver.c
@@ -146,7 +146,7 @@ gpm_screensaver_add_throttle (GpmScreensaver *screensaver, const char *reason)
}
/* success */
- g_variant_get (retval, "(s)", &cookie);
+ g_variant_get (retval, "(u)", &cookie);
g_debug ("adding throttle reason: '%s': id %u", reason, cookie);
out:
if (retval != NULL)
@@ -174,7 +174,7 @@ gpm_screensaver_remove_throttle (GpmScreensaver *screensaver, guint cookie)
g_debug ("removing throttle: id %u", cookie);
retval = g_dbus_proxy_call_sync (screensaver->priv->proxy,
"UnThrottle",
- g_variant_new ("(s)", cookie),
+ g_variant_new ("(u)", cookie),
G_DBUS_CALL_FLAGS_NONE,
-1, NULL,
&error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]