[nm-applet][PATCH v2 1/2] add GSM registration status notification



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, alert the user with a notification when the GSM registration
status changes, either from home to roaming or vice versa, to
prevent silent registration changes.
---
	v1 -> v2, fix incorrect mapping of reg_state to mb_state,
	thanks Andrew Bird for review

 src/applet-device-gsm.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
index 5d0d584..ad79909 100644
--- a/src/applet-device-gsm.c
+++ b/src/applet-device-gsm.c
@@ -1281,8 +1281,23 @@ reg_info_changed_cb (DBusGProxy *proxy,
                      gpointer user_data)
 {
 	GsmDeviceInfo *info = user_data;
-
-	info->reg_state = reg_state + 1;
+	guint32 mb_state = reg_state + 1;
+
+	if (info->reg_state != mb_state) {
+                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);
+        }
+	info->reg_state = mb_state;
 	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]