1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-17 16:05:36 +00:00

calls-dummy-provider: Create an inbound call on SIGUSR1

This enables easy testing of inbound calls with just

$ calls -p dummy &
$ killall -USR1 calls
This commit is contained in:
Bob Ham 2019-06-25 11:14:16 +01:00
parent 824395b040
commit 215877cc60

View file

@ -28,6 +28,7 @@
#include "calls-dummy-origin.h" #include "calls-dummy-origin.h"
#include <libpeas/peas.h> #include <libpeas/peas.h>
#include <glib-unix.h>
struct _CallsDummyProvider struct _CallsDummyProvider
@ -82,6 +83,22 @@ get_origins (CallsProvider *iface)
} }
static gboolean
usr1_handler (CallsDummyProvider *self)
{
CallsDummyOrigin *origin;
g_return_val_if_fail (self->origins != NULL, FALSE);
g_debug ("Received SIGUSR1, adding new incoming call");
origin = CALLS_DUMMY_ORIGIN (self->origins->data);
calls_dummy_origin_create_inbound (origin, "0987654321");
return TRUE;
}
static void static void
constructed (GObject *object) constructed (GObject *object)
{ {
@ -90,6 +107,10 @@ constructed (GObject *object)
calls_dummy_provider_add_origin (self, "Dummy origin"); calls_dummy_provider_add_origin (self, "Dummy origin");
g_unix_signal_add (SIGUSR1,
(GSourceFunc)usr1_handler,
self);
parent_class->constructed (object); parent_class->constructed (object);
} }