Comment 11 for bug 223770

Revision history for this message
Mario Limonciello (superm1) wrote :

So with the move to devicekit-power, I believe this is actually fixed.
It checks whether there is enough swap space before offering hibernate:

/**
 * dkp_daemon_init:
 **/
static void
dkp_daemon_init (DkpDaemon *daemon)
{
        gfloat waterline;

        daemon->priv = DKP_DAEMON_GET_PRIVATE (daemon);
        daemon->priv->polkit = dkp_polkit_new ();
        daemon->priv->lid_is_present = FALSE;
        daemon->priv->lid_is_closed = FALSE;
        daemon->priv->can_suspend = FALSE;
        daemon->priv->can_hibernate = FALSE;

        /* check if we have support */
        dkp_daemon_check_state (daemon);

        /* do we have enough swap? */
        if (daemon->priv->can_hibernate) {
                waterline = dkp_daemon_check_swap (daemon);
                if (waterline > DKP_DAEMON_SWAP_WATERLINE) {
                        egg_debug ("not enough swap to enable hibernate");
                        daemon->priv->can_hibernate = FALSE;
                }
        }
}