summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-11-15 08:37:56 (GMT)
committerAleksander Morgado <aleksander@lanedo.com>2012-11-15 08:39:26 (GMT)
commitcf46ed42384e9fbd4872e2f98d743755d8f9a571 (patch)
tree40c7ca2ef301baae1c2543770481c0279249819a
parentb74741e6420519767bd7551f29dc69f9f31b4c51 (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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libmm-glib/mm-manager.c b/libmm-glib/mm-manager.c
index 37f3ac4..81f2041 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,