aboutsummaryrefslogtreecommitdiffstats
path: root/src/redshift.c
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2014-12-14 16:19:25 -0500
committerJon Lund Steffensen <jonlst@gmail.com>2014-12-15 01:47:49 -0500
commitee7e91dd8692f51acfde6a534766ff391000ed82 (patch)
treecacf18fd8b6f2c1ac9a4d1951bd85de114fa5957 /src/redshift.c
parentsystemtime: Use gettimeofday if POSIX timers not available (diff)
downloadredshift-ng-ee7e91dd8692f51acfde6a534766ff391000ed82.tar.gz
redshift-ng-ee7e91dd8692f51acfde6a534766ff391000ed82.tar.bz2
redshift-ng-ee7e91dd8692f51acfde6a534766ff391000ed82.tar.xz
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.
Diffstat (limited to 'src/redshift.c')
-rw-r--r--src/redshift.c20
1 files changed, 19 insertions, 1 deletions
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 {
@@ -183,6 +187,20 @@ static const location_provider_t location_providers[] = {
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",
(location_provider_init_func *)location_manual_init,