1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-29 15:25:24 +00:00

ui-call-data: Add call state mapping to public API

This allows it to get used in the DBus manager in a GBindingTransformFunc
until to make sure we don't use emit deprecated values over DBus.
This commit is contained in:
Evangelos Ribeiro Tzaras 2022-01-18 02:40:29 +01:00
parent 4bc8e82ff6
commit e3afefcef2
2 changed files with 29 additions and 26 deletions

View file

@ -61,29 +61,6 @@ calls_ui_call_data_get_id (CuiCall *call_data)
return calls_call_get_id (self->call);
}
static CuiCallState
calls_state_to_cui_call_state (CallsCallState state)
{
switch (state) {
case CALLS_CALL_STATE_ACTIVE:
return CUI_CALL_STATE_ACTIVE;
case CALLS_CALL_STATE_HELD:
return CUI_CALL_STATE_HELD;
case CALLS_CALL_STATE_DIALING:
return CUI_CALL_STATE_DIALING;
case CALLS_CALL_STATE_ALERTING:
return CUI_CALL_STATE_DIALING;
case CALLS_CALL_STATE_INCOMING:
return CUI_CALL_STATE_INCOMING;
case CALLS_CALL_STATE_WAITING:
return CUI_CALL_STATE_INCOMING;
case CALLS_CALL_STATE_DISCONNECTED:
return CUI_CALL_STATE_DISCONNECTED;
default:
return CUI_CALL_STATE_UNKNOWN;
}
}
static CuiCallState
calls_ui_call_data_get_state (CuiCall *call_data)
{
@ -92,7 +69,7 @@ calls_ui_call_data_get_state (CuiCall *call_data)
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), CUI_CALL_STATE_UNKNOWN);
g_return_val_if_fail (!!self->call, CUI_CALL_STATE_UNKNOWN);
return calls_state_to_cui_call_state (calls_call_get_state (self->call));
return calls_call_state_to_cui_call_state (calls_call_get_state (self->call));
}
@ -383,3 +360,28 @@ calls_ui_call_data_get_call (CallsUiCallData *self)
return self->call;
}
CuiCallState
calls_call_state_to_cui_call_state (CallsCallState state)
{
switch (state) {
case CALLS_CALL_STATE_ACTIVE:
return CUI_CALL_STATE_ACTIVE;
case CALLS_CALL_STATE_HELD:
return CUI_CALL_STATE_HELD;
case CALLS_CALL_STATE_DIALING:
return CUI_CALL_STATE_DIALING;
case CALLS_CALL_STATE_ALERTING:
return CUI_CALL_STATE_DIALING;
case CALLS_CALL_STATE_INCOMING:
return CUI_CALL_STATE_INCOMING;
case CALLS_CALL_STATE_WAITING:
return CUI_CALL_STATE_INCOMING;
case CALLS_CALL_STATE_DISCONNECTED:
return CUI_CALL_STATE_DISCONNECTED;
default:
return CUI_CALL_STATE_UNKNOWN;
}
}

View file

@ -11,7 +11,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsUiCallData, calls_ui_call_data, CALLS, UI_CALL_DATA, GObject)
CallsUiCallData *calls_ui_call_data_new (CallsCall *call);
CallsCall *calls_ui_call_data_get_call (CallsUiCallData *self);
CallsUiCallData *calls_ui_call_data_new (CallsCall *call);
CallsCall *calls_ui_call_data_get_call (CallsUiCallData *self);
CuiCallState calls_call_state_to_cui_call_state (CallsCallState state);
G_END_DECLS