Re: [PATCH] Add GSM registration status notification (V3)
- From: Dan Williams <dcbw redhat com>
- To: Andrew Bird <ajb spheresystems co uk>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH] Add GSM registration status notification (V3)
- Date: Wed, 15 Jun 2011 13:14:49 -0500
On Fri, 2011-06-10 at 16:13 +0100, Andrew Bird wrote:
> The current UI requires the user to mouse-over and reveal a tool
> tip (or click an indicator) to discover the registration state
> (aka polling). If the user inadvertently re-registers on a
> roaming network, the operation is silent until the user decides
> to check the applet for network status, possibly incurring
> expensive roaming tariffs in the mean time.
>
> So to prevent silent registration changes, alert the user with a
> notification when the GSM registration status changes to home or
> to roaming.
Pushed to master and 0.8.x. Any takers for the CDMA equivalent?
Dan
> ---
> v1 -> v2: Fix incorrect mapping of reg_state to mb_state.
> v2 -> v3: Ensure we preserve the meaning of info->reg_state.
> Use the gsm_state_to_mb_state mapping function.
> Also handle the reply of GetRegistrationInfo().
>
> Signed-off-by: Andrew Bird <ajb spheresystems co uk>
> ---
> src/applet-device-gsm.c | 34 +++++++++++++++++++++++++++++++---
> 1 files changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
> index 5d0d584..76fd81e 100644
> --- a/src/applet-device-gsm.c
> +++ b/src/applet-device-gsm.c
> @@ -1083,6 +1083,25 @@ parse_op_name (GsmDeviceInfo *info, const char *orig, const char *op_code)
> return find_provider_for_mcc_mnc (info->providers, orig);
> }
>
> +static void
> +notify_user_of_gsm_reg_change(GsmDeviceInfo *info)
> +{
> + guint32 mb_state = gsm_state_to_mb_state (info);
> +
> + if (mb_state == MB_STATE_HOME)
> + applet_do_notify_with_pref (info->applet,
> + _("GSM network."),
> + _("You are now registered on the home network."),
> + "notification-gsm-high",
> + PREF_DISABLE_CONNECTED_NOTIFICATIONS);
> + else if (mb_state == MB_STATE_ROAMING)
> + applet_do_notify_with_pref (info->applet,
> + _("GSM network."),
> + _("You are now registered on a roaming network."),
> + "notification-gsm-high",
> + PREF_DISABLE_CONNECTED_NOTIFICATIONS);
> +}
> +
> #define REG_INFO_TYPE (dbus_g_type_get_struct ("GValueArray", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID))
> #define DBUS_TYPE_G_MAP_OF_VARIANT (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
>
> @@ -1101,7 +1120,7 @@ reg_info_reply (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
> if (array->n_values == 3) {
> value = g_value_array_get_nth (array, 0);
> if (G_VALUE_HOLDS_UINT (value))
> - new_state = g_value_get_uint (value);
> + new_state = g_value_get_uint (value) + 1;
>
> value = g_value_array_get_nth (array, 1);
> if (G_VALUE_HOLDS_STRING (value)) {
> @@ -1120,7 +1139,11 @@ reg_info_reply (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
> g_value_array_free (array);
> }
>
> - info->reg_state = new_state + 1;
> + if (info->reg_state != new_state) {
> + info->reg_state = new_state;
> + notify_user_of_gsm_reg_change (info);
> + }
> +
> info->op_code = new_op_code;
> info->op_name = new_op_name;
>
> @@ -1281,8 +1304,13 @@ reg_info_changed_cb (DBusGProxy *proxy,
> gpointer user_data)
> {
> GsmDeviceInfo *info = user_data;
> + guint32 new_state = reg_state + 1;
> +
> + if (info->reg_state != new_state) {
> + info->reg_state = new_state;
> + notify_user_of_gsm_reg_change (info);
> + }
>
> - info->reg_state = reg_state + 1;
> g_free (info->op_code);
> info->op_code = strlen (op_code) ? g_strdup (op_code) : NULL;
> g_free (info->op_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]