diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 9c84d7f..0ad4923 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -71,6 +71,10 @@
 #define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon"
 #define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon"
 
+#define GS_DBUS_NAME                            "org.gnome.ScreenSaver"
+#define GS_DBUS_PATH                            "/org/gnome/ScreenSaver"
+#define GS_DBUS_INTERFACE                       "org.gnome.ScreenSaver"
+
 #define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding"
 
 static const gchar introspection_xml[] =
@@ -166,6 +170,8 @@ struct GsdMediaKeysManagerPrivate
         GCancellable    *cancellable;
 
         guint            start_idle_id;
+	GDBusProxy      *screensaver_proxy;
+	GSettings       *settings_screensaver;
 };
 
 static void     gsd_media_keys_manager_class_init  (GsdMediaKeysManagerClass *klass);
@@ -175,6 +181,9 @@ static void     register_manager                   (GsdMediaKeysManager      *ma
 static void     custom_binding_changed             (GSettings           *settings,
                                                     const char          *settings_key,
                                                     GsdMediaKeysManager *manager);
+
+static void      lock_screensaver (GsdMediaKeysManager *manager);
+
 G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT)
 
 static gpointer manager_object = NULL;
@@ -338,6 +347,62 @@ execute (GsdMediaKeysManager *manager,
 }
 
 static void
+sleep_cb_screensaver_proxy_ready_cb (GObject *source_object,
+                            GAsyncResult *res,
+                            gpointer user_data)
+{
+        GError *error = NULL;
+        GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data);
+
+        manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+        if (manager->priv->screensaver_proxy == NULL) {
+                g_warning ("Could not connect to gnome-screensaver: %s",
+                           error->message);
+                g_error_free (error);
+                return;
+        }
+
+        /* Finish the upower_notify_sleep_cb() call by locking the screen */
+        g_debug ("gnome-screensaver activated, doing gnome-screensaver lock");
+        g_dbus_proxy_call (manager->priv->screensaver_proxy,
+                           "Lock",
+                           NULL, G_DBUS_CALL_FLAGS_NONE, -1,
+                           NULL, NULL, NULL);
+}
+
+
+static void
+lock_screensaver (GsdMediaKeysManager *manager)
+{
+        gboolean do_lock;
+
+        do_lock = g_settings_get_boolean (manager->priv->settings_screensaver,
+                                          "lock-enabled");
+        if (!do_lock)
+                return;
+
+        if (manager->priv->screensaver_proxy != NULL) {
+                g_debug ("doing gnome-screensaver lock");
+                g_dbus_proxy_call (manager->priv->screensaver_proxy,
+                                   "Lock",
+                                   NULL, G_DBUS_CALL_FLAGS_NONE, -1,
+                                   NULL, NULL, NULL);
+        } else {
+                /* connect to the screensaver first */
+                g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+                                          G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+                                          NULL,
+                                          GS_DBUS_NAME,
+                                          GS_DBUS_PATH,
+                                          GS_DBUS_INTERFACE,
+                                          NULL,
+                                          sleep_cb_screensaver_proxy_ready_cb,
+                                          manager);
+       }
+}
+
+
+static void
 dialog_init (GsdMediaKeysManager *manager)
 {
         if (manager->priv->dialog != NULL
@@ -1627,6 +1692,7 @@ do_config_power_action (GsdMediaKeysManager *manager,
                                            config_key);
         switch (action_type) {
         case GSD_POWER_ACTION_SUSPEND:
+	        lock_screensaver (manager);
                 gsd_power_suspend (manager->priv->upower_proxy);
                 break;
         case GSD_POWER_ACTION_INTERACTIVE:
@@ -2197,6 +2263,8 @@ gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
         gnome_settings_profile_end ("gvc_mixer_control_new");
 
         manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager);
+	
+	manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver");
 
         register_manager (manager_object);
 
@@ -2335,6 +2403,9 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
                 g_list_free (priv->media_players);
                 priv->media_players = NULL;
         }
+	g_object_unref (manager->priv->settings_screensaver);
+        manager->priv->settings_screensaver = NULL;
+
 }
 
 static GObject *
