aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-10-22 09:22:00 -0400
committerTed Gould <ted@gould.cx>2010-10-22 09:22:00 -0400
commit1fdf38754c8f332a5b2e385b8f9d781e8669cf72 (patch)
tree7d7f529f26610cc4db7ff29cc20d258552985aae /src
parentcc5d5780cb01c1ceebc1da10f1329b16eab27749 (diff)
downloadayatana-indicator-datetime-1fdf38754c8f332a5b2e385b8f9d781e8669cf72.tar.gz
ayatana-indicator-datetime-1fdf38754c8f332a5b2e385b8f9d781e8669cf72.tar.bz2
ayatana-indicator-datetime-1fdf38754c8f332a5b2e385b8f9d781e8669cf72.zip
Filling out the changing callbacks
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 7148c69..70c37cd 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -38,6 +38,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "datetime-interface.h"
#include "dbus-shared.h"
+static void geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar * path, GError * error, gpointer user_data);
static void setup_timer (void);
static IndicatorService * service = NULL;
@@ -394,6 +395,7 @@ geo_create_address (GeoclueMasterClient * master, GeoclueAddress * address, GErr
g_debug("Created Geoclue Address");
geo_address = address;
+ g_object_ref(G_OBJECT(geo_address));
geoclue_address_get_address_async(geo_address, geo_address_cb, NULL);
@@ -414,6 +416,22 @@ geo_req_set (GeoclueMasterClient * master, GError * error, gpointer user_data)
static void
geo_client_invalid (GeoclueMasterClient * client, gpointer user_data)
{
+ g_warning("Master client invalid, rebuilding.");
+
+ if (geo_master != NULL) {
+ g_object_unref(G_OBJECT(geo_master));
+ }
+ geo_master = NULL;
+
+ GeoclueMaster * master = geoclue_master_get_default();
+ geoclue_master_create_client_async(master, geo_create_client, NULL);
+
+ if (geo_timezone != NULL) {
+ g_free(geo_timezone);
+ geo_timezone = NULL;
+ }
+
+ check_timezone_sync();
return;
}
@@ -422,7 +440,21 @@ geo_client_invalid (GeoclueMasterClient * client, gpointer user_data)
static void
geo_address_change (GeoclueMasterClient * client, gchar * a, gchar * b, gchar * c, gchar * d, gpointer user_data)
{
+ g_warning("Address provider changed. Let's change");
+
+ if (geo_address != NULL) {
+ g_object_unref(G_OBJECT(geo_address));
+ }
+ geo_address = NULL;
+ geoclue_master_client_create_address_async(geo_master, geo_create_address, NULL);
+
+ if (geo_timezone != NULL) {
+ g_free(geo_timezone);
+ geo_timezone = NULL;
+ }
+
+ check_timezone_sync();
return;
}
@@ -434,6 +466,7 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar *
g_debug("Created Geoclue client at: %s", path);
geo_master = client;
+ g_object_ref(G_OBJECT(geo_master));
geoclue_master_client_set_requirements_async(geo_master,
GEOCLUE_ACCURACY_LEVEL_REGION,