From ee7e91dd8692f51acfde6a534766ff391000ed82 Mon Sep 17 00:00:00 2001
From: Jon Lund Steffensen <jonlst@gmail.com>
Date: Sun, 14 Dec 2014 16:19:25 -0500
Subject: Fix #80: Add Geoclue2 location provider

This simply runs a GLib main loop when the location is requested
and tries to get the location from GeoClue2. We need to run a
main loop since the location is not immediately available, instead
it becomes available through a signal.
---
 src/redshift.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

(limited to 'src/redshift.c')

diff --git a/src/redshift.c b/src/redshift.c
index 3f22f56..0c9a6bd 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -14,7 +14,7 @@
    You should have received a copy of the GNU General Public License
    along with Redshift.  If not, see <http://www.gnu.org/licenses/>.
 
-   Copyright (c) 2013  Jon Lund Steffensen <jonlst@gmail.com>
+   Copyright (c) 2009-2014  Jon Lund Steffensen <jonlst@gmail.com>
 */
 
 #ifdef HAVE_CONFIG_H
@@ -76,6 +76,10 @@
 # include "location-geoclue.h"
 #endif
 
+#ifdef ENABLE_GEOCLUE2
+# include "location-geoclue2.h"
+#endif
+
 
 /* Union of state data for gamma adjustment methods */
 typedef union {
@@ -182,6 +186,20 @@ static const location_provider_t location_providers[] = {
 		(location_provider_get_location_func *)
 		location_geoclue_get_location
 	},
+#endif
+#ifdef ENABLE_GEOCLUE2
+	{
+		"geoclue2",
+		(location_provider_init_func *)location_geoclue2_init,
+		(location_provider_start_func *)location_geoclue2_start,
+		(location_provider_free_func *)location_geoclue2_free,
+		(location_provider_print_help_func *)
+		location_geoclue2_print_help,
+		(location_provider_set_option_func *)
+		location_geoclue2_set_option,
+		(location_provider_get_location_func *)
+		location_geoclue2_get_location
+	},
 #endif
 	{
 		"manual",
-- 
cgit v1.2.3-70-g09d2