diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-05-18 10:41:55 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-05-22 22:58:37 +0000 |
commit | ff45d292ee75b0e49c3de3677211218445659884 (patch) | |
tree | 7f4f1efc2e4bdd8305ca2415f08ae825c1989ad6 /src | |
parent | 34a50edde100436a1bbb5249b8bbb812c4fde7c2 (diff) |
libmm-glib: setup common helper to register DBus errors
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 25 |
1 files changed, 8 insertions, 17 deletions
@@ -133,23 +133,14 @@ name_lost_cb (GDBusConnection *connection, 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; - - /* 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"); + /* This method will always return success once during runtime */ + if (!mm_common_register_errors ()) + return; + + /* 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 |