diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-03-29 19:34:18 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-04-08 16:35:09 +0200 |
commit | 7e5af3b38d2afe8902f9ea194848a89a329fe83d (patch) | |
tree | 1a4d10af77a6f346e68e36e37b03d733eb45ea77 | |
parent | 6c0d9e5a1be72d70036bca2adbd0955f31d5612b (diff) |
base-sim: set dbus id as soon as object is created
-rw-r--r-- | src/mm-base-sim.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c index 7eca8e4a..41540c94 100644 --- a/src/mm-base-sim.c +++ b/src/mm-base-sim.c @@ -57,6 +57,8 @@ static GParamSpec *properties[PROP_LAST]; struct _MMBaseSimPrivate { /* The connection to the system bus */ GDBusConnection *connection; + guint dbus_id; + /* The modem which owns this SIM */ MMBaseModem *modem; /* The path where the SIM object is exported */ @@ -70,10 +72,9 @@ static guint signals[SIGNAL_LAST] = { 0 }; void mm_base_sim_export (MMBaseSim *self) { - static guint id = 0; gchar *path; - path = g_strdup_printf (MM_DBUS_SIM_PREFIX "/%d", id++); + path = g_strdup_printf (MM_DBUS_SIM_PREFIX "/%d", self->priv->dbus_id); g_object_set (self, MM_BASE_SIM_PATH, path, NULL); @@ -1811,8 +1812,13 @@ get_property (GObject *object, static void mm_base_sim_init (MMBaseSim *self) { + static guint id = 0; + /* Initialize private data */ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BASE_SIM, MMBaseSimPrivate); + + /* Each SIM is given a unique id to build its own DBus path */ + self->priv->dbus_id = id++; } static void |