1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-04 15:41:19 +00:00

call: Add call-type property

The designs for the call details show information on the type of the call:
https://gitlab.gnome.org/Teams/Design/app-mockups/blob/master/calls/calls.png
So f.e. "Cellular", "Matrix WebRTC Video Call".

These properties can potentially also be useful in choosing the mechanism to
use for the audio controls from the call display.
This commit is contained in:
Evangelos Ribeiro Tzaras 2022-02-09 18:29:24 +01:00
parent 34b447a4ca
commit f50f0b8b74
4 changed files with 61 additions and 2 deletions

View file

@ -53,6 +53,7 @@ enum {
PROP_NAME, PROP_NAME,
PROP_STATE, PROP_STATE,
PROP_PROTOCOL, PROP_PROTOCOL,
PROP_CALL_TYPE,
N_PROPS, N_PROPS,
}; };
@ -69,6 +70,7 @@ typedef struct {
char *name; char *name;
CallsCallState state; CallsCallState state;
gboolean inbound; gboolean inbound;
CallsCallType call_type;
} CallsCallPrivate; } CallsCallPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CallsCall, calls_call, G_TYPE_OBJECT) G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CallsCall, calls_call, G_TYPE_OBJECT)
@ -127,6 +129,10 @@ calls_call_set_property (GObject *object,
calls_call_set_state (self, g_value_get_enum (value)); calls_call_set_state (self, g_value_get_enum (value));
break; break;
case PROP_CALL_TYPE:
priv->call_type = g_value_get_enum (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -162,6 +168,10 @@ calls_call_get_property (GObject *object,
g_value_set_string (value, calls_call_get_protocol (self)); g_value_set_string (value, calls_call_get_protocol (self));
break; break;
case PROP_CALL_TYPE:
g_value_set_enum (value, calls_call_get_call_type (self));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -236,6 +246,16 @@ calls_call_class_init (CallsCallClass *klass)
NULL, NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
properties[PROP_CALL_TYPE] =
g_param_spec_enum ("call-type",
"Call type",
"The type of call (f.e. cellular, sip voice)",
CALLS_TYPE_CALL_TYPE,
CALLS_CALL_TYPE_UNKNOWN,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties); g_object_class_install_properties (object_class, N_PROPS, properties);
/** /**
@ -400,6 +420,22 @@ calls_call_set_state (CallsCall *self,
g_object_unref (G_OBJECT (self)); g_object_unref (G_OBJECT (self));
} }
/**
* calls_call_get_call_type:
* @self: a #CallsCall
*
* Returns: The type of call, or #CALLS_CALL_TYPE_UNKNOWN if not known.
*/
CallsCallType
calls_call_get_call_type (CallsCall *self)
{
CallsCallPrivate *priv = calls_call_get_instance_private (self);
g_return_val_if_fail (CALLS_IS_CALL (self), CALLS_CALL_TYPE_UNKNOWN);
return priv->call_type;
}
/** /**
* calls_call_answer: * calls_call_answer:
* @self: a #CallsCall * @self: a #CallsCall

View file

@ -33,8 +33,7 @@ G_BEGIN_DECLS
G_DECLARE_DERIVABLE_TYPE (CallsCall, calls_call, CALLS, CALL, GObject) G_DECLARE_DERIVABLE_TYPE (CallsCall, calls_call, CALLS, CALL, GObject)
typedef enum typedef enum {
{
CALLS_CALL_STATE_UNKNOWN = 0, CALLS_CALL_STATE_UNKNOWN = 0,
CALLS_CALL_STATE_ACTIVE, CALLS_CALL_STATE_ACTIVE,
CALLS_CALL_STATE_HELD, CALLS_CALL_STATE_HELD,
@ -45,6 +44,12 @@ typedef enum
CALLS_CALL_STATE_DISCONNECTED CALLS_CALL_STATE_DISCONNECTED
} CallsCallState; } CallsCallState;
typedef enum {
CALLS_CALL_TYPE_UNKNOWN = 0,
CALLS_CALL_TYPE_CELLULAR,
CALLS_CALL_TYPE_SIP_VOICE,
} CallsCallType;
struct _CallsCallClass struct _CallsCallClass
{ {
GObjectClass parent_iface; GObjectClass parent_iface;
@ -65,6 +70,7 @@ void calls_call_set_name (CallsCall *self,
CallsCallState calls_call_get_state (CallsCall *self); CallsCallState calls_call_get_state (CallsCall *self);
void calls_call_set_state (CallsCall *self, void calls_call_set_state (CallsCall *self,
CallsCallState state); CallsCallState state);
CallsCallType calls_call_get_call_type (CallsCall *self);
gboolean calls_call_get_inbound (CallsCall *self); gboolean calls_call_get_inbound (CallsCall *self);
const char *calls_call_get_protocol (CallsCall *self); const char *calls_call_get_protocol (CallsCall *self);
void calls_call_answer (CallsCall *self); void calls_call_answer (CallsCall *self);

View file

@ -652,6 +652,21 @@ calls_ui_call_data_get_ui_active (CallsUiCallData *self)
return self->ui_active; return self->ui_active;
} }
/**
* calls_ui_call_data_get_call_type:
* @self: a #CallsUiCallData
*
* Returns: The type of call, or #CALLS_CALL_TYPE_UNKNOWN if not known.
*/
CallsCallType
calls_ui_call_data_get_call_type (CallsUiCallData *self)
{
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), CALLS_CALL_TYPE_UNKNOWN);
g_return_val_if_fail (CALLS_CALL (self->call), CALLS_CALL_TYPE_UNKNOWN);
return calls_call_get_call_type (self->call);
}
/** /**
* calls_call_state_to_cui_call_state: * calls_call_state_to_cui_call_state:
* @state: A #CallsCallState * @state: A #CallsCallState

View file

@ -39,6 +39,8 @@ CallsUiCallData *calls_ui_call_data_new (CallsCall *
void calls_ui_call_data_silence_ring (CallsUiCallData *self); void calls_ui_call_data_silence_ring (CallsUiCallData *self);
gboolean calls_ui_call_data_get_silenced (CallsUiCallData *self); gboolean calls_ui_call_data_get_silenced (CallsUiCallData *self);
gboolean calls_ui_call_data_get_ui_active (CallsUiCallData *self); gboolean calls_ui_call_data_get_ui_active (CallsUiCallData *self);
CallsCallType calls_ui_call_data_get_call_type (CallsUiCallData *self);
CuiCallState calls_call_state_to_cui_call_state (CallsCallState state); CuiCallState calls_call_state_to_cui_call_state (CallsCallState state);
G_END_DECLS G_END_DECLS