From f7dd7addd86aec7e56ef6e4af3e514b3030ac823 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Fri, 2 Jan 2015 22:26:44 -0500 Subject: Fix #153: geoclue2: Set desktop id on GeoClue2 client This property needs to be set in the latest versions of GeoClue2, but it is not available in early versions. --- src/location-geoclue2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/location-geoclue2.c b/src/location-geoclue2.c index 9b9b725..b559196 100644 --- a/src/location-geoclue2.c +++ b/src/location-geoclue2.c @@ -196,10 +196,27 @@ on_name_appeared(GDBusConnection *conn, const gchar *name, g_variant_unref(client_path_v); - /* Set distance threshold */ + /* Set desktop id (basename of the .desktop file) */ error = NULL; GVariant *ret_v = g_dbus_proxy_call_sync(geoclue_client, + "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", + "org.freedesktop.GeoClue2.Client", + "DesktopId", + g_variant_new("s", "redshift")), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, &error); + if (ret_v == NULL) { + /* Ignore this error for now. The property is not available + in early versions of GeoClue2. */ + } else { + g_variant_unref(ret_v); + } + + /* Set distance threshold */ + error = NULL; + ret_v = g_dbus_proxy_call_sync(geoclue_client, "org.freedesktop.DBus.Properties.Set", g_variant_new("(ssv)", "org.freedesktop.GeoClue2.Client", -- cgit v1.2.3-70-g09d2