Commit e8a55318 authored by Zeeshan Ali's avatar Zeeshan Ali

demo: Exit if geoclue deactivates us automatically

This mostl likely means that user disabled geolocation (globally or for
the client specifically) so there is no point in keeping it running.
parent 77d2ed9c
......@@ -89,6 +89,33 @@ on_location_proxy_ready (GObject *source_object,
g_object_unref (location);
static void
on_client_props_changed (GDBusProxy *client,
GVariant *changed_properties,
GStrv invalidated_properties,
gpointer user_data)
GVariantIter *iter;
const gchar *key;
GVariant *value;
if (g_variant_n_children (changed_properties) <= 0)
g_variant_get (changed_properties, "a{sv}", &iter);
while (g_variant_iter_loop (iter, "{&sv}", &key, &value)) {
if (g_strcmp0 (key, "Active") != 0)
if (!g_variant_get_boolean (value)) {
g_print ("Geolocation disabled. Quiting..\n");
on_location_timeout (client);
g_variant_iter_free (iter);
static void
on_client_signal (GDBusProxy *client,
gchar *sender_name,
......@@ -150,6 +177,8 @@ on_client_proxy_ready (GObject *source_object,
g_signal_connect (client, "g-signal",
G_CALLBACK (on_client_signal), user_data);
g_signal_connect (client, "g-properties-changed",
G_CALLBACK (on_client_props_changed), user_data);
g_dbus_proxy_call (client,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment