From 56956a36adcb11e7c789f8ef6518a2afae990f84 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 9 Jan 2012 12:05:17 +0100 Subject: [PATCH] bearer-cdma: allow subclasses to use the same unique path generator --- src/mm-bearer-cdma.c | 13 +++++++++++-- src/mm-bearer-cdma.h | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mm-bearer-cdma.c b/src/mm-bearer-cdma.c index e12fac1b..347b48fd 100644 --- a/src/mm-bearer-cdma.c +++ b/src/mm-bearer-cdma.c @@ -94,6 +94,16 @@ disconnect (MMBearer *self, /*****************************************************************************/ +gchar * +mm_bearer_cdma_new_unique_path (void) +{ + static guint id = 0; + + return g_strdup_printf (MM_DBUS_BEARER_CDMA_PREFIX "/%d", id++); +} + +/*****************************************************************************/ + MMBearer * mm_bearer_cdma_new_finish (MMIfaceModemCdma *modem, GAsyncResult *res, @@ -112,7 +122,6 @@ mm_bearer_cdma_new (MMIfaceModemCdma *modem, gpointer user_data) { GSimpleAsyncResult *result; - static guint id = 0; MMBearerCdma *bearer; gchar *path; @@ -129,7 +138,7 @@ mm_bearer_cdma_new (MMIfaceModemCdma *modem, /* Set modem and path ONLY after having checked input properties, so that * we don't export invalid bearers. */ - path = g_strdup_printf (MM_DBUS_BEARER_CDMA_PREFIX "/%d", id++); + path = mm_bearer_cdma_new_unique_path (); g_object_set (bearer, MM_BEARER_PATH, path, MM_BEARER_MODEM, modem, diff --git a/src/mm-bearer-cdma.h b/src/mm-bearer-cdma.h index 20d65820..cbdd9902 100644 --- a/src/mm-bearer-cdma.h +++ b/src/mm-bearer-cdma.h @@ -51,6 +51,9 @@ struct _MMBearerCdmaClass { GType mm_bearer_cdma_get_type (void); +/* Getter for an unique CDMA Bearer path */ +gchar *mm_bearer_cdma_new_unique_path (void); + /* Default CDMA bearer creation implementation */ void mm_bearer_cdma_new (MMIfaceModemCdma *modem, MMCommonBearerProperties *properties,