From: Guillaume Desmottes Date: Tue, 1 Jun 2010 16:47:18 +0000 (+0200) Subject: don't start GPS when there is no working connection X-Git-Tag: azimuth-0.3~1 X-Git-Url: http://vcs.maemo.org/git/?p=azimuth;a=commitdiff_plain;h=434b5f3228e7e31cb3a5f30c531804eaaa37f4a1 don't start GPS when there is no working connection --- diff --git a/src/azimuth.c b/src/azimuth.c index 06daa08..adb73a2 100644 --- a/src/azimuth.c +++ b/src/azimuth.c @@ -55,7 +55,9 @@ update_gps (Azimuth *self) start_gps = gconf_client_get_bool (priv->gconf, AZIMUTH_GCONF_KEY_START_GPS, NULL); - if (priv->publisher != NULL && start_gps) + if (priv->publisher != NULL && + start_gps && + position_publisher_has_connections (priv->publisher)) { g_print ("starting GPS\n"); location_gpsd_control_start (priv->gps_control); @@ -83,11 +85,22 @@ update_blur (Azimuth *self) } static void +has_connections_changed_cb (PositionPublisher *publisher, + gboolean has_connections, + Azimuth *self) +{ + update_gps (self); +} + +static void create_publisher (Azimuth *self) { AzimuthPrivate *priv = AZIMUTH_GET_PRIVATE (self); priv->publisher = position_publisher_new (); + + g_signal_connect (priv->publisher, "has-connections-changed", + G_CALLBACK (has_connections_changed_cb), self); } static void