aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-sms.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-03-29 19:47:30 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-04-08 16:35:09 +0200
commit6c5a2e24aeaa6030ee7fc9d370acf502be5f4625 (patch)
treeb6a437dffbabbe3848da110e3ae7b57cd2390347 /src/mm-base-sms.c
parente2d15e9bf43e507fe973cf40bfd5f248faf09643 (diff)
base-sms: set dbus id as soon as object is created
Diffstat (limited to 'src/mm-base-sms.c')
-rw-r--r--src/mm-base-sms.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mm-base-sms.c b/src/mm-base-sms.c
index 4d306e7a..be0f2045 100644
--- a/src/mm-base-sms.c
+++ b/src/mm-base-sms.c
@@ -55,6 +55,8 @@ static GParamSpec *properties[PROP_LAST];
struct _MMBaseSmsPrivate {
/* The connection to the system bus */
GDBusConnection *connection;
+ guint dbus_id;
+
/* The modem which owns this SMS */
MMBaseModem *modem;
/* The path where the SMS object is exported */
@@ -651,10 +653,9 @@ handle_send (MMBaseSms *self,
void
mm_base_sms_export (MMBaseSms *self)
{
- static guint id = 0;
gchar *path;
- path = g_strdup_printf (MM_DBUS_SMS_PREFIX "/%d", id++);
+ path = g_strdup_printf (MM_DBUS_SMS_PREFIX "/%d", self->priv->dbus_id);
g_object_set (self,
MM_BASE_SMS_PATH, path,
NULL);
@@ -1989,10 +1990,15 @@ get_property (GObject *object,
static void
mm_base_sms_init (MMBaseSms *self)
{
+ static guint id = 0;
+
/* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BASE_SMS, MMBaseSmsPrivate);
/* Defaults */
self->priv->max_parts = 1;
+
+ /* Each SMS is given a unique id to build its own DBus path */
+ self->priv->dbus_id = id++;
}
static void