diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-09 12:05:17 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:48 +0100 |
commit | 56956a36adcb11e7c789f8ef6518a2afae990f84 (patch) | |
tree | 7b2dc2bb40aa0981870fe50463f56564ccc99803 /src | |
parent | 91eb041a635c3dfd4703c0f77110349d4a58199a (diff) |
bearer-cdma: allow subclasses to use the same unique path generator
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-bearer-cdma.c | 13 | ||||
-rw-r--r-- | 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, |