Commit 25681432 authored by Michael Weiser's avatar Michael Weiser Committed by Sean Davis

Fix inhibitor listing in xfce4-screensaver-command (bug #16355)

The command would not reflect inhibited status and would not show the
inhibitors. This was due to the fact that unref'ing the reply gobject
also invalidates the body extracted from it and the iterator was set up
with the wrong format string.

Also, the body is a container and always contains the inhibitor array
element, even if it's empty. Therefore we have to check the number of
children of the actual array variant and not the body.

Change both to get inhibitors listed and inhibition status shown when
querying status.
Signed-off-by: Sean Davis's avatarSean Davis <smd.seandavis@gmail.com>
parent f2d07a37
......@@ -211,18 +211,18 @@ do_command (GDBusConnection *conn) {
goto done;
}
body = g_dbus_message_get_body (reply);
g_object_unref (reply);
g_variant_get (body, "(as)", &iter);
if (g_variant_n_children(body) <= 0) {
if (g_variant_iter_n_children(iter) <= 0) {
g_print (_("The screensaver is not inhibited\n"));
} else {
g_variant_get (body, "s", &iter);
g_print (_("The screensaver is being inhibited by:\n"));
while (g_variant_iter_loop (iter, "s", &str)) {
g_print ("\t%s\n", str);
}
g_variant_iter_free (iter);
}
g_variant_iter_free (iter);
g_object_unref (reply);
}
if (do_time) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment