diff options
author | Alexander Larsson <alexl@redhat.com> | 2011-06-23 20:13:50 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2011-06-23 20:13:50 +0200 |
commit | 9d50b9b25d1945d91015ffcd852726cc450d8286 (patch) | |
tree | acd8dc45db62219aeef05ff5ad5ef51aea8b088c /src/contacts-types.vala | |
parent | 2b0c3e7128afcee8ada10f69e9933f7b3611e18c (diff) | |
download | gnome-contacts-9d50b9b25d1945d91015ffcd852726cc450d8286.tar.gz |
Fix up issues with OTHER and custom types
Diffstat (limited to 'src/contacts-types.vala')
-rw-r--r-- | src/contacts-types.vala | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/contacts-types.vala b/src/contacts-types.vala index 67710f2..f55a318 100644 --- a/src/contacts-types.vala +++ b/src/contacts-types.vala @@ -38,13 +38,15 @@ public class Contacts.TypeSet : Object { // Dummy Data to mark the "Custom..." store entry private static Data custom_dummy = new Data (); + // Dummy Data to mark the "Other..." store entry + private static Data other_dummy = new Data (); // Map from translated display name to Data for all "standard" types private HashTable<unowned string, Data> display_name_hash; // Map from all type strings in to list of InitData with the data in it private HashTable<unowned string, GLib.List<InitData*> > vcard_lookup_hash; // Map from display name to TreeIter for all custom types - private HashTable<unowned string, TreeIter?> custom_hash; + private HashTable<string, TreeIter?> custom_hash; public ListStore store; private TreeIter other_iter; @@ -109,7 +111,7 @@ public class Contacts.TypeSet : Object { } store.append (out other_iter); - store.set (other_iter, 0, _("Other"), 1, null); + store.set (other_iter, 0, _("Other"), 1, other_dummy); TreeIter iter; // Separator @@ -129,6 +131,11 @@ public class Contacts.TypeSet : Object { return; } + if (label == _("Other")) { + iter = other_iter; + return; + } + unowned TreeIter? iterp = custom_hash.lookup (label); if (iterp != null) { iter = iterp; @@ -233,9 +240,13 @@ public class Contacts.TypeSet : Object { details.parameters.set ("type", "OTHER"); details.parameters.set (X_GOOGLE_LABEL, display_name); } else { - InitData *init_data = data.init_data.data; - for (int j = 0; j < MAX_TYPES && init_data.types[j] != null; j++) { - details.parameters.set ("type", init_data.types[j]); + if (data == other_dummy) { + details.parameters.set ("type", "OTHER"); + } else { + InitData *init_data = data.init_data.data; + for (int j = 0; j < MAX_TYPES && init_data.types[j] != null; j++) { + details.parameters.set ("type", init_data.types[j]); + } } } |