libmm-glib,manager: register DBus error associations in advance
In order to have a proper conversion between DBus error names and GErrors for our known domains, the associations need to be registered before any DBus call attempt. Given that the high-level API of libmm-glib has its entry point always in the MMManager, just register them as soon as the first such object is created.
This commit is contained in:
@@ -595,9 +595,28 @@ initable_init_async (GAsyncInitable *initable,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
register_dbus_errors (void)
|
||||||
|
{
|
||||||
|
static volatile guint32 aux = 0;
|
||||||
|
|
||||||
|
if (aux)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Register all known own errors */
|
||||||
|
aux |= MM_CORE_ERROR;
|
||||||
|
aux |= MM_MOBILE_EQUIPMENT_ERROR;
|
||||||
|
aux |= MM_CONNECTION_ERROR;
|
||||||
|
aux |= MM_SERIAL_ERROR;
|
||||||
|
aux |= MM_MESSAGE_ERROR;
|
||||||
|
aux |= MM_CDMA_ACTIVATION_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mm_manager_init (MMManager *manager)
|
mm_manager_init (MMManager *manager)
|
||||||
{
|
{
|
||||||
|
register_dbus_errors ();
|
||||||
|
|
||||||
/* Setup private data */
|
/* Setup private data */
|
||||||
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE ((manager),
|
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE ((manager),
|
||||||
MM_TYPE_MANAGER,
|
MM_TYPE_MANAGER,
|
||||||
|
Reference in New Issue
Block a user