[gnome-contacts] Fix up issues with OTHER and custom types
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Fix up issues with OTHER and custom types
- Date: Thu, 23 Jun 2011 19:06:36 +0000 (UTC)
commit 9d50b9b25d1945d91015ffcd852726cc450d8286
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jun 23 20:13:50 2011 +0200
Fix up issues with OTHER and custom types
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]);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]