[gnome-screensaver] gnome-screensaver-command: don't activate screensaver for --query
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screensaver] gnome-screensaver-command: don't activate screensaver for --query
- Date: Tue, 19 Oct 2010 17:57:05 +0000 (UTC)
commit a37f531e5ba968bea445e82dbc418d8b7ced219c
Author: Ray Strode <rstrode redhat com>
Date: Tue Oct 19 13:55:19 2010 -0400
gnome-screensaver-command: don't activate screensaver for --query
Now that gnome-screensaver is auto activated, we need to take care
not to activate it for --query (since --query is supposed to query
if gnome-screensaver is running, not start it).
https://bugzilla.gnome.org/show_bug.cgi?id=629740
src/gnome-screensaver-command.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-screensaver-command.c b/src/gnome-screensaver-command.c
index e94a7cb..dfc6a62 100644
--- a/src/gnome-screensaver-command.c
+++ b/src/gnome-screensaver-command.c
@@ -270,6 +270,22 @@ oom:
}
static gboolean
+screensaver_is_running (DBusConnection *connection)
+{
+ DBusError error;
+ gboolean exists;
+
+ g_return_val_if_fail (connection != NULL, FALSE);
+
+ dbus_error_init (&error);
+ exists = dbus_bus_name_has_owner (connection, GS_SERVICE, &error);
+ if (dbus_error_is_set (&error))
+ dbus_error_free (&error);
+
+ return exists;
+}
+
+static gboolean
do_command (DBusConnection *connection)
{
DBusMessage *reply;
@@ -284,6 +300,11 @@ do_command (DBusConnection *connection)
DBusMessageIter array;
dbus_bool_t v;
+ if (!screensaver_is_running (connection)) {
+ g_message ("Screensaver is not running!");
+ goto done;
+ }
+
reply = screensaver_send_message_void (connection, "GetActive", TRUE);
if (! reply) {
g_message ("Did not receive a reply from the screensaver.");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]