[network-manager-applet] applet: update for libnm-util API changes



commit a60b2d3fc8665a2629f735848ce26834c1adc9e3
Author: Dan Williams <dcbw redhat com>
Date:   Wed Feb 23 11:55:46 2011 -0600

    applet: update for libnm-util API changes

 src/ap-menu-item.c                    |    2 +-
 src/applet-device-wifi.c              |   13 +++++--------
 src/applet-dialogs.c                  |    3 +--
 src/applet.c                          |    8 ++++----
 src/connection-editor/page-wireless.c |    2 +-
 src/wired-dialog.c                    |    4 ++--
 src/wireless-dialog.c                 |    8 ++++----
 7 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c
index d10957d..1820c6f 100644
--- a/src/ap-menu-item.c
+++ b/src/ap-menu-item.c
@@ -116,7 +116,7 @@ nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GByteArray *ssid)
 
 	g_free (item->ssid_string);
 
-	item->ssid_string = nm_utils_ssid_to_utf8 ((const char *) ssid->data, ssid->len);
+	item->ssid_string = nm_utils_ssid_to_utf8 (ssid);
 	if (!item->ssid_string) {
 		// FIXME: shouldn't happen; always coerce the SSID to _something_
 		item->ssid_string = g_strdup ("<unknown>");
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 93cdedf..9c5ff47 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -378,9 +378,7 @@ wireless_new_auto_connection (NMDevice *device,
 	NMSettingWirelessSecurity *s_wireless_sec = NULL;
 	NMSetting8021x *s_8021x = NULL;
 	const GByteArray *ap_ssid;
-	char *id;
-	char buf[33];
-	int buf_len;
+	char *id, *utf8_ssid;
 	NM80211Mode mode;
 	guint32 dev_caps;
 	gboolean supported = TRUE;
@@ -433,12 +431,11 @@ wireless_new_auto_connection (NMDevice *device,
 			    NM_SETTING_CONNECTION_AUTOCONNECT, !is_manufacturer_default_ssid (ap_ssid),
 			    NULL);
 
-	memset (buf, 0, sizeof (buf));
-	buf_len = MIN(ap_ssid->len, sizeof (buf) - 1);
-	memcpy (buf, ap_ssid->data, buf_len);
-	id = g_strdup_printf ("Auto %s", nm_utils_ssid_to_utf8 (buf, buf_len));
+	utf8_ssid = nm_utils_ssid_to_utf8 (ap_ssid);
+	id = g_strdup_printf ("Auto %s", utf8_ssid);
 	g_object_set (s_con, NM_SETTING_CONNECTION_ID, id, NULL);
 	g_free (id);
+	g_free (utf8_ssid);
 
 	id = nm_utils_uuid_generate ();
 	g_object_set (s_con, NM_SETTING_CONNECTION_UUID, id, NULL);
@@ -1250,7 +1247,7 @@ wireless_get_icon (NMDevice *device,
 
 		tmp = nm_access_point_get_ssid (ap);
 		if (tmp)
-			ssid = nm_utils_ssid_to_utf8 ((const char *) tmp->data, tmp->len);
+			ssid = nm_utils_ssid_to_utf8 (tmp);
 	}
 
 	if (!ssid)
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index 7dff7f0..e117d1a 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -86,8 +86,7 @@ ip6_address_as_string (const struct in6_addr *ip)
 		g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]);
 		for (j = 1; j < 16; j++)
 			g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]);
-		nm_warning ("%s: error converting IP6 address %s",
-		            __func__, ip6_str->str);
+		g_warning ("%s: error converting IP6 address %s", __func__, ip6_str->str);
 		g_string_free (ip6_str, TRUE);
 		return NULL;
 	}
diff --git a/src/applet.c b/src/applet.c
index 4399cb0..41c4ce1 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -345,7 +345,7 @@ add_and_activate_cb (NMClient *client,
                      gpointer user_data)
 {
 	if (error)
-		nm_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
+		g_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
 
 	applet_schedule_update_icon (NM_APPLET (user_data));
 }
@@ -405,7 +405,7 @@ activate_connection_cb (NMClient *client,
                         gpointer user_data)
 {
 	if (error)
-		nm_warning ("Connection activation failed: %s", error->message);
+		g_warning ("Connection activation failed: %s", error->message);
 
 	applet_schedule_update_icon (NM_APPLET (user_data));
 }
