[calls] call: Add call-type property
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] call: Add call-type property
- Date: Thu, 10 Feb 2022 08:34:24 +0000 (UTC)
commit f50f0b8b744e76ba0128563cf464d70c44c41c54
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Wed Feb 9 18:29:24 2022 +0100
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.
src/calls-call.c | 36 ++++++++++++++++++++++++++++++++++++
src/calls-call.h | 10 ++++++++--
src/calls-ui-call-data.c | 15 +++++++++++++++
src/calls-ui-call-data.h | 2 ++
4 files changed, 61 insertions(+), 2 deletions(-)
---
diff --git a/src/calls-call.c b/src/calls-call.c
index 0fbaedd5..c1b7ce42 100644
--- a/src/calls-call.c
+++ b/src/calls-call.c
@@ -53,6 +53,7 @@ enum {
PROP_NAME,
PROP_STATE,
PROP_PROTOCOL,
+ PROP_CALL_TYPE,
N_PROPS,
};
@@ -69,6 +70,7 @@ typedef struct {
char *name;
CallsCallState state;
gboolean inbound;
+ CallsCallType call_type;
} CallsCallPrivate;
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));
break;
+ case PROP_CALL_TYPE:
+ priv->call_type = g_value_get_enum (value);
+ break;
+
default:
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));
break;
+ case PROP_CALL_TYPE:
+ g_value_set_enum (value, calls_call_get_call_type (self));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -236,6 +246,16 @@ calls_call_class_init (CallsCallClass *klass)
NULL,
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);
/**
@@ -400,6 +420,22 @@ calls_call_set_state (CallsCall *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:
* @self: a #CallsCall
diff --git a/src/calls-call.h b/src/calls-call.h
index 022e9bc4..cae105f8 100644
--- a/src/calls-call.h
+++ b/src/calls-call.h
@@ -33,8 +33,7 @@ G_BEGIN_DECLS
G_DECLARE_DERIVABLE_TYPE (CallsCall, calls_call, CALLS, CALL, GObject)
-typedef enum
-{
+typedef enum {
CALLS_CALL_STATE_UNKNOWN = 0,
CALLS_CALL_STATE_ACTIVE,
CALLS_CALL_STATE_HELD,
@@ -45,6 +44,12 @@ typedef enum
CALLS_CALL_STATE_DISCONNECTED
} CallsCallState;
+typedef enum {
+ CALLS_CALL_TYPE_UNKNOWN = 0,
+ CALLS_CALL_TYPE_CELLULAR,
+ CALLS_CALL_TYPE_SIP_VOICE,
+} CallsCallType;
+
struct _CallsCallClass
{
GObjectClass parent_iface;
@@ -65,6 +70,7 @@ void calls_call_set_name (CallsCall *self,
CallsCallState calls_call_get_state (CallsCall *self);
void calls_call_set_state (CallsCall *self,
CallsCallState state);
+CallsCallType calls_call_get_call_type (CallsCall *self);
gboolean calls_call_get_inbound (CallsCall *self);
const char *calls_call_get_protocol (CallsCall *self);
void calls_call_answer (CallsCall *self);
diff --git a/src/calls-ui-call-data.c b/src/calls-ui-call-data.c
index 52417199..70f39b9c 100644
--- a/src/calls-ui-call-data.c
+++ b/src/calls-ui-call-data.c
@@ -652,6 +652,21 @@ calls_ui_call_data_get_ui_active (CallsUiCallData *self)
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:
* @state: A #CallsCallState
diff --git a/src/calls-ui-call-data.h b/src/calls-ui-call-data.h
index a67a3a53..8ca6be93 100644
--- a/src/calls-ui-call-data.h
+++ b/src/calls-ui-call-data.h
@@ -39,6 +39,8 @@ CallsUiCallData *calls_ui_call_data_new (CallsCall *
void calls_ui_call_data_silence_ring (CallsUiCallData *self);
gboolean calls_ui_call_data_get_silenced (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);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]