summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Brown <[email protected]>2012-11-20 00:08:50 +1030
committerWilliam Brown <[email protected]>2012-11-21 10:14:47 +1030
commitbb165fa927540f40b2b2afce1b4703f6e2cffbb1 (patch)
treefe161a73334a92456447a2c8e35ca0d95e25a262
parentd0eea338cc627b3083e16669a7f3e7a738410818 (diff)
downloadmate-power-manager-bb165fa927540f40b2b2afce1b4703f6e2cffbb1.tar.bz2
mate-power-manager-bb165fa927540f40b2b2afce1b4703f6e2cffbb1.tar.xz
This now uses the gvariant, and fixes some code logic issues
-rw-r--r--src/gpm-manager.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 3236406..dc838c5 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1851,7 +1851,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) {
//GDBusProxy *proxy;
GError *error = NULL;
gint32 r = -1;
-
+ GVariant *res;
//proxy == NULL;
/* Should we define these elsewhere? */
const char* arg_what = "handle-power-key:handle-suspend-key:handle-lid-switch";
@@ -1874,7 +1874,7 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) {
g_error_free (error);
return -1;
}
- r = g_dbus_proxy_call_sync (proxy, "Inhibit",
+ res = g_dbus_proxy_call_sync (proxy, "Inhibit",
g_variant_new( "(ssss)",
arg_what,
arg_who,
@@ -1886,11 +1886,17 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) {
NULL,
&error
);
- egg_debug ("Inhibiting systemd sleep - fd = %i", r);
- if (r < 1) {
+ if (error == NULL) {
+ g_variant_get(res, "(h)", &r);
+ egg_debug ("Inhibiting systemd sleep - fd = %i", r);
+ } else if (error != NULL) {
egg_error ("Error in dbus - %s", error->message);
g_error_free (error);
- return -EIO;
+ return -EIO;
+ }
+ if (r < 1) {
+ egg_error ("Error in FD was less than or 0 - %i", r);
+ return -EIO;
}
egg_debug ("Inhibiting systemd sleep - success");
return r;