[calls] ringer: Take ui-active property into account
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] ringer: Take ui-active property into account
- Date: Thu, 3 Feb 2022 17:54:04 +0000 (UTC)
commit 93cf894a8c2e812f7c4430ed87f7b38897b93769
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Tue Feb 1 08:25:14 2022 +0100
ringer: Take ui-active property into account
Only start ringing once the UI is deemed active, i.e. the "pre-ring" phase has
passed.
Fixes #371
src/calls-ringer.c | 17 ++++++++---------
tests/test-ringer.c | 5 ++++-
2 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/calls-ringer.c b/src/calls-ringer.c
index a6255e9b..7978601c 100644
--- a/src/calls-ringer.c
+++ b/src/calls-ringer.c
@@ -340,7 +340,8 @@ has_incoming_call (CallsRinger *self)
CallsUiCallData *call = node->data;
if (is_ring_state (cui_call_get_state (CUI_CALL (call))) &&
- !calls_ui_call_data_get_silenced (call))
+ !calls_ui_call_data_get_silenced (call) &&
+ calls_ui_call_data_get_ui_active (call))
return TRUE;
}
return FALSE;
@@ -373,14 +374,12 @@ call_added_cb (CallsRinger *self,
self->calls = g_list_append (self->calls, call);
- g_signal_connect_swapped (call,
- "notify::state",
- G_CALLBACK (update_ring),
- self);
- g_signal_connect_swapped (call,
- "notify::silenced",
- G_CALLBACK (update_ring),
- self);
+ g_object_connect (call,
+ "swapped-signal::notify::state", G_CALLBACK (update_ring), self,
+ "swapped-signal::notify::silenced", G_CALLBACK (update_ring), self,
+ "swapped-signal::notify::ui-active", G_CALLBACK (update_ring), self,
+ NULL);
+
update_ring (self);
}
diff --git a/tests/test-ringer.c b/tests/test-ringer.c
index 6f89eef6..992fcf5a 100644
--- a/tests/test-ringer.c
+++ b/tests/test-ringer.c
@@ -356,7 +356,10 @@ test_ringing_hang_up_call_ringer_cancelled (void **state)
calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING);
add_call (data->manager, data->ui_call_one);
- g_timeout_add (10, G_SOURCE_FUNC (t3_on_ringer_timeout), data);
+ /** this timeout needs to be longer than the delay for activating the UI/ringer,
+ * see DELAY_UI_MS in calls-ui-call-data.c
+ */
+ g_timeout_add (20, G_SOURCE_FUNC (t3_on_ringer_timeout), data);
/* main loop will quit in t3_on_ringer_timeout() */
g_main_loop_run (data->loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]