aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-card-simple.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-18 16:33:23 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-18 16:33:23 +0800
commit5e14c9cb896ab5077f6aeac383330733e773a00b (patch)
treec015b4b4d60124c5b71a8b5eccda7f6f5383fd6f /addressbook/backend/ebook/e-card-simple.c
parent9eda0faddf0309f33b16b4614cc1a037d9431566 (diff)
downloadgsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar.gz
gsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar.zst
gsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.zip
Implemented "MAILER" field. Added arbitrary field support.
2000-05-18 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h, backend/ebook/e-card-types.h, backend/ebook/e-card.c, backend/ebook/e-card.h: Implemented "MAILER" field. Added arbitrary field support. * contact-editor/e-contact-editor-categories.c: Fixed a warning. svn path=/trunk/; revision=3117
Diffstat (limited to 'addressbook/backend/ebook/e-card-simple.c')
-rw-r--r--addressbook/backend/ebook/e-card-simple.c73
1 files changed, 72 insertions, 1 deletions
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index 7b06c8c6d9..8d2a0f44b4 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -107,7 +107,7 @@ static ECardSimpleFieldData field_data[] =
{ E_CARD_SIMPLE_FIELD_FBURL, "fburl", "Free-busy URL", "FBUrl", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_ANNIVERSARY, "anniversary", "Anniversary", "Anniv", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
{ E_CARD_SIMPLE_FIELD_BIRTH_DATE, "birth_date", "Birth Date", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
- { E_CARD_SIMPLE_FIELD_MAILER, "mailer", "Mailer", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
+ { E_CARD_SIMPLE_FIELD_MAILER, "mailer", "", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
};
static void e_card_simple_init (ECardSimple *simple);
@@ -1112,3 +1112,74 @@ const char *e_card_simple_get_short_name (ECardSimple *simple,
{
return field_data[field].short_name;
}
+
+void e_card_simple_arbitrary_foreach (ECardSimple *simple,
+ ECardSimpleArbitraryCallback *callback,
+ gpointer closure)
+{
+ if (simple->card) {
+ ECardList *list;
+ ECardIterator *iterator;
+ gtk_object_get(GTK_OBJECT(simple->card),
+ "arbitrary", &list,
+ NULL);
+ for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
+ if (callback)
+ (*callback) (arbitrary, closure);
+ }
+ }
+}
+
+const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple,
+ const char *key)
+{
+ if (simple->card) {
+ ECardList *list;
+ ECardIterator *iterator;
+ gtk_object_get(GTK_OBJECT(simple->card),
+ "arbitrary", &list,
+ NULL);
+ for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
+ if (!strcasecmp(arbitrary->key, key))
+ return arbitrary;
+ }
+ }
+ return NULL;
+}
+
+/* Any of these except key can be NULL */
+void e_card_simple_set_arbitrary (ECardSimple *simple,
+ const char *key,
+ const char *type,
+ const char *value)
+{
+ if (simple->card) {
+ ECardArbitrary *new_arb;
+ ECardList *list;
+ ECardIterator *iterator;
+ gtk_object_get(GTK_OBJECT(simple->card),
+ "arbitrary", &list,
+ NULL);
+ for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
+ if (!strcasecmp(arbitrary->key, key)) {
+ new_arb = e_card_arbitrary_new();
+ new_arb->key = g_strdup(key);
+ new_arb->type = g_strdup(type);
+ new_arb->value = g_strdup(value);
+ e_card_iterator_set(iterator, new_arb);
+ e_card_arbitrary_free(new_arb);
+ return;
+ }
+ }
+ new_arb = e_card_arbitrary_new();
+ new_arb->key = g_strdup(key);
+ new_arb->type = g_strdup(type);
+ new_arb->value = g_strdup(value);
+ e_card_list_append(list, new_arb);
+ e_card_arbitrary_free(new_arb);
+ }
+}
+