mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 11:35:32 +00:00
dummy-provider: Add new anonymous incoming call on SIGUSR2
This commit is contained in:
parent
79875cb64e
commit
3ac8cc1580
3 changed files with 22 additions and 3 deletions
|
@ -102,8 +102,6 @@ CallsDummyCall *
|
|||
calls_dummy_call_new (const gchar *id,
|
||||
gboolean inbound)
|
||||
{
|
||||
g_return_val_if_fail (id != NULL, NULL);
|
||||
|
||||
return g_object_new (CALLS_TYPE_DUMMY_CALL,
|
||||
"id", id,
|
||||
"inbound", inbound,
|
||||
|
|
|
@ -296,7 +296,6 @@ void
|
|||
calls_dummy_origin_create_inbound (CallsDummyOrigin *self,
|
||||
const gchar *number)
|
||||
{
|
||||
g_return_if_fail (number != NULL);
|
||||
g_return_if_fail (CALLS_IS_DUMMY_ORIGIN (self));
|
||||
|
||||
add_call (self, number, TRUE);
|
||||
|
|
|
@ -81,6 +81,25 @@ usr1_handler (CallsDummyProvider *self)
|
|||
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 *
|
||||
calls_dummy_provider_get_name (CallsProvider *provider)
|
||||
{
|
||||
|
@ -123,6 +142,9 @@ constructed (GObject *object)
|
|||
g_unix_signal_add (SIGUSR1,
|
||||
(GSourceFunc)usr1_handler,
|
||||
self);
|
||||
g_unix_signal_add (SIGUSR2,
|
||||
(GSourceFunc) usr2_handler,
|
||||
self);
|
||||
|
||||
G_OBJECT_CLASS (calls_dummy_provider_parent_class)->constructed (object);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue