[gnome-contacts] TypeSet: Break out data lookup from display name generation
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] TypeSet: Break out data lookup from display name generation
- Date: Wed, 22 Jun 2011 12:36:20 +0000 (UTC)
commit b637375e89738db129a262a97244b7d89404ea18
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 21 14:16:07 2011 +0200
TypeSet: Break out data lookup from display name generation
src/contacts-types.vala | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/contacts-types.vala b/src/contacts-types.vala
index ef15aac..673305f 100644
--- a/src/contacts-types.vala
+++ b/src/contacts-types.vala
@@ -123,14 +123,10 @@ public class Contacts.TypeSet : Object {
return int.parse (s);
}
- public string format_type (FieldDetails detail) {
- if (detail.parameters.contains ("x-google-label")) {
- return get_first_string (detail.parameters.get ("x-google-label"));
- }
-
+ public InitData *lookup_data (FieldDetails detail) {
var i = detail.get_parameter_values ("type");
if (i == null || i.is_empty)
- return _("Other");
+ return null;
var list = new Gee.ArrayList<string> ();
foreach (var s in detail.get_parameter_values ("type")) {
@@ -142,7 +138,7 @@ public class Contacts.TypeSet : Object {
}
if (list.is_empty)
- return _("Other");
+ return null;
list.sort ();
@@ -156,7 +152,20 @@ public class Contacts.TypeSet : Object {
}
}
if (all_found)
- return dgettext (Config.GETTEXT_PACKAGE, d.display_name);
+ return d;
+ }
+
+ return null;
+ }
+
+ public string format_type (FieldDetails detail) {
+ if (detail.parameters.contains ("x-google-label")) {
+ return get_first_string (detail.parameters.get ("x-google-label"));
+ }
+
+ var d = lookup_data (detail);
+ if (d != null) {
+ return dgettext (Config.GETTEXT_PACKAGE, d.display_name);
}
return _("Other");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]