[PATCH] Fix notify message about WiFi connection.
- From: Mikhail Efremov <mikhefr gmail com>
- To: <networkmanager-list gnome org>
- Subject: [PATCH] Fix notify message about WiFi connection.
- Date: Thu, 3 Mar 2011 19:07:57 +0300
Hello!
Since commits 2f521e3817b6078ca4e6008d1c0b6167df3c7030 and
ec68a999c69f081b77c38c9c4d322b2cb05d434a the variable 'esc_ssid' in
wireless_device_state_changed() is always NULL.
--
WBR, Mikhail Efremov
>From ace8d866aeabed703f201721080bb85f353542b8 Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <sem altlinux org>
Date: Thu, 3 Mar 2011 18:27:23 +0300
Subject: [PATCH] Fix notify message about WiFi connection.
---
src/applet-device-wifi.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 97a03a5..e9a0d85 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -211,6 +211,22 @@ is_manufacturer_default_ssid (const GByteArray *ssid)
return is_ssid_in_list (ssid, manf_default_ssids);
}
+static char *
+get_ssid_utf8 (NMAccessPoint *ap)
+{
+ char *ssid_utf8 = NULL;
+
+ if (ap) {
+ const GByteArray *ssid;
+
+ ssid = nm_access_point_get_ssid (ap);
+ if (ssid)
+ ssid_utf8 = nm_utils_ssid_to_utf8 (ssid);
+ }
+
+ return ssid_utf8;
+}
+
/* List known trojan networks that should never be shown to the user */
static const char *blacklisted_ssids[] = {
/* http://www.npr.org/templates/story/story.php?storyId=130451369 */
@@ -1238,10 +1254,11 @@ wireless_device_state_changed (NMDevice *device,
NMDeviceStateReason reason,
NMApplet *applet)
{
+ NMAccessPoint *new = NULL;
char *msg;
char *esc_ssid = NULL;
- update_active_ap (device, new_state, applet);
+ new = update_active_ap (device, new_state, applet);
if (new_state == NM_DEVICE_STATE_DISCONNECTED)
queue_avail_access_point_notification (device);
@@ -1249,6 +1266,7 @@ wireless_device_state_changed (NMDevice *device,
if (new_state != NM_DEVICE_STATE_ACTIVATED)
return;
+ esc_ssid = get_ssid_utf8 (new);
msg = g_strdup_printf (_("You are now connected to the wireless network '%s'."),
esc_ssid ? esc_ssid : _("(none)"));
applet_do_notify_with_pref (applet, _("Connection Established"),
@@ -1272,14 +1290,8 @@ wireless_get_icon (NMDevice *device,
char *ssid = NULL;
ap = g_object_get_data (G_OBJECT (device), ACTIVE_AP_TAG);
- if (ap) {
- const GByteArray *tmp;
-
- tmp = nm_access_point_get_ssid (ap);
- if (tmp)
- ssid = nm_utils_ssid_to_utf8 (tmp);
- }
+ ssid = get_ssid_utf8 (ap);
if (!ssid)
ssid = g_strdup (_("(none)"));
--
1.7.4.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]