From a048b4c83db9ad39a83c5ee7ba7cbc52ccf70645 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 10 Dec 2021 09:02:39 +0100 Subject: [PATCH] call: Move state property into base class This let's us get rid of a lot of duplication in the derived classes. Additionally we set the initial state to CALLS_CALL_STATE_INCOMING if inbound is TRUE and CALLS_CALL_STATE_DIALING otherwise. --- plugins/dummy/calls-dummy-call.c | 62 +++++++------------------------- plugins/mm/calls-mm-call.c | 32 +---------------- plugins/ofono/calls-ofono-call.c | 39 ++++---------------- plugins/sip/calls-sip-call.c | 56 ++++------------------------- plugins/sip/calls-sip-origin.c | 2 +- src/calls-call.c | 55 +++++++++++++++++++++++----- src/calls-call.h | 29 +++++++-------- tests/mock-call.c | 52 +++------------------------ tests/mock-call.h | 2 -- tests/test-ringer.c | 14 ++++---- 10 files changed, 100 insertions(+), 243 deletions(-) diff --git a/plugins/dummy/calls-dummy-call.c b/plugins/dummy/calls-dummy-call.c index 766083b..8d0474f 100644 --- a/plugins/dummy/calls-dummy-call.c +++ b/plugins/dummy/calls-dummy-call.c @@ -33,7 +33,6 @@ struct _CallsDummyCall { GObject parent_instance; gchar *id; - CallsCallState state; }; static void calls_dummy_call_message_source_interface_init (CallsMessageSourceInterface *iface); @@ -49,25 +48,6 @@ enum { }; static GParamSpec *props[PROP_LAST_PROP]; -static void -change_state (CallsDummyCall *self, - CallsCallState state) -{ - CallsCallState old_state = self->state; - - if (old_state == state) - { - return; - } - - self->state = state; - g_object_notify (G_OBJECT (self), "state"); - g_signal_emit_by_name (CALLS_CALL (self), - "state-changed", - state, - old_state); -} - static const char * calls_dummy_call_get_id (CallsCall *call) { @@ -76,14 +56,6 @@ calls_dummy_call_get_id (CallsCall *call) return self->id; } -static CallsCallState -calls_dummy_call_get_state (CallsCall *call) -{ - CallsDummyCall *self = CALLS_DUMMY_CALL (call); - - return self->state; -} - static const char* calls_dummy_call_get_protocol (CallsCall *call) { @@ -93,25 +65,18 @@ calls_dummy_call_get_protocol (CallsCall *call) static void calls_dummy_call_answer (CallsCall *call) { - CallsDummyCall *self; - g_return_if_fail (CALLS_IS_DUMMY_CALL (call)); - self = CALLS_DUMMY_CALL (call); + g_return_if_fail (calls_call_get_state (call) == CALLS_CALL_STATE_INCOMING); - g_return_if_fail (self->state == CALLS_CALL_STATE_INCOMING); - - change_state (self, CALLS_CALL_STATE_ACTIVE); + calls_call_set_state (call, CALLS_CALL_STATE_ACTIVE); } static void calls_dummy_call_hang_up (CallsCall *call) { - CallsDummyCall *self; - g_return_if_fail (CALLS_IS_DUMMY_CALL (call)); - self = CALLS_DUMMY_CALL (call); - change_state (self, CALLS_CALL_STATE_DISCONNECTED); + calls_call_set_state (call, CALLS_CALL_STATE_DISCONNECTED); } static void @@ -124,17 +89,21 @@ calls_dummy_call_send_dtmf_tone (CallsCall *call, static gboolean outbound_timeout_cb (CallsDummyCall *self) { - switch (self->state) { + CallsCall *call; + + g_assert (CALLS_IS_DUMMY_CALL (self)); + + call = CALLS_CALL (self); + + switch (calls_call_get_state (call)) { case CALLS_CALL_STATE_DIALING: - change_state (self, - CALLS_CALL_STATE_ALERTING); + calls_call_set_state (call, CALLS_CALL_STATE_ALERTING); g_timeout_add_seconds (3, (GSourceFunc)outbound_timeout_cb, self); break; case CALLS_CALL_STATE_ALERTING: - change_state (self, - CALLS_CALL_STATE_ACTIVE); + calls_call_set_state (call, CALLS_CALL_STATE_ACTIVE); break; default: @@ -183,12 +152,8 @@ constructed (GObject *object) { CallsDummyCall *self = CALLS_DUMMY_CALL (object); - if (calls_call_get_inbound (CALLS_CALL (object))) { - self->state = CALLS_CALL_STATE_INCOMING; - } else { - self->state = CALLS_CALL_STATE_DIALING; + if (!calls_call_get_inbound (CALLS_CALL (object))) g_timeout_add_seconds (1, (GSourceFunc)outbound_timeout_cb, self); - } G_OBJECT_CLASS (calls_dummy_call_parent_class)->constructed (object); } @@ -215,7 +180,6 @@ calls_dummy_call_class_init (CallsDummyCallClass *klass) object_class->finalize = finalize; call_class->get_id = calls_dummy_call_get_id; - call_class->get_state = calls_dummy_call_get_state; call_class->get_protocol = calls_dummy_call_get_protocol; call_class->answer = calls_dummy_call_answer; call_class->hang_up = calls_dummy_call_hang_up; diff --git a/plugins/mm/calls-mm-call.c b/plugins/mm/calls-mm-call.c index c54f238..c84c6eb 100644 --- a/plugins/mm/calls-mm-call.c +++ b/plugins/mm/calls-mm-call.c @@ -38,7 +38,6 @@ struct _CallsMMCall GObject parent_instance; MMCall *mm_call; GString *id; - CallsCallState state; gchar *disconnect_reason; }; @@ -55,26 +54,6 @@ enum { }; static GParamSpec *props[PROP_LAST_PROP]; -static void -change_state (CallsMMCall *self, - CallsCallState state) -{ - CallsCallState old_state = self->state; - - if (old_state == state) - { - return; - } - - self->state = state; - g_object_notify (G_OBJECT (self), "state"); - g_signal_emit_by_name (CALLS_CALL (self), - "state-changed", - state, - old_state); -} - - static void notify_id_cb (CallsMMCall *self, const gchar *id) @@ -185,7 +164,7 @@ state_changed_cb (CallsMMCall *self, { g_debug ("MM call state changed to `%s'", map_row->name); - change_state (self, map_row->calls); + calls_call_set_state (CALLS_CALL (self), map_row->calls); return; } } @@ -199,14 +178,6 @@ calls_mm_call_get_id (CallsCall *call) return self->id->str; } -static CallsCallState -calls_mm_call_get_state (CallsCall *call) -{ - CallsMMCall *self = CALLS_MM_CALL (call); - - return self->state; -} - static const char * calls_mm_call_get_protocol (CallsCall *self) @@ -369,7 +340,6 @@ calls_mm_call_class_init (CallsMMCallClass *klass) object_class->finalize = finalize; call_class->get_id = calls_mm_call_get_id; - call_class->get_state = calls_mm_call_get_state; 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; diff --git a/plugins/ofono/calls-ofono-call.c b/plugins/ofono/calls-ofono-call.c index a310bf0..b51863b 100644 --- a/plugins/ofono/calls-ofono-call.c +++ b/plugins/ofono/calls-ofono-call.c @@ -37,7 +37,6 @@ struct _CallsOfonoCall GDBOVoiceCall *voice_call; gchar *id; gchar *name; - CallsCallState state; gchar *disconnect_reason; }; @@ -61,25 +60,6 @@ enum { }; static guint signals [SIGNAL_LAST_SIGNAL]; -static void -change_state (CallsOfonoCall *self, - CallsCallState state) -{ - CallsCallState old_state = self->state; - - if (old_state == state) - { - return; - } - - self->state = state; - g_object_notify (G_OBJECT (self), "state"); - g_signal_emit_by_name (CALLS_CALL (self), - "state-changed", - state, - old_state); -} - static const char * calls_ofono_call_get_id (CallsCall *call) { @@ -96,14 +76,6 @@ calls_ofono_call_get_name (CallsCall *call) return self->name; } -static CallsCallState -calls_ofono_call_get_state (CallsCall *call) -{ - CallsOfonoCall *self = CALLS_OFONO_CALL (call); - - return self->state; -} - static const char * calls_ofono_call_get_protocol (CallsCall *call) { @@ -178,7 +150,7 @@ static void calls_ofono_call_send_dtmf_tone (CallsCall *call, gchar key) { CallsOfonoCall *self = CALLS_OFONO_CALL (call); - if (self->state != CALLS_CALL_STATE_ACTIVE) { + if (calls_call_get_state (call) != CALLS_CALL_STATE_ACTIVE) { g_warning ("Tone start requested for non-active call to `%s'", self->id); return; @@ -192,6 +164,7 @@ static void set_properties (CallsOfonoCall *self, GVariant *call_props) { + CallsCallState state; const gchar *str = NULL; g_return_if_fail (call_props != NULL); @@ -201,7 +174,8 @@ set_properties (CallsOfonoCall *self, g_variant_lookup (call_props, "State", "&s", &str); g_return_if_fail (str != NULL); - calls_call_state_parse_nick (&self->state, str); + if (calls_call_state_parse_nick (&state, str)) + calls_call_set_state (CALLS_CALL (self), state); } @@ -252,7 +226,7 @@ property_changed_cb (CallsOfonoCall *self, ok = calls_call_state_parse_nick (&state, str); if (ok) - change_state (self, state); + calls_call_set_state (CALLS_CALL (self), state); else g_warning ("Could not parse new state `%s'" " of oFono call to `%s'", @@ -329,7 +303,6 @@ calls_ofono_call_class_init (CallsOfonoCallClass *klass) call_class->get_id = calls_ofono_call_get_id; call_class->get_name = calls_ofono_call_get_name; - call_class->get_state = calls_ofono_call_get_state; 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; @@ -407,7 +380,7 @@ calls_ofono_call_new (GDBOVoiceCall *voice_call, //"id", id, //"name", name, "inbound", inbound, - //"state", state, + "state", state, NULL); } diff --git a/plugins/sip/calls-sip-call.c b/plugins/sip/calls-sip-call.c index 63381b2..4634215 100644 --- a/plugins/sip/calls-sip-call.c +++ b/plugins/sip/calls-sip-call.c @@ -58,7 +58,6 @@ struct _CallsSipCall { GObject parent_instance; gchar *id; - CallsCallState state; CallsSipMediaManager *manager; CallsSipMediaPipeline *pipeline; @@ -125,15 +124,6 @@ calls_sip_call_get_id (CallsCall *call) } -static CallsCallState -calls_sip_call_get_state (CallsCall *call) -{ - CallsSipCall *self = CALLS_SIP_CALL (call); - - return self->state; -} - - static const char * calls_sip_call_get_protocol (CallsCall *call) { @@ -157,7 +147,7 @@ calls_sip_call_answer (CallsCall *call) g_assert (self->nh); - if (self->state != CALLS_CALL_STATE_INCOMING) { + if (calls_call_get_state (CALLS_CALL (self)) != CALLS_CALL_STATE_INCOMING) { g_warning ("Call must be in 'incoming' state in order to answer"); return; } @@ -178,7 +168,7 @@ calls_sip_call_answer (CallsCall *call) SOATAG_AF (SOA_AF_IP4_IP6), TAG_END ()); - calls_sip_call_set_state (self, CALLS_CALL_STATE_ACTIVE); + calls_call_set_state (CALLS_CALL (self), CALLS_CALL_STATE_ACTIVE); } @@ -192,7 +182,7 @@ calls_sip_call_hang_up (CallsCall *call) self = CALLS_SIP_CALL (call); - switch (self->state) { + switch (calls_call_get_state (call)) { case CALLS_CALL_STATE_DIALING: nua_cancel (self->nh, TAG_END ()); g_debug ("Hanging up on outgoing ringing call"); @@ -214,7 +204,8 @@ calls_sip_call_hang_up (CallsCall *call) break; default: - g_warning ("Hanging up not possible in state %d", self->state); + g_warning ("Hanging up not possible in state %d", + calls_call_get_state (call)); } } @@ -288,7 +279,6 @@ calls_sip_call_class_init (CallsSipCallClass *klass) object_class->finalize = calls_sip_call_finalize; call_class->get_id = calls_sip_call_get_id; - call_class->get_state = calls_sip_call_get_state; call_class->get_protocol = calls_sip_call_get_protocol; call_class->answer = calls_sip_call_answer; call_class->hang_up = calls_sip_call_hang_up; @@ -394,48 +384,14 @@ calls_sip_call_new (const gchar *id, call = g_object_new (CALLS_TYPE_SIP_CALL, "nua-handle", handle, "inbound", inbound, + "state", inbound ? CALLS_CALL_STATE_INCOMING : CALLS_CALL_STATE_DIALING, NULL); call->id = g_strdup (id); - if (inbound) - call->state = CALLS_CALL_STATE_INCOMING; - else - call->state = CALLS_CALL_STATE_DIALING; - return call; } -/** - * calls_sip_call_set_state: - * @self: A #CallsSipCall - * @state: The new #CallsCallState to set - * - * Sets the new call state and emits the state-changed signal - */ -void -calls_sip_call_set_state (CallsSipCall *self, - CallsCallState state) -{ - CallsCallState old_state; - - g_return_if_fail (CALLS_IS_CALL (self)); - g_return_if_fail (CALLS_IS_SIP_CALL (self)); - - old_state = self->state; - - if (old_state == state) { - return; - } - - self->state = state; - g_object_notify (G_OBJECT (self), "state"); - g_signal_emit_by_name (CALLS_CALL (self), - "state-changed", - state, - old_state); -} - /** * calls_sip_call_set_codecs: * @self: A #CallsSipCall diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c index e315bf8..7ae8827 100644 --- a/plugins/sip/calls-sip-origin.c +++ b/plugins/sip/calls-sip-origin.c @@ -575,7 +575,7 @@ sip_i_state (int status, return; } - calls_sip_call_set_state (call, state); + calls_call_set_state (CALLS_CALL (call), state); } diff --git a/src/calls-call.c b/src/calls-call.c index b3173b2..fdc62c0 100644 --- a/src/calls-call.c +++ b/src/calls-call.c @@ -67,6 +67,7 @@ static GParamSpec *properties[N_PROPS]; static guint signals[N_SIGNALS]; typedef struct { + CallsCallState state; gboolean inbound; gboolean silenced; } CallsCallPrivate; @@ -86,12 +87,6 @@ calls_call_real_get_name (CallsCall *self) return NULL; } -static CallsCallState -calls_call_real_get_state (CallsCall *self) -{ - return 0; -} - static const char * calls_call_real_get_protocol (CallsCall *self) { @@ -127,6 +122,14 @@ calls_call_set_property (GObject *object, switch (prop_id) { case PROP_INBOUND: priv->inbound = g_value_get_boolean (value); + if (priv->inbound) + calls_call_set_state (self, CALLS_CALL_STATE_INCOMING); + else + calls_call_set_state (self, CALLS_CALL_STATE_DIALING); + break; + + case PROP_STATE: + calls_call_set_state (self, g_value_get_enum (value)); break; default: @@ -183,7 +186,6 @@ calls_call_class_init (CallsCallClass *klass) klass->get_id = calls_call_real_get_id; klass->get_name = calls_call_real_get_name; - klass->get_state = calls_call_real_get_state; klass->get_protocol = calls_call_real_get_protocol; klass->answer = calls_call_real_answer; klass->hang_up = calls_call_real_hang_up; @@ -216,7 +218,9 @@ calls_call_class_init (CallsCallClass *klass) "The current state of the call", CALLS_TYPE_CALL_STATE, CALLS_CALL_STATE_UNKNOWN, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | + G_PARAM_EXPLICIT_NOTIFY | + G_PARAM_STATIC_STRINGS); properties[PROP_PROTOCOL] = g_param_spec_string ("protocol", @@ -303,9 +307,42 @@ calls_call_get_name (CallsCall *self) CallsCallState calls_call_get_state (CallsCall *self) { + CallsCallPrivate *priv = calls_call_get_instance_private (self); + g_return_val_if_fail (CALLS_IS_CALL (self), 0); - return CALLS_CALL_GET_CLASS (self)->get_state (self); + return priv->state; +} + +/** + * calls_call_set_state: + * @self: a #CallsCall + * @state: a #CallsCallState + * + * Set the current state of the call. + */ +void +calls_call_set_state (CallsCall *self, + CallsCallState state) +{ + CallsCallPrivate *priv = calls_call_get_instance_private (self); + CallsCallState old_state; + + g_return_if_fail (CALLS_IS_CALL (self)); + + old_state = priv->state; + + if (old_state == state) { + return; + } + + priv->state = state; + + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_STATE]); + g_signal_emit_by_name (CALLS_CALL (self), + "state-changed", + state, + old_state); } /** diff --git a/src/calls-call.h b/src/calls-call.h index bedb703..f69854a 100644 --- a/src/calls-call.h +++ b/src/calls-call.h @@ -53,7 +53,6 @@ struct _CallsCallClass const char *(*get_id) (CallsCall *self); const char *(*get_name) (CallsCall *self); - CallsCallState (*get_state) (CallsCall *self); const char *(*get_protocol) (CallsCall *self); void (*answer) (CallsCall *self); void (*hang_up) (CallsCall *self); @@ -61,19 +60,21 @@ struct _CallsCallClass char key); }; -const char *calls_call_get_id (CallsCall *self); -const char *calls_call_get_name (CallsCall *self); -CallsCallState calls_call_get_state (CallsCall *self); -gboolean calls_call_get_inbound (CallsCall *self); -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_send_dtmf_tone (CallsCall *self, - char key); -CallsBestMatch *calls_call_get_contact (CallsCall *self); -void calls_call_silence_ring (CallsCall *self); -gboolean calls_call_get_silenced (CallsCall *self); +const char *calls_call_get_id (CallsCall *self); +const char *calls_call_get_name (CallsCall *self); +CallsCallState calls_call_get_state (CallsCall *self); +void calls_call_set_state (CallsCall *self, + CallsCallState state); +gboolean calls_call_get_inbound (CallsCall *self); +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_send_dtmf_tone (CallsCall *self, + char key); +CallsBestMatch *calls_call_get_contact (CallsCall *self); +void calls_call_silence_ring (CallsCall *self); +gboolean calls_call_get_silenced (CallsCall *self); void calls_call_state_to_string (GString *string, CallsCallState state); diff --git a/tests/mock-call.c b/tests/mock-call.c index 62c9d1e..458ca8e 100644 --- a/tests/mock-call.c +++ b/tests/mock-call.c @@ -15,7 +15,6 @@ enum { PROP_0, PROP_NAME, PROP_ID, - PROP_STATE, PROP_LAST_PROP, }; static GParamSpec *props[PROP_LAST_PROP]; @@ -26,7 +25,6 @@ struct _CallsMockCall char *id; char *display_name; - CallsCallState state; }; G_DEFINE_TYPE (CallsMockCall, calls_mock_call, CALLS_TYPE_CALL) @@ -38,7 +36,7 @@ calls_mock_call_answer (CallsCall *call) g_assert (CALLS_IS_MOCK_CALL (call)); g_assert_cmpint (calls_call_get_state (call), ==, CALLS_CALL_STATE_INCOMING); - calls_mock_call_set_state (CALLS_MOCK_CALL (call), CALLS_CALL_STATE_ACTIVE); + calls_call_set_state (call, CALLS_CALL_STATE_ACTIVE); } @@ -48,18 +46,10 @@ calls_mock_call_hang_up (CallsCall *call) g_assert (CALLS_IS_MOCK_CALL (call)); g_assert_cmpint (calls_call_get_state (call), !=, CALLS_CALL_STATE_DISCONNECTED); - calls_mock_call_set_state (CALLS_MOCK_CALL (call), CALLS_CALL_STATE_DISCONNECTED); + calls_call_set_state (call, CALLS_CALL_STATE_DISCONNECTED); } -static CallsCallState -calls_mock_call_get_state (CallsCall *call) -{ - g_assert (CALLS_IS_MOCK_CALL (call)); - - return CALLS_MOCK_CALL (call)->state; -} - static void calls_mock_call_get_property (GObject *object, guint prop_id, @@ -75,9 +65,6 @@ calls_mock_call_get_property (GObject *object, case PROP_NAME: g_value_set_string (value, self->display_name); break; - case PROP_STATE: - g_value_set_enum (value, self->state); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -104,7 +91,6 @@ calls_mock_call_class_init (CallsMockCallClass *klass) call_class->answer = calls_mock_call_answer; call_class->hang_up = calls_mock_call_hang_up; - call_class->get_state = calls_mock_call_get_state; object_class->get_property = calls_mock_call_get_property; object_class->finalize = calls_mock_call_finalize; @@ -118,12 +104,6 @@ calls_mock_call_class_init (CallsMockCallClass *klass) PROP_NAME, "name"); props[PROP_NAME] = g_object_class_find_property (object_class, "name"); - - g_object_class_override_property (object_class, - PROP_STATE, - "state"); - props[PROP_STATE] = g_object_class_find_property (object_class, "state"); - } @@ -132,14 +112,15 @@ calls_mock_call_init (CallsMockCall *self) { self->display_name = g_strdup ("John Doe"); self->id = g_strdup ("0800 1234"); - self->state = CALLS_CALL_STATE_INCOMING; } CallsMockCall * calls_mock_call_new (void) { - return g_object_new (CALLS_TYPE_MOCK_CALL, NULL); + return g_object_new (CALLS_TYPE_MOCK_CALL, + "inbound", TRUE, + NULL); } @@ -167,26 +148,3 @@ calls_mock_call_set_name (CallsMockCall *self, g_object_notify_by_pspec (G_OBJECT (self), props[PROP_NAME]); } - - -void -calls_mock_call_set_state (CallsMockCall *self, - CallsCallState state) -{ - CallsCallState old_state; - - g_return_if_fail (CALLS_IS_MOCK_CALL (self)); - - old_state = self->state; - if (old_state == state) - return; - - self->state = state; - - g_object_notify_by_pspec (G_OBJECT (self), props[PROP_STATE]); - g_signal_emit_by_name (CALLS_CALL (self), - "state-changed", - state, - old_state); -} - diff --git a/tests/mock-call.h b/tests/mock-call.h index ec313c2..2afe81c 100644 --- a/tests/mock-call.h +++ b/tests/mock-call.h @@ -22,7 +22,5 @@ void calls_mock_call_set_id (CallsMockCall *self, const char *id); void calls_mock_call_set_name (CallsMockCall *self, const char *name); -void calls_mock_call_set_state (CallsMockCall *self, - CallsCallState state); G_END_DECLS diff --git a/tests/test-ringer.c b/tests/test-ringer.c index 14bf017..4edc5a3 100644 --- a/tests/test-ringer.c +++ b/tests/test-ringer.c @@ -251,7 +251,7 @@ test_ringing_accept_call (void **state) /* delay before completion of __wrap_lfb_event_end_feedback_async() */ will_return (__wrap_lfb_event_end_feedback_async, 10); - calls_mock_call_set_state (data->call_one, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_one); /* main loop will quit in callback of notify::ring */ @@ -302,7 +302,7 @@ test_ringing_hang_up_call (void **state) /* delay before completion of __wrap_lfb_event_end_feedback_async() */ will_return (__wrap_lfb_event_end_feedback_async, 10); - calls_mock_call_set_state (data->call_one, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_one); /* main loop will quit in callback of notify::ring */ @@ -346,7 +346,7 @@ test_ringing_hang_up_call_ringer_cancelled (void **state) /* delay before completion of __wrap_lfb_event_trigger_feedback_async() */ will_return (__wrap_lfb_event_trigger_feedback_async, 50); - calls_mock_call_set_state (data->call_one, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_one); g_timeout_add (10, G_SOURCE_FUNC (t3_on_ringer_timeout), data); @@ -400,7 +400,7 @@ test_ringing_silence_call (void **state) /* delay before completion of __wrap_lfb_event_end_feedback_async() */ will_return (__wrap_lfb_event_end_feedback_async, 10); - calls_mock_call_set_state (data->call_one, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_one); /* main loop will quit in callback of notify::ring */ @@ -472,7 +472,7 @@ test_ringing_multiple_calls (void **state) /* delay before completion of __wrap_lfb_event_end_feedback_async() */ will_return (__wrap_lfb_event_end_feedback_async, 10); - calls_mock_call_set_state (data->call_one, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_one); /* main loop will quit in callback of notify::ring */ @@ -537,9 +537,9 @@ test_ringing_multiple_calls_with_restart (void **state) /* delay before completion of __wrap_lfb_event_end_feedback_async() */ will_return_always (__wrap_lfb_event_end_feedback_async, 10); - calls_mock_call_set_state (data->call_one, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_one), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_one); - calls_mock_call_set_state (data->call_two, CALLS_CALL_STATE_INCOMING); + calls_call_set_state (CALLS_CALL (data->call_two), CALLS_CALL_STATE_INCOMING); add_call (data->manager, data->call_two); /* main loop will quit in callback of notify::ring */