libmm-glib: setup common helper to register DBus errors

This commit is contained in:
Aleksander Morgado
2021-05-18 10:41:55 +02:00
parent 34a50edde1
commit ff45d292ee
4 changed files with 34 additions and 34 deletions

View File

@@ -133,23 +133,14 @@ name_lost_cb (GDBusConnection *connection,
static void
register_dbus_errors (void)
{
static volatile guint32 aux = 0;
/* This method will always return success once during runtime */
if (!mm_common_register_errors ())
return;
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;
/* We no longer use MM_CORE_ERROR_CANCELLED in the daemon, we rely on
* G_IO_ERROR_CANCELLED internally */
g_dbus_error_unregister_error (MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED, MM_CORE_ERROR_DBUS_PREFIX ".Cancelled");
g_dbus_error_register_error (G_IO_ERROR, G_IO_ERROR_CANCELLED, MM_CORE_ERROR_DBUS_PREFIX ".Cancelled");
/* We no longer use MM_CORE_ERROR_CANCELLED in the daemon, we rely on
* G_IO_ERROR_CANCELLED internally */
g_dbus_error_unregister_error (MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED, MM_CORE_ERROR_DBUS_PREFIX ".Cancelled");
g_dbus_error_register_error (G_IO_ERROR, G_IO_ERROR_CANCELLED, MM_CORE_ERROR_DBUS_PREFIX ".Cancelled");
}
int