From 38aea51b22d1e63b778c0e0cc654edb71b828c4a Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Tue, 25 May 2010 01:23:42 +0200 Subject: Add location provider that reads location from the gconf key associated with the GNOME Clock applet. The implementation is rather simplistic as it only reads the location once on init but that'll have to do for now. --- src/redshift.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/redshift.c') diff --git a/src/redshift.c b/src/redshift.c index f297c3a..b0c3e04 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -70,6 +70,10 @@ #include "location-manual.h" +#ifdef ENABLE_GNOME_CLOCK +# include "location-gnome-clock.h" +#endif + /* Union of state data for gamma adjustment methods */ typedef union { @@ -121,11 +125,23 @@ static const gamma_method_t gamma_methods[] = { /* Union of state data for location providers */ typedef union { location_manual_state_t manual; +#ifdef ENABLE_GNOME_CLOCK + location_gnome_clock_state_t gnome_clock; +#endif } location_state_t; /* Location provider method structs */ static const location_provider_t location_providers[] = { +#ifdef ENABLE_GNOME_CLOCK + { + "GNOME-Clock", + (location_provider_init_func *)location_gnome_clock_init, + (location_provider_free_func *)location_gnome_clock_free, + (location_provider_get_location_func *) + location_gnome_clock_get_location + }, +#endif { "Manual", (location_provider_init_func *)location_manual_init, @@ -361,7 +377,7 @@ main(int argc, char *argv[]) /* Try to parse provider name as float */ errno = 0; char *end; - float lat = strtof(optarg, &end); + float v = strtof(optarg, &end); if (errno == 0 && *end == ':') { provider_name = "Manual"; provider_args = optarg; -- cgit v1.2.3-70-g09d2