aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
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
parent9eda0faddf0309f33b16b4614cc1a037d9431566 (diff)
downloadgsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar
gsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar.gz
gsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar.bz2
gsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar.lz
gsoc2013-evolution-5e14c9cb896ab5077f6aeac383330733e773a00b.tar.xz
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')
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/backend/ebook/e-card-simple.c73
-rw-r--r--addressbook/backend/ebook/e-card-simple.h97
-rw-r--r--addressbook/backend/ebook/e-card-types.h190
-rw-r--r--addressbook/backend/ebook/e-card.c126
-rw-r--r--addressbook/backend/ebook/e-card.h50
-rw-r--r--addressbook/contact-editor/e-contact-editor-categories.c2
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-categories.c2
8 files changed, 303 insertions, 246 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 01a8f0d967..9d231f4308 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2000-05-16 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h:
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);
+ }
+}
+
diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h
index 855747777d..9566248387 100644
--- a/addressbook/backend/ebook/e-card-simple.h
+++ b/addressbook/backend/ebook/e-card-simple.h
@@ -131,54 +131,67 @@ struct _ECardSimple {
struct _ECardSimpleClass {
GtkObjectClass parent_class;
};
+
+typedef void (*ECardSimpleArbitraryCallback) (const ECardArbitrary *arbitrary, gpointer closure);
-ECardSimple *e_card_simple_new (ECard *card);
-char *e_card_simple_get_id (ECardSimple *simple);
-void e_card_simple_set_id (ECardSimple *simple,
- const gchar *character);
-char *e_card_simple_get_vcard (ECardSimple *simple);
-
-ECardSimple *e_card_simple_duplicate (ECardSimple *simple);
-
-char *e_card_simple_get (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_const (ECardSimple *simple,
- ECardSimpleField field);
-void e_card_simple_set (ECardSimple *simple,
- ECardSimpleField field,
- const char *data);
-
-ECardSimpleType e_card_simple_type (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_name (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_short_name (ECardSimple *simple,
- ECardSimpleField field);
+ECardSimple *e_card_simple_new (ECard *card);
+char *e_card_simple_get_id (ECardSimple *simple);
+void e_card_simple_set_id (ECardSimple *simple,
+ const gchar *character);
+char *e_card_simple_get_vcard (ECardSimple *simple);
+
+ECardSimple *e_card_simple_duplicate (ECardSimple *simple);
+
+char *e_card_simple_get (ECardSimple *simple,
+ ECardSimpleField field);
+const char *e_card_simple_get_const (ECardSimple *simple,
+ ECardSimpleField field);
+void e_card_simple_set (ECardSimple *simple,
+ ECardSimpleField field,
+ const char *data);
+
+ECardSimpleType e_card_simple_type (ECardSimple *simple,
+ ECardSimpleField field);
+const char *e_card_simple_get_name (ECardSimple *simple,
+ ECardSimpleField field);
+const char *e_card_simple_get_short_name (ECardSimple *simple,
+ ECardSimpleField field);
/* Use these only if building lists of specific types. It should be
* easier to use the above if you consider a phone field to be the
* same as any other field.
*/
-const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
- ECardSimplePhoneId id);
-const char *e_card_simple_get_email (ECardSimple *simple,
- ECardSimpleEmailId id);
-const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
- ECardSimpleAddressId id);
-void e_card_simple_set_phone (ECardSimple *simple,
- ECardSimplePhoneId id,
- const ECardPhone *phone);
-void e_card_simple_set_email (ECardSimple *simple,
- ECardSimpleEmailId id,
- const char *email);
-void e_card_simple_set_address (ECardSimple *simple,
- ECardSimpleAddressId id,
- const ECardAddrLabel *address);
-
-void e_card_simple_sync_card (ECardSimple *simple);
-
-/* Standard Gtk function */
-GtkType e_card_simple_get_type (void);
+const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
+ ECardSimplePhoneId id);
+const char *e_card_simple_get_email (ECardSimple *simple,
+ ECardSimpleEmailId id);
+const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
+ ECardSimpleAddressId id);
+void e_card_simple_set_phone (ECardSimple *simple,
+ ECardSimplePhoneId id,
+ const ECardPhone *phone);
+void e_card_simple_set_email (ECardSimple *simple,
+ ECardSimpleEmailId id,
+ const char *email);
+void e_card_simple_set_address (ECardSimple *simple,
+ ECardSimpleAddressId id,
+ const ECardAddrLabel *address);
+
+void e_card_simple_arbitrary_foreach (ECardSimple *simple,
+ ECardSimpleArbitraryCallback *callback,
+ gpointer closure);
+const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple,
+ const char *key);
+/* 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);
+
+void e_card_simple_sync_card (ECardSimple *simple);
+
+/* Standard Gtk function */
+GtkType e_card_simple_get_type (void);
#endif /* ! __E_CARD_SIMPLE_H__ */
diff --git a/addressbook/backend/ebook/e-card-types.h b/addressbook/backend/ebook/e-card-types.h
index eb39565aa6..57aed690aa 100644
--- a/addressbook/backend/ebook/e-card-types.h
+++ b/addressbook/backend/ebook/e-card-types.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors:
* Arturo Espinosa
@@ -9,110 +10,9 @@
#ifndef __E_CARD_TYPES_H__
#define __E_CARD_TYPES_H__
-#if 0
-typedef enum
-{
- PROP_NONE = 0, /* Must always be the first, with value = 0. */
- PROP_CARD = 1,
- PROP_FNAME = 2,
- PROP_NAME = 3,
- PROP_PHOTO = 4,
- PROP_BDAY = 5,
- PROP_DELADDR_LIST = 6,
- PROP_DELADDR = 7,
- PROP_DELLABEL_LIST = 8,
- PROP_DELLABEL = 9,
- PROP_PHONE_LIST = 10,
- PROP_PHONE = 11,
- PROP_EMAIL_LIST = 12,
- PROP_EMAIL = 13,
- PROP_MAILER = 14,
- PROP_TIMEZN = 15,
- PROP_GEOPOS = 16,
- PROP_TITLE = 17,
- PROP_ROLE = 18,
- PROP_LOGO = 19,
- PROP_AGENT = 20,
- PROP_ORG = 21,
- PROP_COMMENT = 22,
- PROP_REV = 23,
- PROP_SOUND = 24,
- PROP_URL = 25,
- PROP_UID = 26,
- PROP_VERSION = 27,
- PROP_KEY = 28,
- PROP_CATEGORIES = 29,
- PROP_XTENSION_LIST = 30,
- PROP_VALUE = 31,
- PROP_ENCODING = 32,
- PROP_QUOTED_PRINTABLE = 33,
- PROP_8BIT = 34,
- PROP_BASE64 = 35,
- PROP_LANG = 36,
- PROP_CHARSET = 37,
- PROP_LAST = 38 /* Must always be the last, with the gratest value. */
-} ECardPropertyType;
-
-typedef enum
-{
- ENC_NONE = 0,
- ENC_BASE64 = 1,
- ENC_QUOTED_PRINTABLE = 2,
- ENC_8BIT = 3,
- ENC_7BIT = 4,
- ENC_LAST = 5
-} ECardEncodeType;
-
-typedef enum
-{
- VAL_NONE = 0,
- VAL_INLINE = 1,
- VAL_CID = 2,
- VAL_URL = 3,
- VAL_LAST = 4
-} ECardValueType;
-
-typedef enum {
- PHOTO_GIF, PHOTO_CGM, PHOTO_WMF, PHOTO_BMP, PHOTO_MET, PHOTO_PMB,
- PHOTO_DIB, PHOTO_PICT, PHOTO_TIFF, PHOTO_PS, PHOTO_PDF, PHOTO_JPEG,
- PHOTO_MPEG, PHOTO_MPEG2, PHOTO_AVI, PHOTO_QTIME
-} ECardPhotoType;
-
-typedef struct {
- gboolean used;
- ECardPropertyType type;
- ECardEncodeType encode;
- ECardValueType value;
- char *charset;
- char *lang;
- GList *xtension;
-
- void *user_data;
-} CardProperty;
-
-typedef struct {
- char *name;
- char *data;
-} CardXAttribute;
-
-typedef struct {
- CardProperty prop;
-
- char *name;
- char *data;
-} ECardXProperty;
-
-typedef struct {
- CardProperty prop;
-
- GList *l;
-} ECardList;
-
-#endif
/* IDENTIFICATION PROPERTIES */
-
typedef struct {
char *prefix; /* Mr. */
char *given; /* John */
@@ -121,17 +21,6 @@ typedef struct {
char *suffix; /* Esq. */
} ECardName;
-#if 0
-typedef struct {
- CardProperty prop;
-
- ECardPhotoType type;
- guint size;
- char *data;
-
-} ECardPhoto;
-#endif
-
typedef struct {
int year;
int month;
@@ -161,22 +50,6 @@ typedef struct {
char *number;
} ECardPhone;
-#if 0
-
-typedef struct {
- int sign; /* 1 or -1 */
- int hours; /* Mexico General is at -6:00 UTC */
- int mins; /* sign -1, hours 6, mins 0 */
-} ECardTimeZone;
-
-typedef struct {
- CardProperty prop;
-
- float lon;
- float lat;
-} ECardGeoPos;
-
-#endif
/* DELIVERY ADDRESSING PROPERTIES */
typedef enum {
@@ -191,61 +64,26 @@ typedef enum {
typedef struct {
ECardAddressFlags flags;
- char *po;
- char *ext;
- char *street;
- char *city;
- char *region;
- char *code;
- char *country;
+ char *po;
+ char *ext;
+ char *street;
+ char *city;
+ char *region;
+ char *code;
+ char *country;
} ECardDeliveryAddress;
typedef struct {
ECardAddressFlags flags;
- char *data;
+ char *data;
} ECardAddrLabel;
-#if 0
-/* ORGANIZATIONAL PROPERTIES */
-
-typedef struct {
- char *name;
- char *unit1;
- char *unit2;
- char *unit3;
- char *unit4;
-} ECardOrg;
-
-typedef enum {
- SOUND_AIFF,
- SOUND_PCM,
- SOUND_WAVE,
- SOUND_PHONETIC
-} ECardSoundType;
-
-typedef enum {
- KEY_X509,
- KEY_PGP
-} ECardKeyType;
-
-typedef struct {
- int utc;
- struct tm tm;
-} ECardRev;
-
-
-typedef struct {
- ECardSoundType type;
- unsigned int size;
- char *data;
-} ECardSound;
+/* ARBITRARY PROPERTIES */
typedef struct {
- CardProperty prop;
-
- ECardKeyType type;
- char *data;
-} ECardKey;
+ char *key;
+ char *type;
+ char *value;
+} ECardArbitrary;
-#endif /* 0 */
#endif /* __E_CARD_TYPES_H__ */
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 6052e7568e..342ab86071 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -25,6 +25,8 @@
#define str_val(obj) (the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1))
#define has(obj,prop) (vo = isAPropertyOf ((obj), (prop)))
+#define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY"
+
/* Object argument IDs */
enum {
ARG_0,
@@ -47,10 +49,12 @@ enum {
ARG_NICKNAME,
ARG_SPOUSE,
ARG_ANNIVERSARY,
+ ARG_MAILER,
ARG_FBURL,
ARG_NOTE,
ARG_CATEGORIES,
ARG_CATEGORY_LIST,
+ ARG_ARBITRARY,
ARG_ID
};
@@ -88,9 +92,11 @@ static void parse_assistant(ECard *card, VObject *object);
static void parse_nickname(ECard *card, VObject *object);
static void parse_spouse(ECard *card, VObject *object);
static void parse_anniversary(ECard *card, VObject *object);
+static void parse_mailer(ECard *card, VObject *object);
static void parse_fburl(ECard *card, VObject *object);
static void parse_note(ECard *card, VObject *object);
static void parse_categories(ECard *card, VObject *object);
+static void parse_arbitrary(ECard *card, VObject *object);
static void parse_id(ECard *card, VObject *object);
static ECardPhoneFlags get_phone_flags (VObject *vobj);
@@ -123,9 +129,11 @@ struct {
{ "NICKNAME", parse_nickname },
{ "X-EVOLUTION-SPOUSE", parse_spouse },
{ "X-EVOLUTION-ANNIVERSARY", parse_anniversary },
+ { VCMailerProp, parse_mailer },
{ "FBURL", parse_fburl },
{ VCNoteProp, parse_note },
{ "CATEGORIES", parse_categories },
+ { XEV_ARBITRARY, parse_arbitrary },
{ VCUniqueStringProp, parse_id }
};
@@ -378,6 +386,10 @@ char
addPropValue(vobj, "X-EVOLUTION-ANNIVERSARY", value);
g_free(value);
}
+
+ if (card->mailer) {
+ addPropValue(vobj, VCMailerProp, card->mailer);
+ }
if (card->fburl)
addPropValue(vobj, "FBURL", card->fburl);
@@ -411,6 +423,22 @@ char
g_free(string);
}
+ if (card->arbitrary) {
+ ECardIterator *iterator;
+ for (iterator = e_card_list_get_iterator(card->arbitrary); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
+ VObject *arb_object;
+ if (arbitrary->value)
+ arb_object = addPropValue (vobj, XEV_ARBITRARY, arbitrary->value);
+ else
+ arb_object = addProp (vobj, XEV_ARBITRARY);
+ if (arbitrary->type)
+ addPropValue (arb_object, "TYPE", arbitrary->type);
+ if (arbitrary->key)
+ addProp (arb_object, arbitrary->key);
+ }
+ }
+
if (card->id)
addPropValue (vobj, VCUniqueStringProp, card->id);
@@ -434,8 +462,6 @@ char
}
}
- add_CardStrProperty (vobj, VCMailerProp, &crd->mailer);
-
if (crd->timezn.prop.used) {
char *str;
@@ -698,6 +724,14 @@ parse_anniversary(ECard *card, VObject *vobj)
}
static void
+parse_mailer(ECard *card, VObject *vobj)
+{
+ if ( card->mailer )
+ g_free(card->mailer);
+ assign_string(vobj, &(card->mailer));
+}
+
+static void
parse_fburl(ECard *card, VObject *vobj)
{
g_free(card->fburl);
@@ -778,6 +812,33 @@ parse_categories(ECard *card, VObject *vobj)
}
static void
+parse_arbitrary(ECard *card, VObject *vobj)
+{
+ ECardArbitrary *arbitrary = e_card_arbitrary_new();
+ VObjectIterator iterator;
+ ECardList *list;
+ for ( initPropIterator (&iterator, vobj); moreIteration(&iterator); ) {
+ VObject *temp = nextVObject(&iterator);
+ const char *name = vObjectName(temp);
+ if (name && !strcmp(name, "TYPE")) {
+ g_free(arbitrary->type);
+ assign_string(temp, &(arbitrary->type));
+ } else {
+ g_free(arbitrary->key);
+ assign_string(temp, &(arbitrary->key));
+ }
+ }
+
+ assign_string(vobj, &(arbitrary->value));
+
+ gtk_object_get(GTK_OBJECT(card),
+ "arbitrary", &list,
+ NULL);
+ e_card_list_append(list, arbitrary);
+ e_card_arbitrary_free(arbitrary);
+}
+
+static void
parse_id(ECard *card, VObject *vobj)
{
if ( card->id )
@@ -876,6 +937,8 @@ e_card_class_init (ECardClass *klass)
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE);
gtk_object_add_arg_type ("ECard::anniversary",
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY);
+ gtk_object_add_arg_type ("ECard::mailer",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MAILER);
gtk_object_add_arg_type ("ECard::fburl",
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL);
gtk_object_add_arg_type ("ECard::note",
@@ -884,6 +947,8 @@ e_card_class_init (ECardClass *klass)
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CATEGORIES);
gtk_object_add_arg_type ("ECard::category_list",
GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CATEGORY_LIST);
+ gtk_object_add_arg_type ("ECard::arbitrary",
+ GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_ARBITRARY);
gtk_object_add_arg_type ("ECard::id",
GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID);
@@ -1133,6 +1198,37 @@ e_card_name_from_string(const char *full_name)
return name;
}
+ECardArbitrary *
+e_card_arbitrary_new(void)
+{
+ ECardArbitrary *arbitrary = g_new(ECardArbitrary, 1);
+ arbitrary->key = NULL;
+ arbitrary->type = NULL;
+ arbitrary->value = NULL;
+ return arbitrary;
+}
+
+ECardArbitrary *
+e_card_arbitrary_copy(const ECardArbitrary *arbitrary)
+{
+ ECardArbitrary *arb_copy = g_new(ECardArbitrary, 1);
+ arb_copy->key = g_strdup(arbitrary->key);
+ arb_copy->type = g_strdup(arbitrary->type);
+ arb_copy->value = g_strdup(arbitrary->value);
+ return arb_copy;
+}
+
+void
+e_card_arbitrary_free(ECardArbitrary *arbitrary)
+{
+ if (arbitrary) {
+ g_free(arbitrary->key);
+ g_free(arbitrary->type);
+ g_free(arbitrary->value);
+ }
+ g_free(arbitrary);
+}
+
/*
* ECard lifecycle management and vCard loading/saving.
*/
@@ -1259,6 +1355,10 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
g_free(card->anniversary);
card->anniversary = GTK_VALUE_POINTER(*arg);
break;
+ case ARG_MAILER:
+ g_free(card->mailer);
+ card->mailer = g_strdup(GTK_VALUE_STRING(*arg));
+ break;
case ARG_FBURL:
g_free(card->fburl);
card->fburl = g_strdup(GTK_VALUE_STRING(*arg));
@@ -1267,6 +1367,13 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
g_free (card->note);
card->note = g_strdup(GTK_VALUE_STRING(*arg));
break;
+ case ARG_ARBITRARY:
+ if (card->arbitrary)
+ gtk_object_unref(GTK_OBJECT(card->arbitrary));
+ card->arbitrary = E_CARD_LIST(GTK_VALUE_OBJECT(*arg));
+ if (card->arbitrary)
+ gtk_object_ref(GTK_OBJECT(card->arbitrary));
+ break;
case ARG_ID:
g_free(card->id);
card->id = g_strdup(GTK_VALUE_STRING(*arg));
@@ -1385,12 +1492,23 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_ANNIVERSARY:
GTK_VALUE_POINTER(*arg) = card->anniversary;
break;
+ case ARG_MAILER:
+ GTK_VALUE_STRING(*arg) = card->mailer;
+ break;
case ARG_FBURL:
GTK_VALUE_STRING(*arg) = card->fburl;
break;
case ARG_NOTE:
GTK_VALUE_STRING(*arg) = card->note;
break;
+ case ARG_ARBITRARY:
+ if (!card->arbitrary)
+ card->arbitrary = e_card_list_new((ECardListCopyFunc) e_card_arbitrary_copy,
+ (ECardListFreeFunc) e_card_arbitrary_free,
+ NULL);
+
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->arbitrary);
+ break;
case ARG_ID:
GTK_VALUE_STRING(*arg) = card->id;
break;
@@ -1428,9 +1546,11 @@ e_card_init (ECard *card)
card->nickname = NULL;
card->spouse = NULL;
card->anniversary = NULL;
+ card->mailer = NULL;
card->fburl = NULL;
card->note = NULL;
card->categories = NULL;
+ card->arbitrary = NULL;
#if 0
c = g_new0 (ECard, 1);
@@ -3093,7 +3213,7 @@ set_address_flags (VObject *vobj, ECardAddressFlags flags)
for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) {
if (flags & addr_pairs[i].flag) {
- addProp (vobj, addr_pairs[i].id);
+ addProp (vobj, addr_pairs[i].id);
}
}
}
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
index b34ab2cd54..9f10a984ed 100644
--- a/addressbook/backend/ebook/e-card.h
+++ b/addressbook/backend/ebook/e-card.h
@@ -61,10 +61,14 @@ struct _ECard {
char *spouse; /* The person's spouse. */
ECardDate *anniversary; /* The person's anniversary. */
+ char *mailer; /* Mailer */
+
char *fburl; /* Free Busy URL */
ECardList *categories; /* Categories. */
+ ECardList *arbitrary; /* Arbitrary fields. */
+
#if 0
ECardPhoto *logo; /* This person's org's logo. */
@@ -83,8 +87,6 @@ struct _ECard {
ECardTimeZone *timezn; /* The person's time zone. */
ECardGeoPos *geopos; /* The person's long/lat. */
- char *mailer; /* The user's mailer. */
-
ECardRev *rev; /* The time this card was last
modified. */
@@ -98,32 +100,36 @@ struct _ECardClass {
};
-ECard *e_card_new (char *vcard);
-char *e_card_get_id (ECard *card);
-void e_card_set_id (ECard *card, const gchar *character);
-char *e_card_get_vcard (ECard *card);
+ECard *e_card_new ( char *vcard);
+char *e_card_get_id ( ECard *card);
+void e_card_set_id ( ECard *card,
+ const char *character);
+char *e_card_get_vcard ( ECard *card);
+ECard *e_card_duplicate ( ECard *card);
-ECard *e_card_duplicate (ECard *card);
-
-ECardPhone *e_card_phone_new (void);
-void e_card_phone_free (ECardPhone *phone);
+ECardPhone *e_card_phone_new (void);
ECardPhone *e_card_phone_copy (const ECardPhone *phone);
+void e_card_phone_free ( ECardPhone *phone);
-ECardDeliveryAddress *e_card_delivery_address_new (void);
-void e_card_delivery_address_free (ECardDeliveryAddress *addr);
-ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr);
-char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr);
-char *e_card_delivery_address_from_string (const ECardDeliveryAddress *addr);
+ECardDeliveryAddress *e_card_delivery_address_new (void);
+ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr);
+void e_card_delivery_address_free ( ECardDeliveryAddress *addr);
+char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr);
+ECardDeliveryAddress *e_card_delivery_address_from_string (const char *full_addr);
-ECardAddrLabel *e_card_address_label_new (void);
-void e_card_address_label_free (ECardAddrLabel *addr);
+ECardAddrLabel *e_card_address_label_new (void);
ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr);
+void e_card_address_label_free ( ECardAddrLabel *addr);
+
+ECardName *e_card_name_new (void);
+ECardName *e_card_name_copy (const ECardName *name);
+void e_card_name_free ( ECardName *name);
+char *e_card_name_to_string (const ECardName *name);
+ECardName *e_card_name_from_string (const char *full_name);
-ECardName *e_card_name_new (void);
-void e_card_name_free(ECardName *name);
-ECardName *e_card_name_copy (const ECardName *name);
-char *e_card_name_to_string(const ECardName *name);
-ECardName *e_card_name_from_string(const char *full_name);
+ECardArbitrary *e_card_arbitrary_new (void);
+ECardArbitrary *e_card_arbitrary_copy (const ECardArbitrary *arbitrary);
+void e_card_arbitrary_free ( ECardArbitrary *arbitrary);
/* Standard Gtk function */
GtkType e_card_get_type (void);
diff --git a/addressbook/contact-editor/e-contact-editor-categories.c b/addressbook/contact-editor/e-contact-editor-categories.c
index 8355c9cd96..3287672861 100644
--- a/addressbook/contact-editor/e-contact-editor-categories.c
+++ b/addressbook/contact-editor/e-contact-editor-categories.c
@@ -290,7 +290,7 @@ e_contact_editor_categories_init (EContactEditorCategories *categories)
e_table = e_table_new (header, categories->model, INITIAL_SPEC);
- gtk_object_sink(categories->model);
+ gtk_object_sink(GTK_OBJECT(categories->model));
gtk_widget_show(e_table);
diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.c b/addressbook/gui/contact-editor/e-contact-editor-categories.c
index 8355c9cd96..3287672861 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-categories.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-categories.c
@@ -290,7 +290,7 @@ e_contact_editor_categories_init (EContactEditorCategories *categories)
e_table = e_table_new (header, categories->model, INITIAL_SPEC);
- gtk_object_sink(categories->model);
+ gtk_object_sink(GTK_OBJECT(categories->model));
gtk_widget_show(e_table);