1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-19 01:51:46 +00:00

dummy-provider: Add new anonymous incoming call on SIGUSR2

This commit is contained in:
Evangelos Ribeiro Tzaras 2022-02-17 10:53:14 +01:00
parent 79875cb64e
commit 3ac8cc1580
3 changed files with 22 additions and 3 deletions

View file

@ -102,8 +102,6 @@ CallsDummyCall *
calls_dummy_call_new (const gchar *id, calls_dummy_call_new (const gchar *id,
gboolean inbound) gboolean inbound)
{ {
g_return_val_if_fail (id != NULL, NULL);
return g_object_new (CALLS_TYPE_DUMMY_CALL, return g_object_new (CALLS_TYPE_DUMMY_CALL,
"id", id, "id", id,
"inbound", inbound, "inbound", inbound,

View file

@ -296,7 +296,6 @@ void
calls_dummy_origin_create_inbound (CallsDummyOrigin *self, calls_dummy_origin_create_inbound (CallsDummyOrigin *self,
const gchar *number) const gchar *number)
{ {
g_return_if_fail (number != NULL);
g_return_if_fail (CALLS_IS_DUMMY_ORIGIN (self)); g_return_if_fail (CALLS_IS_DUMMY_ORIGIN (self));
add_call (self, number, TRUE); add_call (self, number, TRUE);

View file

@ -81,6 +81,25 @@ usr1_handler (CallsDummyProvider *self)
return TRUE; return TRUE;
} }
static gboolean
usr2_handler (CallsDummyProvider *self)
{
GListModel *model;
g_autoptr(CallsDummyOrigin) origin = NULL;
model = G_LIST_MODEL (self->origins);
g_return_val_if_fail (g_list_model_get_n_items (model) > 0, FALSE);
g_debug ("Received SIGUSR2, adding new anonymous incoming call");
origin = g_list_model_get_item (model, 0);
calls_dummy_origin_create_inbound (origin, NULL);
return TRUE;
}
static const char * static const char *
calls_dummy_provider_get_name (CallsProvider *provider) calls_dummy_provider_get_name (CallsProvider *provider)
{ {
@ -123,6 +142,9 @@ constructed (GObject *object)
g_unix_signal_add (SIGUSR1, g_unix_signal_add (SIGUSR1,
(GSourceFunc)usr1_handler, (GSourceFunc)usr1_handler,
self); self);
g_unix_signal_add (SIGUSR2,
(GSourceFunc) usr2_handler,
self);
G_OBJECT_CLASS (calls_dummy_provider_parent_class)->constructed (object); G_OBJECT_CLASS (calls_dummy_provider_parent_class)->constructed (object);
} }