aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-11-04 18:42:56 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-11-04 18:42:56 -0600
commitce8ea326b06fed4a9d7537fe85cee0242ae01cef (patch)
tree7a0254de195a295fe845f7f6f1bf831522be77f8
parentb2d2e1ac4817de01aa3d3b039764c0b68df7b4ea (diff)
downloadayatana-indicator-datetime-ce8ea326b06fed4a9d7537fe85cee0242ae01cef.tar.gz
ayatana-indicator-datetime-ce8ea326b06fed4a9d7537fe85cee0242ae01cef.tar.bz2
ayatana-indicator-datetime-ce8ea326b06fed4a9d7537fe85cee0242ae01cef.zip
only use geoclue if com.canonical.indicator.datetime.show-auto-detected-location is true. honor GSettings changes for that variable to disable/enable our use of geoclue.
-rw-r--r--src/datetime-service.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 0c8a7f8..488856e 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -1344,6 +1344,15 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar *
return;
}
+static void
+on_use_geoclue_changed_cb (GSettings * settings, gchar * key, gpointer unused G_GNUC_UNUSED)
+{
+ geo_stop ();
+
+ if (g_settings_get_boolean (conf, SETTINGS_SHOW_DETECTED_S))
+ geo_start ();
+}
+
/****
*****
****/
@@ -1412,7 +1421,9 @@ main (int argc, char ** argv)
/* Set up GSettings */
conf = g_settings_new(SETTINGS_INTERFACE);
- // TODO Add a signal handler to catch gsettings changes and respond to them
+ g_signal_connect (conf, "changed::show-auto-detected-location",
+ G_CALLBACK(on_use_geoclue_changed_cb), NULL);
+ // TODO Add a signal handler to catch other gsettings changes and respond to them
/* Build our list of appointment calendar sources.
When a source changes, update our menu items.
@@ -1438,7 +1449,8 @@ main (int argc, char ** argv)
update_current_timezone();
/* Setup geoclue */
- geo_start ();
+ if (g_settings_get_boolean (conf, SETTINGS_SHOW_DETECTED_S))
+ geo_start ();
/* Setup dbus interface */
dbus = g_object_new(DATETIME_INTERFACE_TYPE, NULL);