sms: set state back to UNKNOWN when all SMS parts were deleted

This commit is contained in:
Aleksander Morgado
2012-09-06 19:14:07 +02:00
parent c9a80609d4
commit 018d9b458f

View File

@@ -863,12 +863,9 @@ delete_next_part (SmsDeletePartsContext *ctx)
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Couldn't delete %u parts from this SMS", "Couldn't delete %u parts from this SMS",
ctx->n_failed); ctx->n_failed);
else { else
/* We do change the state of this SMS back to UNKNOWN, as it is no
* longer stored in the device */
mm_gdbus_sms_set_state (MM_GDBUS_SMS (ctx->self), MM_SMS_STATE_UNKNOWN);
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
}
sms_delete_parts_context_complete_and_free (ctx); sms_delete_parts_context_complete_and_free (ctx);
return; return;
} }
@@ -911,8 +908,17 @@ mm_sms_delete_finish (MMSms *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
if (MM_SMS_GET_CLASS (self)->delete_finish) if (MM_SMS_GET_CLASS (self)->delete_finish) {
return MM_SMS_GET_CLASS (self)->delete_finish (self, res, error); gboolean deleted;
deleted = MM_SMS_GET_CLASS (self)->delete_finish (self, res, error);
if (deleted)
/* We do change the state of this SMS back to UNKNOWN, as it is no
* longer stored in the device */
mm_gdbus_sms_set_state (MM_GDBUS_SMS (self), MM_SMS_STATE_UNKNOWN);
return deleted;
}
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
} }