summaryrefslogtreecommitdiff
path: root/xfce4-session-logout
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2012-03-24 21:46:32 +0100
committerNick Schermer <nick@xfce.org>2012-03-24 22:24:36 +0100
commite752a3e68afe5b9129fe558aa7a5205fde7a0fac (patch)
tree6f1a46f2eb2a4c811e20350da7f9638af9e471d6 /xfce4-session-logout
parent3419125796cd4ed3460b0e4c02c18b3fe19ef01f (diff)
downloadxfce4-session-e752a3e68afe5b9129fe558aa7a5205fde7a0fac.tar.gz
Directly use upower for suspend/hibernate.
Working with Xfpm is too much work to get right for 4.10, so readd the upower dbus communication.
Diffstat (limited to 'xfce4-session-logout')
-rw-r--r--xfce4-session-logout/main.c78
1 files changed, 32 insertions, 46 deletions
diff --git a/xfce4-session-logout/main.c b/xfce4-session-logout/main.c
index 9619be4d..1bc73cd2 100644
--- a/xfce4-session-logout/main.c
+++ b/xfce4-session-logout/main.c
@@ -139,56 +139,42 @@ main (int argc, char **argv)
}
/* create messsage */
- if (opt_suspend || opt_hibernate)
+ proxy = dbus_g_proxy_new_for_name_owner (conn,
+ "org.xfce.SessionManager",
+ "/org/xfce/SessionManager",
+ "org.xfce.Session.Manager",
+ &err);
+ if (proxy != NULL)
{
- proxy = dbus_g_proxy_new_for_name_owner (conn,
- "org.xfce.PowerManager",
- "/org/xfce/PowerManager",
- "org.xfce.PowerManager",
- &err);
- if (proxy != NULL)
+ if (opt_halt)
{
- if (opt_halt)
- {
- result = dbus_g_proxy_call (proxy, "Suspend", &err,
- G_TYPE_INVALID, G_TYPE_INVALID);
- }
- else
- {
- result = dbus_g_proxy_call (proxy, "Hibernate", &err,
- G_TYPE_INVALID, G_TYPE_INVALID);
- }
+ result = dbus_g_proxy_call (proxy, "Shutdown", &err,
+ G_TYPE_BOOLEAN, allow_save,
+ G_TYPE_INVALID, G_TYPE_INVALID);
}
- }
- else
- {
- proxy = dbus_g_proxy_new_for_name_owner (conn,
- "org.xfce.SessionManager",
- "/org/xfce/SessionManager",
- "org.xfce.Session.Manager",
- &err);
- if (proxy != NULL)
+ else if (opt_reboot)
+ {
+ result = dbus_g_proxy_call (proxy, "Restart", &err,
+ G_TYPE_BOOLEAN, allow_save,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ else if (opt_suspend)
+ {
+ result = dbus_g_proxy_call (proxy, "Suspend", &err,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ else if (opt_hibernate)
+ {
+ result = dbus_g_proxy_call (proxy, "Hibernate", &err,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ else
{
- if (opt_halt)
- {
- result = dbus_g_proxy_call (proxy, "Shutdown", &err,
- G_TYPE_BOOLEAN, allow_save,
- G_TYPE_INVALID, G_TYPE_INVALID);
- }
- else if (opt_reboot)
- {
- result = dbus_g_proxy_call (proxy, "Restart", &err,
- G_TYPE_BOOLEAN, allow_save,
- G_TYPE_INVALID, G_TYPE_INVALID);
- }
- else
- {
- show_dialog = !opt_logout;
- result = dbus_g_proxy_call (proxy, "Logout", &err,
- G_TYPE_BOOLEAN, show_dialog,
- G_TYPE_BOOLEAN, allow_save,
- G_TYPE_INVALID, G_TYPE_INVALID);
- }
+ show_dialog = !opt_logout;
+ result = dbus_g_proxy_call (proxy, "Logout", &err,
+ G_TYPE_BOOLEAN, show_dialog,
+ G_TYPE_BOOLEAN, allow_save,
+ G_TYPE_INVALID, G_TYPE_INVALID);
}
}