From 219aff47e075a5bfc7b7fdc2c7f251a5133c93ab Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 22 Oct 2012 17:06:14 +0200 Subject: [PATCH] iface-modem: try to avoid showing 'any' as current bands Just expose the list of supported bands when the current bands is set to 'any'. --- src/mm-iface-modem.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index f29ad273..79f54aab 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -1526,8 +1526,20 @@ set_bands_ready (MMIfaceModem *self, if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_bands_finish (self, res, &error)) g_simple_async_result_take_error (ctx->result, error); else { - mm_gdbus_modem_set_bands (ctx->skeleton, - mm_common_bands_garray_to_variant (ctx->bands_array)); + /* Never show just 'any' in the interface */ + if (ctx->bands_array->len == 1 && + g_array_index (ctx->bands_array, MMModemBand, 0) == MM_MODEM_BAND_ANY) { + GArray *supported_bands; + + supported_bands = (mm_common_bands_variant_to_garray ( + mm_gdbus_modem_get_supported_bands (ctx->skeleton))); + mm_gdbus_modem_set_bands (ctx->skeleton, + mm_common_bands_garray_to_variant (supported_bands)); + g_array_unref (supported_bands); + } else + mm_gdbus_modem_set_bands (ctx->skeleton, + mm_common_bands_garray_to_variant (ctx->bands_array)); + g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); }