manager: Differentiate the NO_ORIGIN state

This avoids confusion when only the SIP plugin is loaded, but no account
is being used.

For this we introduce two new functions in the abstract CallsProvider class:
`is_modem()` to indicate whether the the provider deals with PTSN telephony and
`is_operational()` which by default simply checks if there any avalaible origins
This commit is contained in:
Evangelos Ribeiro Tzaras
2021-05-04 21:49:07 +02:00
parent 98d66743a1
commit 44f2002f86
7 changed files with 90 additions and 5 deletions

View File

@@ -92,6 +92,10 @@ static void
update_state (CallsManager *self)
{
guint n_items;
GHashTableIter iter;
gpointer key;
gpointer value;
g_assert (CALLS_IS_MANAGER (self));
if (g_hash_table_size (self->providers) == 0) {
@@ -99,9 +103,15 @@ update_state (CallsManager *self)
return;
}
if (g_hash_table_contains (self->providers, "dummy")) {
set_state (self, CALLS_MANAGER_STATE_READY);
return;
g_hash_table_iter_init (&iter, self->providers);
while (g_hash_table_iter_next (&iter, &key, &value)) {
CallsProvider *provider = CALLS_PROVIDER (value);
if (calls_provider_is_modem (provider) && !calls_provider_is_operational (provider)) {
set_state (self, CALLS_MANAGER_STATE_NO_VOICE_MODEM);
return;
}
}
n_items = g_list_model_get_n_items (G_LIST_MODEL (self->origins));