[network-manager-applet] connection-editor: allow "MAC (devname)" format again



commit bfbdb53765660ca16e2f1f653cdc112da5e21232
Author: Dan Winship <danw gnome org>
Date:   Mon Aug 13 10:52:04 2012 -0400

    connection-editor: allow "MAC (devname)" format again
    
    The default format nm-c-e uses for "Device MAC" fields is, eg,
    "F0:DE:F1:9B:15:37 (eth1)", but this got broken recently to not allow
    the parenthetical comment. Fix that.

 src/connection-editor/ce-page.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index f9b73a6..c2c44ae 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -157,7 +157,8 @@ ce_page_mac_to_entry (const GByteArray *mac, int type, GtkEntry *entry)
 GByteArray *
 ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid)
 {
-	const char *temp;
+	const char *temp, *sp;
+	char *buf = NULL;
 	GByteArray *mac;
 
 	g_return_val_if_fail (entry != NULL, NULL);
@@ -170,7 +171,12 @@ ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid)
 	if (!temp || !strlen (temp))
 		return NULL;
 
+	sp = strchr (temp, ' ');
+	if (sp)
+		temp = buf = g_strndup (temp, sp - temp);
+
 	mac = nm_utils_hwaddr_atoba (temp, type);
+	g_free (buf);
 	if (!mac) {
 		if (invalid)
 			*invalid = TRUE;



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