[gnome-power-manager/gnome-2-26] Don't show an error if the Suspend or Hibernate timed out



commit 1e3cf22d80ee7622c9a85b8288364530e9fbeacc
Author: Matthew Garrett <mjg redhat com>
Date:   Tue May 26 11:19:30 2009 +0100

    Don't show an error if the Suspend or Hibernate timed out
    
    Signed-off-by: Richard Hughes <richard hughsie com>
---
 libdevkit-power/dkp-client.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/libdevkit-power/dkp-client.c b/libdevkit-power/dkp-client.c
index 91d4a09..360e961 100644
--- a/libdevkit-power/dkp-client.c
+++ b/libdevkit-power/dkp-client.c
@@ -138,11 +138,17 @@ dkp_client_suspend (DkpClient *client, GError **error)
 	ret = dbus_g_proxy_call (client->priv->proxy, "Suspend", &error_local,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
 	if (!ret) {
+		if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
+			ret = TRUE;
+			goto out;
+		}
 		egg_warning ("Couldn't suspend: %s", error_local->message);
 		if (error != NULL)
 			*error = g_error_new (1, 0, "%s", error_local->message);
-		g_error_free (error_local);
 	}
+out:
+	if (error_local != NULL)
+		g_error_free (error_local);
 	return ret;
 }
 
@@ -161,11 +167,17 @@ dkp_client_hibernate (DkpClient *client, GError **error)
 	ret = dbus_g_proxy_call (client->priv->proxy, "Hibernate", &error_local,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
 	if (!ret) {
+		if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
+			ret = TRUE;
+			goto out;
+		}
 		egg_warning ("Couldn't hibernate: %s", error_local->message);
 		if (error != NULL)
 			*error = g_error_new (1, 0, "%s", error_local->message);
-		g_error_free (error_local);
 	}
+out:
+	if (error_local != NULL)
+		g_error_free (error_local);
 	return ret;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]