diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-08 23:49:53 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:47 +0100 |
commit | ba9bdb37a9c7d026b764c27e59ef0d33bcb9c501 (patch) | |
tree | cf8cf09577e3a63033c100c6d6f4b15d3ee5b244 /src | |
parent | 3d6df6a1f4c17d903b69efee6e23d7be1bd3d920 (diff) |
bearer-3gpp: allow subclasses to use the same unique path generator
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-bearer-3gpp.c | 11 | ||||
-rw-r--r-- | src/mm-bearer-3gpp.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/mm-bearer-3gpp.c b/src/mm-bearer-3gpp.c index f4c79725..d9e3ed37 100644 --- a/src/mm-bearer-3gpp.c +++ b/src/mm-bearer-3gpp.c @@ -776,6 +776,14 @@ disconnect (MMBearer *self, /*****************************************************************************/ +gchar * +mm_bearer_3gpp_new_unique_path (void) +{ + static guint id = 0; + + return g_strdup_printf (MM_DBUS_BEARER_3GPP_PREFIX "/%d", id++); +} + MMBearer * mm_bearer_3gpp_new_finish (MMIfaceModem3gpp *modem, GAsyncResult *res, @@ -794,7 +802,6 @@ mm_bearer_3gpp_new (MMIfaceModem3gpp *modem, gpointer user_data) { GSimpleAsyncResult *result; - static guint id = 0; MMBearer3gpp *bearer; gchar *path; @@ -824,7 +831,7 @@ mm_bearer_3gpp_new (MMIfaceModem3gpp *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_3GPP_PREFIX "/%d", id++); + path = mm_bearer_3gpp_new_unique_path (); g_object_set (bearer, MM_BEARER_PATH, path, MM_BEARER_MODEM, modem, diff --git a/src/mm-bearer-3gpp.h b/src/mm-bearer-3gpp.h index a1e4d082..8cb205a9 100644 --- a/src/mm-bearer-3gpp.h +++ b/src/mm-bearer-3gpp.h @@ -53,6 +53,9 @@ struct _MMBearer3gppClass { GType mm_bearer_3gpp_get_type (void); +/* Getter for an unique 3GPP Bearer path */ +gchar *mm_bearer_3gpp_new_unique_path (void); + /* Default 3GPP bearer creation implementation */ void mm_bearer_3gpp_new (MMIfaceModem3gpp *modem, MMCommonBearerProperties *properties, |