1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-04 23:51:17 +00:00

emergency-calls: Notify on DBus when emergency numbers change

This is needed if an origin changes it's emergency numbers on the fly
(e.g. when initializing them late).
This commit is contained in:
Guido Günther 2022-12-21 19:13:23 +01:00 committed by Evangelos Ribeiro Tzaras
parent 6cdae3fd40
commit a8cb3dd7c7

View file

@ -38,10 +38,26 @@ G_DEFINE_TYPE_WITH_CODE (CallsEmergencyCallsManager,
calls_emergency_calls_iface_init)); calls_emergency_calls_iface_init));
static void static void
on_origins_changed (CallsEmergencyCallsManger *self) on_emergency_numbers_changed (CallsEmergencyCallsManger *self)
{
g_signal_emit_by_name (self, "emergency-numbers-changed", 0);
}
static void
on_origins_changed (CallsEmergencyCallsManger *self, guint position, guint added)
{ {
g_assert (CALLS_IS_EMERGENCY_CALLS_MANAGER (self)); g_assert (CALLS_IS_EMERGENCY_CALLS_MANAGER (self));
for (int i = 0; i < added; i++) {
CallsOrigin *origin = g_list_model_get_item (self->origins, position + i);
g_signal_connect_object (origin, "notify::emergency-numbers",
G_CALLBACK (on_emergency_numbers_changed),
self,
G_CONNECT_SWAPPED);
}
g_signal_emit_by_name (self, "emergency-numbers-changed", 0); g_signal_emit_by_name (self, "emergency-numbers-changed", 0);
} }