sim: allow re-launching initialization
It may happen that we cannot load property values when the SIM is locked, so we need to enable re-launching initialization in the object API.
This commit is contained in:
47
src/mm-sim.c
47
src/mm-sim.c
@@ -746,28 +746,22 @@ interface_initialization_step (InitAsyncContext *ctx)
|
|||||||
interface_initialization_step (ctx);
|
interface_initialization_step (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initable_init_async (GAsyncInitable *initable,
|
common_init_async (GAsyncInitable *initable,
|
||||||
int io_priority,
|
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
|
|
||||||
{
|
{
|
||||||
InitAsyncContext *ctx;
|
InitAsyncContext *ctx;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
mm_gdbus_sim_set_sim_identifier (MM_GDBUS_SIM (initable), NULL);
|
|
||||||
mm_gdbus_sim_set_imsi (MM_GDBUS_SIM (initable), NULL);
|
|
||||||
mm_gdbus_sim_set_operator_identifier (MM_GDBUS_SIM (initable), NULL);
|
|
||||||
mm_gdbus_sim_set_operator_name (MM_GDBUS_SIM (initable), NULL);
|
|
||||||
|
|
||||||
ctx = g_new (InitAsyncContext, 1);
|
ctx = g_new (InitAsyncContext, 1);
|
||||||
ctx->self = g_object_ref (initable);
|
ctx->self = g_object_ref (initable);
|
||||||
ctx->result = g_simple_async_result_new (G_OBJECT (initable),
|
ctx->result = g_simple_async_result_new (G_OBJECT (initable),
|
||||||
callback,
|
callback,
|
||||||
user_data,
|
user_data,
|
||||||
initable_init_async);
|
common_init_async);
|
||||||
ctx->cancellable = (cancellable ?
|
ctx->cancellable = (cancellable ?
|
||||||
g_object_ref (cancellable) :
|
g_object_ref (cancellable) :
|
||||||
NULL);
|
NULL);
|
||||||
@@ -785,6 +779,21 @@ initable_init_async (GAsyncInitable *initable,
|
|||||||
interface_initialization_step (ctx);
|
interface_initialization_step (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
initable_init_async (GAsyncInitable *initable,
|
||||||
|
int io_priority,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
mm_gdbus_sim_set_sim_identifier (MM_GDBUS_SIM (initable), NULL);
|
||||||
|
mm_gdbus_sim_set_imsi (MM_GDBUS_SIM (initable), NULL);
|
||||||
|
mm_gdbus_sim_set_operator_identifier (MM_GDBUS_SIM (initable), NULL);
|
||||||
|
mm_gdbus_sim_set_operator_name (MM_GDBUS_SIM (initable), NULL);
|
||||||
|
|
||||||
|
common_init_async (initable, cancellable, callback, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mm_sim_new (MMBaseModem *modem,
|
mm_sim_new (MMBaseModem *modem,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
@@ -807,6 +816,26 @@ mm_sim_new (MMBaseModem *modem,
|
|||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
mm_sim_initialize_finish (MMSim *self,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
return initable_init_finish (G_ASYNC_INITABLE (self), result, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mm_sim_initialize (MMSim *self,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
common_init_async (G_ASYNC_INITABLE (self),
|
||||||
|
cancellable,
|
||||||
|
callback,
|
||||||
|
user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_property (GObject *object,
|
set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
|
@@ -58,6 +58,13 @@ MMSim *mm_sim_new_finish (GAsyncInitable *initable,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
void mm_sim_initialize (MMSim *self,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean mm_sim_initialize_finish (MMSim *self,
|
||||||
|
GAsyncResult *result,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
#endif /* MM_SIM_H */
|
#endif /* MM_SIM_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user