summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-12-06 07:03:26 -0800
committerStefano Karapetsas <[email protected]>2012-12-06 07:03:26 -0800
commit56feede13bb174845df74b328d0f6b5864f43463 (patch)
tree57cfc71fac1f8f771492993e1ae9820af1c900b5
parent97b9833a9a50572798e97a47f4dfa69f3363f00a (diff)
parentea114cb40c0ecd06ccc633d010b25d6101006645 (diff)
downloadmate-screensaver-56feede13bb174845df74b328d0f6b5864f43463.tar.bz2
mate-screensaver-56feede13bb174845df74b328d0f6b5864f43463.tar.xz
Merge pull request #12 from ketheriel/master
only allow one instance of mate-screensaver per user
-rw-r--r--src/gs-listener-dbus.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
index ed1199f..1f759e0 100644
--- a/src/gs-listener-dbus.c
+++ b/src/gs-listener-dbus.c
@@ -2204,7 +2204,7 @@ gboolean
gs_listener_acquire (GSListener *listener,
GError **error)
{
- gboolean acquired;
+ int acquired;
DBusError buserror;
gboolean is_connected;
@@ -2254,7 +2254,8 @@ gs_listener_acquire (GSListener *listener,
acquired = dbus_bus_request_name (listener->priv->connection,
GS_LISTENER_SERVICE,
- 0, &buserror) != -1;
+ DBUS_NAME_FLAG_DO_NOT_QUEUE,
+ &buserror);
if (dbus_error_is_set (&buserror))
{
g_set_error (error,
@@ -2263,6 +2264,14 @@ gs_listener_acquire (GSListener *listener,
"%s",
buserror.message);
}
+ if (acquired == DBUS_REQUEST_NAME_REPLY_EXISTS) {
+ g_set_error (error,
+ GS_LISTENER_ERROR,
+ GS_LISTENER_ERROR_ACQUISITION_FAILURE,
+ "%s",
+ _("screensaver already running in this session"));
+ return FALSE;
+ }
dbus_error_free (&buserror);
@@ -2331,7 +2340,7 @@ gs_listener_acquire (GSListener *listener,
}
finish:
- return acquired;
+ return (acquired != -1);
}
static char *