[calls] call: Get rid of tone_stop
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] call: Get rid of tone_stop
- Date: Tue, 23 Nov 2021 09:39:52 +0000 (UTC)
commit a353a03d01c1a19c5506c2fc31a51bef38cdfb5a
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Tue Nov 16 13:59:06 2021 +0100
call: Get rid of tone_stop
It wasn't used by any plugin backend and helps getting rid of a lot of code.
plugins/mm/calls-mm-call.c | 4 +--
plugins/ofono/calls-ofono-call.c | 4 +--
src/calls-call.c | 72 +++++++---------------------------------
src/calls-call.h | 9 ++---
src/calls-ui-call-data.c | 19 +----------
5 files changed, 19 insertions(+), 89 deletions(-)
---
diff --git a/plugins/mm/calls-mm-call.c b/plugins/mm/calls-mm-call.c
index 119ef5e7..b8d80d95 100644
--- a/plugins/mm/calls-mm-call.c
+++ b/plugins/mm/calls-mm-call.c
@@ -275,7 +275,7 @@ DEFINE_OPERATION(start, calls_mm_call_start_call, "starting outgoing call");
static void
-calls_mm_call_tone_start (CallsCall *call, gchar key)
+calls_mm_call_send_dtmf_tone (CallsCall *call, gchar key)
{
CallsMMCall *self = CALLS_MM_CALL (call);
struct CallsMMOperationData *data;
@@ -386,7 +386,7 @@ calls_mm_call_class_init (CallsMMCallClass *klass)
call_class->get_protocol = calls_mm_call_get_protocol;
call_class->answer = calls_mm_call_answer;
call_class->hang_up = calls_mm_call_hang_up;
- call_class->tone_start = calls_mm_call_tone_start;
+ call_class->send_dtmf_tone = calls_mm_call_send_dtmf_tone;
props[PROP_MM_CALL] = g_param_spec_object ("mm-call",
"MM call",
diff --git a/plugins/ofono/calls-ofono-call.c b/plugins/ofono/calls-ofono-call.c
index 542c8437..64d4fec6 100644
--- a/plugins/ofono/calls-ofono-call.c
+++ b/plugins/ofono/calls-ofono-call.c
@@ -188,7 +188,7 @@ calls_ofono_call_hang_up (CallsCall *call)
static void
-calls_ofono_call_tone_start (CallsCall *call, gchar key)
+calls_ofono_call_send_dtmf_tone (CallsCall *call, gchar key)
{
CallsOfonoCall *self = CALLS_OFONO_CALL (call);
if (self->state != CALLS_CALL_STATE_ACTIVE)
@@ -362,7 +362,7 @@ calls_ofono_call_class_init (CallsOfonoCallClass *klass)
call_class->get_protocol = calls_ofono_call_get_protocol;
call_class->answer = calls_ofono_call_answer;
call_class->hang_up = calls_ofono_call_hang_up;
- call_class->tone_start = calls_ofono_call_tone_start;
+ call_class->send_dtmf_tone = calls_ofono_call_send_dtmf_tone;
props[PROP_VOICE_CALL] =
g_param_spec_object ("voice-call",
diff --git a/src/calls-call.c b/src/calls-call.c
index 035710af..c782f490 100644
--- a/src/calls-call.c
+++ b/src/calls-call.c
@@ -41,8 +41,8 @@
* #CALL_CALL_STATE_INCOMING, the call can be answered with #answer.
* The call can also be hung up at any time with #hang_up.
*
- * DTMF tones can be played the call using #tone_start and
- * #tone_stop. Valid characters for the key are 0-9, '*', '#', 'A',
+ * DTMF tones can be played the call using #send_dtmf
+ * Valid characters for the key are 0-9, '*', '#', 'A',
* 'B', 'C' and 'D'.
*/
@@ -108,19 +108,12 @@ calls_call_real_hang_up (CallsCall *self)
}
static void
-calls_call_real_tone_start (CallsCall *self,
- char key)
+calls_call_real_send_dtmf_tone (CallsCall *self,
+ char key)
{
g_info ("Beep! (%c)", (int)key);
}
-static void
-calls_call_real_tone_stop (CallsCall *self,
- char key)
-{
- g_info ("Beep end (%c)", (int)key);
-}
-
static void
calls_call_get_property (GObject *object,
guint prop_id,
@@ -170,8 +163,7 @@ calls_call_class_init (CallsCallClass *klass)
klass->get_protocol = calls_call_real_get_protocol;
klass->answer = calls_call_real_answer;
klass->hang_up = calls_call_real_hang_up;
- klass->tone_start = calls_call_real_tone_start;
- klass->tone_stop = calls_call_real_tone_stop;
+ klass->send_dtmf_tone = calls_call_real_send_dtmf_tone;
properties[PROP_INBOUND] =
g_param_spec_boolean ("inbound",
@@ -369,67 +361,27 @@ calls_call_can_dtmf (CallsCall *self)
{
g_return_val_if_fail (CALLS_IS_CALL (self), FALSE);
- return CALLS_CALL_GET_CLASS (self)->tone_start != calls_call_real_tone_start;
+ return CALLS_CALL_GET_CLASS (self)->send_dtmf_tone != calls_call_real_send_dtmf_tone;
}
/**
- * calls_call_tone_start:
+ * calls_call_send_dtmf_tone:
* @self: a #CallsCall
* @key: which tone to start
*
- * Start playing a DTMF tone for the specified key. Implementations
+ * Start playing a DTMF tone for the specified key. Implementations
* will stop playing the tone either after an implementation-specific
- * timeout, or after #calls_call_tone_stop is called with the same
- * value for @key.
- *
- */
-void
-calls_call_tone_start (CallsCall *self,
- gchar key)
-{
- g_return_if_fail (CALLS_IS_CALL (self));
- g_return_if_fail (tone_key_is_valid (key));
-
- CALLS_CALL_GET_CLASS (self)->tone_start (self, key);
-}
-
-/**
- * calls_call_tone_stoppable:
- * @self: a #CallsCall
- *
- * Determine whether tones for this call can be stopped by calling
- * #calls_call_tone_stop. Some implementations will only allow
- * fixed-length tones to be played. In that case, this function
- * should return FALSE.
- *
- * Returns: whether calls to #calls_call_tone_stop will do anything
- *
- */
-gboolean
-calls_call_tone_stoppable (CallsCall *self)
-{
- g_return_val_if_fail (CALLS_IS_CALL (self), FALSE);
-
- return CALLS_CALL_GET_CLASS (self)->tone_stop != calls_call_real_tone_stop;
-}
-
-/**
- * calls_call_tone_stop:
- * @self: a #CallsCall
- * @key: which tone to stop
- *
- * Stop playing a DTMF tone previously started with
- * #calls_call_tone_start.
+ * timeout.
*
*/
void
-calls_call_tone_stop (CallsCall *self,
- gchar key)
+calls_call_send_dtmf_tone (CallsCall *self,
+ gchar key)
{
g_return_if_fail (CALLS_IS_CALL (self));
g_return_if_fail (tone_key_is_valid (key));
- CALLS_CALL_GET_CLASS (self)->tone_stop (self, key);
+ CALLS_CALL_GET_CLASS (self)->send_dtmf_tone (self, key);
}
/**
diff --git a/src/calls-call.h b/src/calls-call.h
index a9bb58bf..084ac0ba 100644
--- a/src/calls-call.h
+++ b/src/calls-call.h
@@ -57,9 +57,7 @@ struct _CallsCallClass
const char *(*get_protocol) (CallsCall *self);
void (*answer) (CallsCall *self);
void (*hang_up) (CallsCall *self);
- void (*tone_start) (CallsCall *self,
- char key);
- void (*tone_stop) (CallsCall *self,
+ void (*send_dtmf_tone) (CallsCall *self,
char key);
};
@@ -71,10 +69,7 @@ const char *calls_call_get_protocol (CallsCall *self);
void calls_call_answer (CallsCall *self);
void calls_call_hang_up (CallsCall *self);
gboolean calls_call_can_dtmf (CallsCall *self);
-void calls_call_tone_start (CallsCall *self,
- gchar key);
-gboolean calls_call_tone_stoppable (CallsCall *self);
-void calls_call_tone_stop (CallsCall *self,
+void calls_call_send_dtmf_tone (CallsCall *self,
gchar key);
CallsBestMatch * calls_call_get_contact (CallsCall *self);
diff --git a/src/calls-ui-call-data.c b/src/calls-ui-call-data.c
index 548e4853..bb5c4e81 100644
--- a/src/calls-ui-call-data.c
+++ b/src/calls-ui-call-data.c
@@ -39,16 +39,6 @@ struct DtmfData
char dtmf;
};
-
-static gboolean
-on_stop_dtmf (struct DtmfData *dtmf_data)
-{
- calls_call_tone_stop (dtmf_data->call, dtmf_data->dtmf);
-
- g_free (dtmf_data);
- return G_SOURCE_REMOVE;
-}
-
static const char *
calls_ui_call_data_get_display_name (CuiCall *call_data)
{
@@ -173,14 +163,7 @@ calls_ui_call_data_send_dtmf (CuiCall *call_data,
g_return_if_fail (CALLS_IS_UI_CALL_DATA (self));
g_return_if_fail (!!self->call);
- calls_call_tone_start (self->call, *dtmf);
- if (calls_call_tone_stoppable (self->call)) {
- struct DtmfData *dtmf_data = g_new0 (struct DtmfData, 1);
- dtmf_data->call = self->call;
- dtmf_data->dtmf = *dtmf;
-
- g_timeout_add (250, G_SOURCE_FUNC (on_stop_dtmf), dtmf_data);
- }
+ calls_call_send_dtmf_tone (self->call, *dtmf);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]