[geary/mjog/735-unicode-avatar-initials: 2/2] Util.Avatar::extract_initials_from_name: Trivial optimisation
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/735-unicode-avatar-initials: 2/2] Util.Avatar::extract_initials_from_name: Trivial optimisation
- Date: Tue, 17 Mar 2020 11:47:52 +0000 (UTC)
commit ad6b58cf0a7b095e5aee5498608c5e119371542c
Author: Michael Gratton <mike vee net>
Date: Tue Mar 17 22:46:42 2020 +1100
Util.Avatar::extract_initials_from_name: Trivial optimisation
Don't upper case the whole string, only upper-case characters that
are used as the initials.
src/client/util/util-avatar.vala | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/client/util/util-avatar.vala b/src/client/util/util-avatar.vala
index 7405a9e1..a6cd3ee2 100644
--- a/src/client/util/util-avatar.vala
+++ b/src/client/util/util-avatar.vala
@@ -72,7 +72,7 @@ namespace Util.Avatar {
}
public string? extract_initials_from_name(string name) {
- string normalized = name.strip().up().normalize(-1, DEFAULT_COMPOSE);
+ string normalized = name.strip().normalize(-1, DEFAULT_COMPOSE);
string? initials = null;
if (normalized != "") {
GLib.StringBuilder buf = new GLib.StringBuilder();
@@ -82,7 +82,7 @@ namespace Util.Avatar {
// Get the first alphanumeric char of the string
for (int i = 0; normalized.get_next_char(ref index, out c); i++) {
if (c.isalnum()) {
- buf.append_unichar(c);
+ buf.append_unichar(c.toupper());
break;
}
}
@@ -92,7 +92,7 @@ namespace Util.Avatar {
if (index >= 0) {
for (int i = 0; normalized.get_next_char(ref index, out c); i++) {
if (c.isalnum()) {
- buf.append_unichar(c);
+ buf.append_unichar(c.toupper());
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]