From 94345e09165bc944505c84bfa84dd57a70321b5b Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Wed, 24 Feb 2021 09:27:59 +0100 Subject: [PATCH] manager: hang up secondary calls --- src/calls-manager.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/calls-manager.c b/src/calls-manager.c index 2fe367f..7e48a54 100644 --- a/src/calls-manager.c +++ b/src/calls-manager.c @@ -40,6 +40,7 @@ struct _CallsManager gchar *provider_name; CallsOrigin *default_origin; CallsManagerState state; + CallsCall *primary_call; }; G_DEFINE_TYPE (CallsManager, calls_manager, G_TYPE_OBJECT); @@ -140,6 +141,11 @@ add_call (CallsManager *self, CallsCall *call, CallsOrigin *origin) g_return_if_fail (CALLS_IS_CALL (call)); g_signal_emit (self, signals[SIGNAL_CALL_ADD], 0, call, origin); + + if (self->primary_call == NULL) + self->primary_call = call; + else + calls_call_hang_up (call); } static void @@ -151,6 +157,9 @@ remove_call (CallsManager *self, CallsCall *call, gchar *reason, CallsOrigin *or /* We ignore the reason for now, because it doesn't give any usefull information */ g_signal_emit (self, signals[SIGNAL_CALL_REMOVE], 0, call, origin); + + if (self->primary_call == call) + self->primary_call = NULL; } static void @@ -482,6 +491,7 @@ calls_manager_init (CallsManager *self) { self->state = CALLS_MANAGER_STATE_NO_PROVIDER; self->provider_name = NULL; + self->primary_call = NULL; // Load the contacts provider self->contacts_provider = calls_contacts_provider_new ();