altair-lte: port load_current_capabilities to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
a96e8f824b
commit
e2e7121e44
@@ -221,15 +221,15 @@ load_current_capabilities_finish (MMIfaceModem *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
MMModemCapability caps;
|
GError *inner_error = NULL;
|
||||||
gchar *caps_str;
|
gssize value;
|
||||||
|
|
||||||
/* This modem is LTE only.*/
|
value = g_task_propagate_int (G_TASK (res), &inner_error);
|
||||||
caps = MM_MODEM_CAPABILITY_LTE;
|
if (inner_error) {
|
||||||
caps_str = mm_modem_capability_build_string_from_mask (caps);
|
g_propagate_error (error, inner_error);
|
||||||
mm_dbg ("Loaded current capabilities: %s", caps_str);
|
return MM_MODEM_CAPABILITY_NONE;
|
||||||
g_free (caps_str);
|
}
|
||||||
return caps;
|
return (MMModemCapability)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -237,16 +237,14 @@ load_current_capabilities (MMIfaceModem *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
GTask *task;
|
||||||
|
|
||||||
mm_dbg ("Loading (Altair LTE) current capabilities...");
|
mm_dbg ("Loading (Altair LTE) current capabilities...");
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
callback,
|
/* This modem is LTE only.*/
|
||||||
user_data,
|
g_task_return_int (task, MM_MODEM_CAPABILITY_LTE);
|
||||||
load_current_capabilities);
|
g_object_unref (task);
|
||||||
g_simple_async_result_complete_in_idle (result);
|
|
||||||
g_object_unref (result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user