Commit 3fdfe9db authored by Benjamin Berg's avatar Benjamin Berg
Browse files

Revert "power: Add Suspend then Hibernate"

This reverts commit a6e3ee40.
parent 18f069b6
Pipeline #46460 passed with stages
in 18 minutes and 25 seconds
......@@ -1995,36 +1995,6 @@ power_action (GsdMediaKeysManager *manager,
NULL, NULL);
}
static void
suspend_action (GsdMediaKeysManager *manager,
gboolean allow_interaction)
{
const gchar *action = "Suspend";
g_autoptr(GVariant) retval = NULL;
g_autoptr(GError) error = NULL;
retval = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
"CanSuspendThenHibernate",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
if (retval == NULL) {
g_warning ("Failed to query CanSuspendThenHibernate: %s", error->message);
g_error_free (error);
} else {
const gchar *s2h = NULL;
g_variant_get (retval, "(s)", &s2h);
if (g_strcmp0 (s2h, "yes") == 0)
action = "SuspendThenHibernate";
}
g_debug ("Choosing suspend action: %s", action);
power_action (manager, action, allow_interaction);
}
static void
do_config_power_action (GsdMediaKeysManager *manager,
GsdPowerActionType action_type,
......@@ -2032,7 +2002,7 @@ do_config_power_action (GsdMediaKeysManager *manager,
{
switch (action_type) {
case GSD_POWER_ACTION_SUSPEND:
suspend_action (manager, !in_lock_screen);
power_action (manager, "Suspend", !in_lock_screen);
break;
case GSD_POWER_ACTION_INTERACTIVE:
if (!in_lock_screen)
......@@ -2070,7 +2040,7 @@ do_config_power_button_action (GsdMediaKeysManager *manager,
/* Always suspend tablets */
if (g_strcmp0 (manager->priv->chassis_type, "tablet") == 0) {
suspend_action (manager, !in_lock_screen);
power_action (manager, "Suspend", !in_lock_screen);
return;
}
......
......@@ -931,35 +931,12 @@ action_poweroff (GsdPowerManager *manager)
static void
action_suspend (GsdPowerManager *manager)
{
const gchar *action = "Suspend";
g_autoptr(GVariant) retval = NULL;
g_autoptr(GError) error = NULL;
if (manager->priv->logind_proxy == NULL) {
g_warning ("no systemd support");
return;
}
retval = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
"CanSuspendThenHibernate",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
manager->priv->cancellable,
&error);
if (retval == NULL) {
g_warning ("Failed to query CanSuspendThenHibernate: %s", error->message);
} else {
const gchar *s2h = NULL;
g_variant_get (retval, "(s)", &s2h);
if (g_strcmp0 (s2h, "yes") == 0)
action = "SuspendThenHibernate";
}
g_debug ("Choosing suspend action: %s", action);
g_dbus_proxy_call (manager->priv->logind_proxy,
action,
"Suspend",
g_variant_new ("(b)", FALSE),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
......@@ -1058,7 +1035,6 @@ backlight_disable (GsdPowerManager *manager)
g_error_free (error);
}
g_debug("Is tablet: %d", manager->priv->is_tablet);
if (manager->priv->is_tablet)
action_suspend (manager);
......@@ -1069,7 +1045,6 @@ static void
do_power_action_type (GsdPowerManager *manager,
GsdPowerActionType action_type)
{
g_debug("Running power action type %d", action_type);
switch (action_type) {
case GSD_POWER_ACTION_SUSPEND:
action_suspend (manager);
......
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