diff --git a/plugins/policy/suspend/ohm-plugin-suspend.c b/plugins/policy/suspend/ohm-plugin-suspend.c index 712464d..477b99a 100644 --- a/plugins/policy/suspend/ohm-plugin-suspend.c +++ b/plugins/policy/suspend/ohm-plugin-suspend.c @@ -18,8 +18,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include +#include +#include #include #include @@ -38,40 +41,26 @@ enum { static gboolean system_suspend (OhmPlugin *plugin) { - DBusGConnection *connection; - DBusGProxy *proxy; - GError *error; - gboolean ret; - gint retval; - /* Tell the DPMS plugin to kill the backlight. */ ohm_plugin_conf_set_key (plugin, "backlight.state", 0); - connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); - - /* reuse the connection from HAL */ - proxy = dbus_g_proxy_new_for_name (connection, - HAL_DBUS_SERVICE, - HAL_ROOT_COMPUTER, - HAL_DBUS_INTERFACE_POWER); - - /* get the brightness from HAL */ - error = NULL; - ret = dbus_g_proxy_call (proxy, "Suspend", &error, - G_TYPE_INT, 0, - G_TYPE_INVALID, - G_TYPE_UINT, &retval, - G_TYPE_INVALID); - if (error != NULL) { - g_printerr ("Error: %s\n", error->message); - g_error_free (error); - } - g_object_unref (proxy); + FILE *fp; + + fp = g_fopen("/sys/power/state", "w"); + if (!fp) { + g_warning ("Couldn't open /sys/power/state."); + return FALSE; + } + + if (g_fprintf(fp, "mem\n") < 0) + g_warning ("Couldn't write to /sys/power/state."); + + fclose(fp); /* We've resumed now. Bring the backlight back. */ ohm_plugin_conf_set_key (plugin, "backlight.state", 1); - return ret; + return TRUE; } /** diff --git a/po/ChangeLog b/po/ChangeLog diff --git a/po/Makefile.in.in b/po/Makefile.in.in diff --git a/po/POTFILES.in b/po/POTFILES.in diff --git a/po/en_GB.po b/po/en_GB.po