mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 20:35:31 +00:00
call: Get rid of tone_stop
It wasn't used by any plugin backend and helps getting rid of a lot of code.
This commit is contained in:
parent
748f9c937c
commit
a353a03d01
5 changed files with 19 additions and 89 deletions
|
@ -275,7 +275,7 @@ DEFINE_OPERATION(start, calls_mm_call_start_call, "starting outgoing call");
|
||||||
|
|
||||||
|
|
||||||
static void
|
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);
|
CallsMMCall *self = CALLS_MM_CALL (call);
|
||||||
struct CallsMMOperationData *data;
|
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->get_protocol = calls_mm_call_get_protocol;
|
||||||
call_class->answer = calls_mm_call_answer;
|
call_class->answer = calls_mm_call_answer;
|
||||||
call_class->hang_up = calls_mm_call_hang_up;
|
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",
|
props[PROP_MM_CALL] = g_param_spec_object ("mm-call",
|
||||||
"MM call",
|
"MM call",
|
||||||
|
|
|
@ -188,7 +188,7 @@ calls_ofono_call_hang_up (CallsCall *call)
|
||||||
|
|
||||||
|
|
||||||
static void
|
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);
|
CallsOfonoCall *self = CALLS_OFONO_CALL (call);
|
||||||
if (self->state != CALLS_CALL_STATE_ACTIVE)
|
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->get_protocol = calls_ofono_call_get_protocol;
|
||||||
call_class->answer = calls_ofono_call_answer;
|
call_class->answer = calls_ofono_call_answer;
|
||||||
call_class->hang_up = calls_ofono_call_hang_up;
|
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] =
|
props[PROP_VOICE_CALL] =
|
||||||
g_param_spec_object ("voice-call",
|
g_param_spec_object ("voice-call",
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
* #CALL_CALL_STATE_INCOMING, the call can be answered with #answer.
|
* #CALL_CALL_STATE_INCOMING, the call can be answered with #answer.
|
||||||
* The call can also be hung up at any time with #hang_up.
|
* The call can also be hung up at any time with #hang_up.
|
||||||
*
|
*
|
||||||
* DTMF tones can be played the call using #tone_start and
|
* DTMF tones can be played the call using #send_dtmf
|
||||||
* #tone_stop. Valid characters for the key are 0-9, '*', '#', 'A',
|
* Valid characters for the key are 0-9, '*', '#', 'A',
|
||||||
* 'B', 'C' and 'D'.
|
* 'B', 'C' and 'D'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -108,19 +108,12 @@ calls_call_real_hang_up (CallsCall *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
calls_call_real_tone_start (CallsCall *self,
|
calls_call_real_send_dtmf_tone (CallsCall *self,
|
||||||
char key)
|
char key)
|
||||||
{
|
{
|
||||||
g_info ("Beep! (%c)", (int)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
|
static void
|
||||||
calls_call_get_property (GObject *object,
|
calls_call_get_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
|
@ -170,8 +163,7 @@ calls_call_class_init (CallsCallClass *klass)
|
||||||
klass->get_protocol = calls_call_real_get_protocol;
|
klass->get_protocol = calls_call_real_get_protocol;
|
||||||
klass->answer = calls_call_real_answer;
|
klass->answer = calls_call_real_answer;
|
||||||
klass->hang_up = calls_call_real_hang_up;
|
klass->hang_up = calls_call_real_hang_up;
|
||||||
klass->tone_start = calls_call_real_tone_start;
|
klass->send_dtmf_tone = calls_call_real_send_dtmf_tone;
|
||||||
klass->tone_stop = calls_call_real_tone_stop;
|
|
||||||
|
|
||||||
properties[PROP_INBOUND] =
|
properties[PROP_INBOUND] =
|
||||||
g_param_spec_boolean ("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);
|
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
|
* @self: a #CallsCall
|
||||||
* @key: which tone to start
|
* @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
|
* will stop playing the tone either after an implementation-specific
|
||||||
* timeout, or after #calls_call_tone_stop is called with the same
|
* timeout.
|
||||||
* value for @key.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
calls_call_tone_start (CallsCall *self,
|
calls_call_send_dtmf_tone (CallsCall *self,
|
||||||
gchar key)
|
gchar key)
|
||||||
{
|
{
|
||||||
g_return_if_fail (CALLS_IS_CALL (self));
|
g_return_if_fail (CALLS_IS_CALL (self));
|
||||||
g_return_if_fail (tone_key_is_valid (key));
|
g_return_if_fail (tone_key_is_valid (key));
|
||||||
|
|
||||||
CALLS_CALL_GET_CLASS (self)->tone_start (self, key);
|
CALLS_CALL_GET_CLASS (self)->send_dtmf_tone (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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
calls_call_tone_stop (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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,9 +57,7 @@ struct _CallsCallClass
|
||||||
const char *(*get_protocol) (CallsCall *self);
|
const char *(*get_protocol) (CallsCall *self);
|
||||||
void (*answer) (CallsCall *self);
|
void (*answer) (CallsCall *self);
|
||||||
void (*hang_up) (CallsCall *self);
|
void (*hang_up) (CallsCall *self);
|
||||||
void (*tone_start) (CallsCall *self,
|
void (*send_dtmf_tone) (CallsCall *self,
|
||||||
char key);
|
|
||||||
void (*tone_stop) (CallsCall *self,
|
|
||||||
char key);
|
char key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,10 +69,7 @@ const char *calls_call_get_protocol (CallsCall *self);
|
||||||
void calls_call_answer (CallsCall *self);
|
void calls_call_answer (CallsCall *self);
|
||||||
void calls_call_hang_up (CallsCall *self);
|
void calls_call_hang_up (CallsCall *self);
|
||||||
gboolean calls_call_can_dtmf (CallsCall *self);
|
gboolean calls_call_can_dtmf (CallsCall *self);
|
||||||
void calls_call_tone_start (CallsCall *self,
|
void calls_call_send_dtmf_tone (CallsCall *self,
|
||||||
gchar key);
|
|
||||||
gboolean calls_call_tone_stoppable (CallsCall *self);
|
|
||||||
void calls_call_tone_stop (CallsCall *self,
|
|
||||||
gchar key);
|
gchar key);
|
||||||
CallsBestMatch * calls_call_get_contact (CallsCall *self);
|
CallsBestMatch * calls_call_get_contact (CallsCall *self);
|
||||||
|
|
||||||
|
|
|
@ -39,16 +39,6 @@ struct DtmfData
|
||||||
char dtmf;
|
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 *
|
static const char *
|
||||||
calls_ui_call_data_get_display_name (CuiCall *call_data)
|
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 (CALLS_IS_UI_CALL_DATA (self));
|
||||||
g_return_if_fail (!!self->call);
|
g_return_if_fail (!!self->call);
|
||||||
|
|
||||||
calls_call_tone_start (self->call, *dtmf);
|
calls_call_send_dtmf_tone (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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue