[geary/mjog/mail-merge-plugin: 33/74] Util.Email.strip_subject_prefixes: Convert param to EmailHeaderSet
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/mail-merge-plugin: 33/74] Util.Email.strip_subject_prefixes: Convert param to EmailHeaderSet
- Date: Fri, 14 Aug 2020 02:09:03 +0000 (UTC)
commit bb836ff009c5ca1b6a4786f41e061a8ea9cb6043
Author: Michael Gratton <mike vee net>
Date: Thu May 7 17:22:24 2020 +1000
Util.Email.strip_subject_prefixes: Convert param to EmailHeaderSet
Provides some more flexibility in how it can be called.
src/client/util/util-email.vala | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/client/util/util-email.vala b/src/client/util/util-email.vala
index 7a23919d4..a18a45cfb 100644
--- a/src/client/util/util-email.vala
+++ b/src/client/util/util-email.vala
@@ -32,10 +32,23 @@ namespace Util.Email {
return compare_conversation_ascending(b, a);
}
- /** Returns the stripped subject line, or a placeholder if none. */
- public string strip_subject_prefixes(Geary.Email email) {
- string? cleaned = (email.subject != null) ? email.subject.strip_prefixes() : null;
- return !Geary.String.is_empty(cleaned) ? cleaned : _("(No subject)");
+ /**
+ * Returns the subject for an email stripped of prefixes.
+ *
+ * If the email has no subject, returns a localised placeholder.
+ */
+ public string strip_subject_prefixes(Geary.EmailHeaderSet email) {
+ string? cleaned = null;
+ if (email.subject != null) {
+ cleaned = email.subject.strip_prefixes();
+ }
+ return (
+ !Geary.String.is_empty_or_whitespace(cleaned)
+ ? cleaned
+ // Translators: Label used when an email has a missing or
+ // an empty subject
+ : _("(No subject)")
+ );
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]