aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-05-18 10:41:55 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-05-22 22:58:37 +0000
commitff45d292ee75b0e49c3de3677211218445659884 (patch)
tree7f4f1efc2e4bdd8305ca2415f08ae825c1989ad6 /src
parent34a50edde100436a1bbb5249b8bbb812c4fde7c2 (diff)
libmm-glib: setup common helper to register DBus errors
Diffstat (limited to 'src')
-rw-r--r--src/main.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/main.c b/src/main.c
index d11383c3..0067583e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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