sms: use property accessors from parent MmGdbusSms when it simplifies things

This commit is contained in:
Aleksander Morgado
2012-09-06 17:50:04 +02:00
parent 8fd02318ec
commit a5266406ba

View File

@@ -104,9 +104,7 @@ handle_store_ready (MMSms *self,
g_object_get (self->priv->modem, g_object_get (self->priv->modem,
MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, &storage, MM_IFACE_MODEM_MESSAGING_SMS_MEM2_STORAGE, &storage,
NULL); NULL);
g_object_set (self, mm_gdbus_sms_set_storage (MM_GDBUS_SMS (ctx->self), storage);
"storage", storage,
NULL);
/* Transition from Unknown->Stored for SMS which were created by the user */ /* Transition from Unknown->Stored for SMS which were created by the user */
if (mm_gdbus_sms_get_state (MM_GDBUS_SMS (ctx->self)) == MM_SMS_STATE_UNKNOWN) if (mm_gdbus_sms_get_state (MM_GDBUS_SMS (ctx->self)) == MM_SMS_STATE_UNKNOWN)
@@ -354,12 +352,7 @@ mm_sms_get_path (MMSms *self)
MMSmsStorage MMSmsStorage
mm_sms_get_storage (MMSms *self) mm_sms_get_storage (MMSms *self)
{ {
MMSmsStorage storage = MM_SMS_STORAGE_UNKNOWN; return mm_gdbus_sms_get_storage (MM_GDBUS_SMS (self));
g_object_get (self,
"storage", &storage,
NULL);
return storage;
} }
gboolean gboolean
@@ -867,10 +860,7 @@ delete_next_part (SmsDeletePartsContext *ctx)
else { else {
/* We do change the state of this SMS back to UNKNOWN, as it is no /* We do change the state of this SMS back to UNKNOWN, as it is no
* longer stored in the device */ * longer stored in the device */
g_object_set (ctx->self, mm_gdbus_sms_set_state (MM_GDBUS_SMS (ctx->self), MM_SMS_STATE_UNKNOWN);
"state", MM_SMS_STATE_UNKNOWN,
NULL);
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);
@@ -1106,18 +1096,10 @@ mm_sms_multipart_take_part (MMSms *self,
inner_error->message); inner_error->message);
g_error_free (inner_error); g_error_free (inner_error);
} else { } else {
/* Completed AND assembled */ /* Completed AND assembled
MMSmsState state = MM_SMS_STATE_UNKNOWN; * Change state RECEIVING->RECEIVED, and signal completeness */
if (mm_gdbus_sms_get_state (MM_GDBUS_SMS (self)) == MM_SMS_STATE_RECEIVING)
/* Change state RECEIVING->RECEIVED, and signal completeness */ mm_gdbus_sms_set_state (MM_GDBUS_SMS (self), MM_SMS_STATE_RECEIVED);
g_object_get (self,
"state", &state,
NULL);
if (state == MM_SMS_STATE_RECEIVING) {
g_object_set (self,
"state", MM_SMS_STATE_RECEIVED,
NULL);
}
} }
} }
@@ -1146,7 +1128,7 @@ mm_sms_singlepart_new (MMBaseModem *modem,
/* Create an SMS object as defined by the interface */ /* Create an SMS object as defined by the interface */
self = mm_iface_modem_messaging_create_sms (MM_IFACE_MODEM_MESSAGING (modem)); self = mm_iface_modem_messaging_create_sms (MM_IFACE_MODEM_MESSAGING (modem));
g_object_set (self, g_object_set (self,
"state", state, "state", state,
"storage", storage, "storage", storage,
NULL); NULL);
@@ -1186,8 +1168,8 @@ mm_sms_multipart_new (MMBaseModem *modem,
MM_SMS_IS_MULTIPART, TRUE, MM_SMS_IS_MULTIPART, TRUE,
MM_SMS_MAX_PARTS, max_parts, MM_SMS_MAX_PARTS, max_parts,
MM_SMS_MULTIPART_REFERENCE, reference, MM_SMS_MULTIPART_REFERENCE, reference,
"state", state, "state", state,
"storage", storage, "storage", storage,
NULL); NULL);
if (!mm_sms_multipart_take_part (self, first_part, error)) if (!mm_sms_multipart_take_part (self, first_part, error))