diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-15 09:37:56 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-15 09:39:26 +0100 |
commit | cf46ed42384e9fbd4872e2f98d743755d8f9a571 (patch) | |
tree | 40c7ca2ef301baae1c2543770481c0279249819a | |
parent | b74741e6420519767bd7551f29dc69f9f31b4c51 (diff) |
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.
-rw-r--r-- | libmm-glib/mm-manager.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libmm-glib/mm-manager.c b/libmm-glib/mm-manager.c index 37f3ac4f..81f2041a 100644 --- a/libmm-glib/mm-manager.c +++ b/libmm-glib/mm-manager.c @@ -596,8 +596,27 @@ 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 mm_manager_init (MMManager *manager) { + register_dbus_errors (); + /* Setup private data */ manager->priv = G_TYPE_INSTANCE_GET_PRIVATE ((manager), MM_TYPE_MANAGER, |