[evolution] Shorten user names with '@' in Send & Receive window.



commit d5fdb6c72e9499c1c04d40094ccadee25d36b30c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 19 12:14:28 2012 -0400

    Shorten user names with '@' in Send & Receive window.

 mail/mail-send-recv.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 35da6b3..a8bade9 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -369,8 +369,9 @@ format_service_name (CamelService *service)
 	const gchar *display_name;
 	const gchar *host = NULL;
 	const gchar *path = NULL;
-	const gchar *user = NULL;
 	gchar *pretty_url = NULL;
+	gchar *user = NULL;
+	gchar *cp;
 	gboolean have_host = FALSE;
 	gboolean have_path = FALSE;
 	gboolean have_user = FALSE;
@@ -384,7 +385,7 @@ format_service_name (CamelService *service)
 			CAMEL_NETWORK_SETTINGS (settings));
 		have_host = (host != NULL) && (*host != '\0');
 
-		user = camel_network_settings_get_user (
+		user = camel_network_settings_dup_user (
 			CAMEL_NETWORK_SETTINGS (settings));
 		have_user = (user != NULL) && (*user != '\0');
 	}
@@ -395,6 +396,13 @@ format_service_name (CamelService *service)
 		have_path = (path != NULL) && (*path != '\0');
 	}
 
+	/* Shorten user names with '@', since multiple '@' in a
+	 * 'user host' label look weird.  This is just supposed
+	 * to be a hint anyway so it doesn't matter if it's not
+	 * strictly correct. */
+	if (have_user && (cp = strchr (user, '@')) != NULL)
+		*cp = '\0';
+
 	g_return_val_if_fail (provider != NULL, NULL);
 
 	/* This should never happen, but if the service has no
@@ -422,6 +430,7 @@ format_service_name (CamelService *service)
 	}
 
 	g_free (service_name);
+	g_free (user);
 
 	return pretty_url;
 }



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