base-call: minor coding style fixes

This commit is contained in:
Aleksander Morgado
2017-07-06 11:11:20 +02:00
parent 4e5ad5585a
commit da45d0c5b2

View File

@@ -79,9 +79,9 @@ handle_start_ready (MMBaseCall *self,
{ {
GError *error = NULL; GError *error = NULL;
if (!MM_BASE_CALL_GET_CLASS (self)->start_finish (self, res, &error)) { if (!MM_BASE_CALL_GET_CLASS (self)->start_finish (self, res, &error))
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
} else { else {
/* Transition from Unknown->Dialing */ /* Transition from Unknown->Dialing */
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_UNKNOWN ) { if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_UNKNOWN ) {
/* Update state */ /* Update state */
@@ -181,9 +181,9 @@ handle_accept_ready (MMBaseCall *self,
{ {
GError *error = NULL; GError *error = NULL;
if (!MM_BASE_CALL_GET_CLASS (self)->accept_finish (self, res, &error)) { if (!MM_BASE_CALL_GET_CLASS (self)->accept_finish (self, res, &error))
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
} else { else {
/* Transition from Unknown->Dialing */ /* Transition from Unknown->Dialing */
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_RINGING_IN) { if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) == MM_CALL_STATE_RINGING_IN) {
/* Update state */ /* Update state */
@@ -284,9 +284,9 @@ handle_hangup_ready (MMBaseCall *self,
{ {
GError *error = NULL; GError *error = NULL;
if (!MM_BASE_CALL_GET_CLASS (self)->hangup_finish (self, res, &error)) { if (!MM_BASE_CALL_GET_CLASS (self)->hangup_finish (self, res, &error))
g_dbus_method_invocation_take_error (ctx->invocation, error); g_dbus_method_invocation_take_error (ctx->invocation, error);
} else { else {
/* Transition from Unknown->Dialing */ /* Transition from Unknown->Dialing */
if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_TERMINATED || if (mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_TERMINATED ||
mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_UNKNOWN) { mm_gdbus_call_get_state (MM_GDBUS_CALL (ctx->self)) != MM_CALL_STATE_UNKNOWN) {
@@ -512,7 +512,6 @@ call_dbus_export (MMBaseCall *self)
G_CALLBACK (handle_send_dtmf), G_CALLBACK (handle_send_dtmf),
NULL); NULL);
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self), if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self),
self->priv->connection, self->priv->connection,
self->priv->path, self->priv->path,
@@ -541,9 +540,13 @@ mm_base_call_get_path (MMBaseCall *self)
} }
void void
mm_base_call_change_state(MMBaseCall *self, MMCallState new_state, MMCallStateReason reason) mm_base_call_change_state (MMBaseCall *self,
MMCallState new_state,
MMCallStateReason reason)
{ {
int old_state = mm_gdbus_call_get_state (MM_GDBUS_CALL (self)); int old_state;
old_state = mm_gdbus_call_get_state (MM_GDBUS_CALL (self));
g_object_set (self, g_object_set (self,
"state", new_state, "state", new_state,
@@ -559,7 +562,9 @@ mm_base_call_change_state(MMBaseCall *self, MMCallState new_state, MMCallStateRe
reason); reason);
} }
void mm_base_call_received_dtmf (MMBaseCall *self, gchar *dtmf) void
mm_base_call_received_dtmf (MMBaseCall *self,
gchar *dtmf)
{ {
mm_gdbus_call_emit_dtmf_received (MM_GDBUS_CALL (self), dtmf); mm_gdbus_call_emit_dtmf_received (MM_GDBUS_CALL (self), dtmf);
} }
@@ -611,7 +616,7 @@ call_start_ready (MMBaseModem *modem,
} }
/* check response for error */ /* check response for error */
if (response && strlen (response) > 0 ) { if (response && response[0]) {
error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED, error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't start the call: " "Couldn't start the call: "
"Modem response '%s'", response); "Modem response '%s'", response);
@@ -692,7 +697,7 @@ call_accept_ready (MMBaseModem *modem,
} }
/* check response for error */ /* check response for error */
if( response && strlen(response) > 0 ) { if (response && response[0]) {
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't accept the call: " "Couldn't accept the call: "
"Unhandled response '%s'", response); "Unhandled response '%s'", response);
@@ -700,7 +705,6 @@ call_accept_ready (MMBaseModem *modem,
/* Update state */ /* Update state */
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR); mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR);
} else { } else {
/* Update state */ /* Update state */
mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED); mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
} }
@@ -947,9 +951,8 @@ mm_base_call_new_from_properties (MMBaseModem *modem,
} }
/* if no direction is specified force to outgoing */ /* if no direction is specified force to outgoing */
if(direction == MM_CALL_DIRECTION_UNKNOWN ) { if (direction == MM_CALL_DIRECTION_UNKNOWN)
direction = MM_CALL_DIRECTION_OUTGOING; direction = MM_CALL_DIRECTION_OUTGOING;
}
/* Create a call object as defined by the interface */ /* Create a call object as defined by the interface */
self = mm_iface_modem_voice_create_call (MM_IFACE_MODEM_VOICE (modem)); self = mm_iface_modem_voice_create_call (MM_IFACE_MODEM_VOICE (modem));
@@ -1043,7 +1046,6 @@ mm_base_call_init (MMBaseCall *self)
{ {
/* Initialize private data */ /* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BASE_CALL, MMBaseCallPrivate); self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BASE_CALL, MMBaseCallPrivate);
/* Defaults */
} }
static void static void