From a60a4a596ba5acacf766ea63837a6334cb66dbf5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Oct 2010 10:28:49 -0600 Subject: Caching the geoclue timezone --- src/datetime-service.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/datetime-service.c b/src/datetime-service.c index dffe002..7f37ac2 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -54,6 +54,7 @@ static DbusmenuMenuitem * tzchange = NULL; /* Geoclue trackers */ static GeoclueMasterClient * geo_master = NULL; static GeoclueAddress * geo_address = NULL; +static gchar * geo_timezone = NULL; /* Update the current timezone */ static void @@ -290,6 +291,17 @@ geo_address_cb (GeoclueAddress * address, int timestamp, GHashTable * addy_data, } g_debug("Geoclue timezone is: %s", (gchar *)g_hash_table_lookup(addy_data, "timezone")); + + if (geo_timezone != NULL) { + g_free(geo_timezone); + geo_timezone = NULL; + } + + gpointer tz_hash = g_hash_table_lookup(addy_data, "timezone"); + if (tz_hash != NULL) { + geo_timezone = g_strdup((gchar *)tz_hash); + } + return; } -- cgit v1.2.3