From 5ad49f9e49c4aceb42fb1aa2c393b8585cc11b9e Mon Sep 17 00:00:00 2001
From: Mattias Andrée <maandree@operamail.com>
Date: Fri, 11 Apr 2014 07:28:14 +0200
Subject: Try to use DISPLAY=:0 if not in X
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <maandree@operamail.com>
---
 src/location-geoclue.c | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src')

diff --git a/src/location-geoclue.c b/src/location-geoclue.c
index d420457..5c027c7 100644
--- a/src/location-geoclue.c
+++ b/src/location-geoclue.c
@@ -60,6 +60,10 @@ location_geoclue_start(location_geoclue_state_t *state)
 		state->position = geoclue_position_new(state->provider,
 						       state->provider_path);
         } else {
+		if (getenv("DISPLAY") == NULL || *getenv("DISPLAY") == '\0') {
+			/* TODO This (hack) should be removed when GeoClue has been patched. */
+			putenv("DISPLAY=:0");
+		}
                 GError *error = NULL;
                 GeoclueMaster *master = geoclue_master_get_default();
                 GeoclueMasterClient *client = geoclue_master_create_client(master,
-- 
cgit v1.2.3-70-g09d2