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:
parent
6cdae3fd40
commit
a8cb3dd7c7
1 changed files with 17 additions and 1 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue