manager: Use state flags instead of an enum and adapt to changes

This gives us some more granularity and is overall a better fit than the states
previously used.

Closes #327
This commit is contained in:
Evangelos Ribeiro Tzaras
2022-01-26 14:18:24 +01:00
parent 69c530dda8
commit d75d4916af
5 changed files with 70 additions and 90 deletions

View File

@@ -324,9 +324,11 @@ static void
manager_state_changed_cb (GApplication *application)
{
GAction* dial_action = g_action_map_lookup_action (G_ACTION_MAP (application), "dial");
CallsManagerState state = calls_manager_get_state (calls_manager_get_default ());
CallsManagerFlags state_flags = calls_manager_get_state_flags (calls_manager_get_default ());
gboolean enabled = (state_flags & CALLS_MANAGER_FLAGS_HAS_CELLULAR_MODEM) ||
(state_flags & CALLS_MANAGER_FLAGS_HAS_VOIP_ACCOUNT);
g_simple_action_set_enabled (G_SIMPLE_ACTION (dial_action), state == CALLS_MANAGER_STATE_READY);
g_simple_action_set_enabled (G_SIMPLE_ACTION (dial_action), enabled);
}
static const GActionEntry actions[] =