summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2009-07-23 11:15:08 +0000
committerphintuka <phintuka>2009-07-23 11:15:08 +0000
commit5b50658d71c7a18b2560237f7e194beff77cee25 (patch)
tree062c027f300b27a64b93c72d00722ac533ee393b
parent49194da98ff709b2809387cf3aaeb990c3ec80b7 (diff)
downloadxineliboutput-5b50658d71c7a18b2560237f7e194beff77cee25.tar.gz
xineliboutput-5b50658d71c7a18b2560237f7e194beff77cee25.tar.bz2
Check dbus_g_proxy_new_for_name() return value
Cosmetics
-rw-r--r--tools/gnome_screensaver.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/gnome_screensaver.c b/tools/gnome_screensaver.c
index 245f1f63..c12e5599 100644
--- a/tools/gnome_screensaver.c
+++ b/tools/gnome_screensaver.c
@@ -57,8 +57,8 @@ void gnome_screensaver_control(int enable)
/* Get a connection to the session bus */
error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (connection == NULL) {
- LOGERR(MSG_OpenBusConnectionError, error->message);
+ if (!connection) {
+ LOGERR(MSG_OpenBusConnectionError, error ? error->message : "<null>");
g_error_free(error);
return;
}
@@ -66,14 +66,19 @@ void gnome_screensaver_control(int enable)
/* Create a proxy object */
proxy = dbus_g_proxy_new_for_name(connection,
GS_SERVICE, GS_PATH, GS_INTERFACE);
+ if (!proxy) {
+ LOGDBG("Failed to get a proxy for gnome-screensaver");
+ return;
+ }
/* Enable the screensaver */
if (enable) {
/* First call the GNOME screensaver 2.15 API method */
error = NULL;
ret =
- dbus_g_proxy_call(proxy, "UnInhibit", &error, G_TYPE_UINT,
- cookie, G_TYPE_INVALID, G_TYPE_INVALID);
+ dbus_g_proxy_call(proxy, "UnInhibit", &error,
+ G_TYPE_UINT, cookie,
+ G_TYPE_INVALID, G_TYPE_INVALID);
/* If this fails, try the GNOME screensaver 2.14 API */
if (!ret && error->domain == DBUS_GERROR
@@ -91,10 +96,12 @@ void gnome_screensaver_control(int enable)
/* First call the GNOME screensaver 2.15 API method */
error = NULL;
ret =
- dbus_g_proxy_call(proxy, "Inhibit", &error, G_TYPE_STRING,
- GS_APPLICATION_NAME, G_TYPE_STRING,
- GS_REASON_FOR_INHIBIT, G_TYPE_INVALID,
- G_TYPE_UINT, cookie, G_TYPE_INVALID);
+ dbus_g_proxy_call(proxy, "Inhibit", &error,
+ G_TYPE_STRING, GS_APPLICATION_NAME,
+ G_TYPE_STRING, GS_REASON_FOR_INHIBIT,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, cookie,
+ G_TYPE_INVALID);
/* If this fails, try the GNOME screensaver 2.14 API */
if (!ret && error->domain == DBUS_GERROR