diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-05-22 17:43:21 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-06-05 19:15:13 +0200 |
commit | 804642adc234094717158ff09857de1432565dda (patch) | |
tree | fdcf1cd2fc158e2edc6325b7b67095fa4895932d /libmm-glib/mm-common-helpers.c | |
parent | a42234dd1c680e7604008fc2e66be849c7bf70de (diff) |
api: let MMBearerIpFamily be flags instead of a enumeration
We want to expose in the Modem interface the list of supported IP families, and
the easiest way to do so is to have the IP family as flags, and provide in the
interface a single enum.
Also, a value of 0 for a MMBearerIpFamily specifies that no flags are set, so
just rename it to 'NONE'.
And add a new 'ANY' value which sets all flags to 1.
Diffstat (limited to 'libmm-glib/mm-common-helpers.c')
-rw-r--r-- | libmm-glib/mm-common-helpers.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c index 4694be8d..aabc070c 100644 --- a/libmm-glib/mm-common-helpers.c +++ b/libmm-glib/mm-common-helpers.c @@ -399,14 +399,14 @@ MMBearerIpFamily mm_common_get_ip_type_from_string (const gchar *str, GError **error) { - GEnumClass *enum_class; + GFlagsClass *flags_class; guint i; - enum_class = G_ENUM_CLASS (g_type_class_ref (MM_TYPE_BEARER_IP_FAMILY)); + flags_class = G_FLAGS_CLASS (g_type_class_ref (MM_TYPE_BEARER_IP_FAMILY)); - for (i = 0; enum_class->values[i].value_nick; i++) { - if (!g_ascii_strcasecmp (str, enum_class->values[i].value_nick)) - return enum_class->values[i].value; + for (i = 0; flags_class->values[i].value_nick; i++) { + if (!g_ascii_strcasecmp (str, flags_class->values[i].value_nick)) + return flags_class->values[i].value; } g_set_error (error, @@ -414,7 +414,7 @@ mm_common_get_ip_type_from_string (const gchar *str, MM_CORE_ERROR_INVALID_ARGS, "Couldn't match '%s' with a valid MMBearerIpFamily value", str); - return MM_BEARER_IP_FAMILY_UNKNOWN; + return MM_BEARER_IP_FAMILY_NONE; } MMBearerAllowedAuth |