location service: adapt to make use of the portal

GClue automatically calls the portal for us when sandboxed and in such case
a NULL is returned for the client porxy because the calls goes through the portal.

Part of https://gitlab.gnome.org/GNOME/Initiatives/-/issues/30
This commit is contained in:
Bilal Elmoussaoui
2022-02-12 21:16:19 +00:00
committed by Georges Basile Stavracas Neto
parent 552fd413ae
commit 66a3661e60
2 changed files with 33 additions and 13 deletions
+17 -12
View File
@@ -762,13 +762,14 @@ on_gclue_simple_creation_cb (GClueSimple *_source,
self,
0);
}
g_signal_connect_object (client,
"notify::active",
G_CALLBACK (on_gclue_client_activity_changed_cb),
self,
0);
if (client)
{
g_signal_connect_object (client,
"notify::active",
G_CALLBACK (on_gclue_client_activity_changed_cb),
self,
0);
}
GCAL_EXIT;
}
@@ -1141,6 +1142,7 @@ void
gcal_weather_service_stop (GcalWeatherService *self)
{
GCAL_ENTRY;
GClueClient *client;
g_return_if_fail (GCAL_IS_WEATHER_SERVICE (self));
@@ -1162,11 +1164,14 @@ gcal_weather_service_stop (GcalWeatherService *self)
}
else
{
gclue_client_call_stop (gclue_simple_get_client (self->location_service),
self->location_cancellable,
(GAsyncReadyCallback) on_gclue_client_stopped_cb,
self->location_service);
client = gclue_simple_get_client (self->location_service);
if (client)
{
gclue_client_call_stop (client,
self->location_cancellable,
(GAsyncReadyCallback) on_gclue_client_stopped_cb,
self->location_service);
}
self->location_service = NULL;
}