iface-modem-messaging: once all messages initially loaded, set default storages

This commit is contained in:
Aleksander Morgado
2012-03-15 14:15:03 +01:00
parent 8c8e5efa14
commit 50d474056d
+30 -1
View File
@@ -355,7 +355,7 @@ mm_iface_modem_messaging_set_preferred_storages (MMIfaceModemMessaging *self,
callback,
user_data,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
MM_CORE_ERROR_UNSUPPORTED,
"Setting preferred storage is not supported");
return;
}
@@ -552,6 +552,7 @@ typedef enum {
ENABLING_STEP_SETUP_SMS_FORMAT,
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
ENABLING_STEP_LOAD_INITIAL_SMS_PARTS,
ENABLING_STEP_STORAGE_DEFAULTS,
ENABLING_STEP_LAST
} EnablingStep;
@@ -688,6 +689,23 @@ load_initial_sms_parts_from_storages (EnablingContext *ctx)
return;
}
static void
set_default_storages_ready (MMIfaceModemMessaging *self,
GAsyncResult *res,
EnablingContext *ctx)
{
GError *error = NULL;
if (!mm_iface_modem_messaging_set_preferred_storages_finish (self, res, &error)) {
mm_dbg ("Couldn't set preferred storages: '%s'", error->message);
g_error_free (error);
}
/* Go on with next step */
ctx->step++;
interface_enabling_step (ctx);
}
static void
interface_enabling_step (EnablingContext *ctx)
{
@@ -752,6 +770,17 @@ interface_enabling_step (EnablingContext *ctx)
/* Fall down to next step */
ctx->step++;
case ENABLING_STEP_STORAGE_DEFAULTS:
/* Set storage defaults */
mm_dbg ("Setting default preferred storages...");
mm_iface_modem_messaging_set_preferred_storages (ctx->self,
MM_SMS_STORAGE_UNKNOWN,
MM_SMS_STORAGE_UNKNOWN,
MM_SMS_STORAGE_UNKNOWN,
(GAsyncReadyCallback)set_default_storages_ready,
ctx);
return;
case ENABLING_STEP_LAST:
/* We are done without errors! */
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);