@@ -450,7 +450,7 @@ applet_menu_item_activate_helper (NMDevice *device,
 	if (!dclass->new_auto_connection (device, dclass_data,
 	                                  applet_menu_item_activate_helper_new_connection,
 	                                  info)) {
-		nm_warning ("Couldn't create default connection.");
+		g_warning ("Couldn't create default connection.");
 		applet_item_activate_info_destroy (info);
 	}
 }
@@ -1005,7 +1005,7 @@ activate_vpn_cb (NMClient *client,
 		                            PREF_DISABLE_VPN_NOTIFICATIONS);
 		g_free (msg);
 
-		nm_warning ("VPN Connection activation failed: (%s) %s", name, error->message);
+		g_warning ("VPN Connection activation failed: (%s) %s", name, error->message);
 	}
 
 	applet_schedule_update_icon (info->applet);
diff --git a/src/connection-editor/page-wireless.c b/src/connection-editor/page-wireless.c
index 8e601a3..d96398c 100644
--- a/src/connection-editor/page-wireless.c
+++ b/src/connection-editor/page-wireless.c
@@ -294,7 +294,7 @@ populate_ui (CEPageWireless *self)
 				  NULL);
 
 	if (ssid)
-		utf8_ssid = nm_utils_ssid_to_utf8 ((const char *) ssid->data, ssid->len);
+		utf8_ssid = nm_utils_ssid_to_utf8 (ssid);
 	else
 		utf8_ssid = g_strdup ("");
 	gtk_entry_set_text (priv->ssid, utf8_ssid);
diff --git a/src/wired-dialog.c b/src/wired-dialog.c
index 502fbdf..c020900 100644
--- a/src/wired-dialog.c
+++ b/src/wired-dialog.c
@@ -132,14 +132,14 @@ nma_wired_dialog_new (const char *ui_file, NMConnection *connection)
 
 	dialog = GTK_WIDGET (gtk_builder_get_object (builder, "wireless_dialog"));
 	if (!dialog) {
-		nm_warning ("Couldn't find wireless_dialog widget.");
+		g_warning ("Couldn't find wireless_dialog widget.");
 		g_object_unref (builder);
 		return NULL;
 	}
 
 	success = dialog_init (dialog, builder, connection);
 	if (!success) {
-		nm_warning ("Couldn't create wired security dialog.");
+		g_warning ("Couldn't create wired security dialog.");
 		gtk_widget_destroy (dialog);
 		g_object_unref (builder);
 		return NULL;
diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c
index b0d8c63..4214197 100644
--- a/src/wireless-dialog.c
+++ b/src/wireless-dialog.c
@@ -380,7 +380,7 @@ connection_combo_changed (GtkWidget *combo,
 
 		s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_WIRELESS));
 		ssid = nm_setting_wireless_get_ssid (s_wireless);
-		utf8_ssid = nm_utils_ssid_to_utf8 ((const char *) ssid->data, ssid->len);
+		utf8_ssid = nm_utils_ssid_to_utf8 (ssid);
 		gtk_entry_set_text (GTK_ENTRY (widget), utf8_ssid);
 		g_free (utf8_ssid);
 	} else {
@@ -1088,7 +1088,7 @@ internal_init (NMAWirelessDialog *self,
 
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "hbox1"));
 	if (!widget) {
-		nm_warning ("Couldn't find wireless_dialog widget.");
+		g_warning ("Couldn't find wireless_dialog widget.");
 		return FALSE;
 	}
 	gtk_widget_unparent (widget);
@@ -1148,7 +1148,7 @@ internal_init (NMAWirelessDialog *self,
 		s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_WIRELESS));
 		ssid = s_wireless ? nm_setting_wireless_get_ssid (s_wireless) : NULL;
 		if (ssid)
-			esc_ssid = nm_utils_ssid_to_utf8 ((const char *) ssid->data, ssid->len);
+			esc_ssid = nm_utils_ssid_to_utf8 (ssid);
 
 		tmp = g_strdup_printf (_("Passwords or encryption keys are required to access the wireless network '%s'."),
 		                       esc_ssid ? esc_ssid : "<unknown>");
@@ -1321,7 +1321,7 @@ internal_new_other (NMApplet *applet, gboolean create)
 	priv->adhoc_create = create;
 
 	if (!internal_init (self, NULL, NULL, FALSE, create)) {
-		nm_warning ("Couldn't create wireless security dialog.");
+		g_warning ("Couldn't create wireless security dialog.");
 		g_object_unref (self);
 		return NULL;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]