diff options
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 78 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.h | 7 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-card.c | 15 |
3 files changed, 98 insertions, 2 deletions
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index bc5b253b17..180b5308fc 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -33,8 +33,11 @@ enum { ARG_BIRTH_DATE, ARG_URL, ARG_ORG, + ARG_ORG_UNIT, ARG_TITLE, ARG_ROLE, + ARG_NICKNAME, + ARG_FBURL, ARG_NOTE, ARG_ID }; @@ -66,6 +69,8 @@ static void parse_url(ECard *card, VObject *object); static void parse_org(ECard *card, VObject *object); static void parse_title(ECard *card, VObject *object); static void parse_role(ECard *card, VObject *object); +static void parse_nickname(ECard *card, VObject *object); +static void parse_fburl(ECard *card, VObject *object); static void parse_note(ECard *card, VObject *object); static void parse_id(ECard *card, VObject *object); @@ -91,6 +96,8 @@ struct { { VCOrgProp, parse_org }, { VCTitleProp, parse_title }, { VCBusinessRoleProp, parse_role }, + { "NICKNAME", parse_nickname }, + { "FBURL", parse_fburl }, { VCNoteProp, parse_note }, { VCUniqueStringProp, parse_id } }; @@ -281,12 +288,14 @@ char if (card->url) addPropValue(vobj, VCURLProp, card->url); - if (card->org) { + if (card->org || card->org_unit) { VObject *orgprop; orgprop = addProp(vobj, VCOrgProp); if (card->org) addPropValue(orgprop, VCOrgNameProp, card->org); + if (card->org_unit) + addPropValue(orgprop, VCOrgUnitProp, card->org_unit); } if (card->title) @@ -295,6 +304,12 @@ char if (card->role) addPropValue(vobj, VCBusinessRoleProp, card->role); + if (card->nickname) + addPropValue(vobj, "NICKNAME", card->nickname); + + if (card->fburl) + addPropValue(vobj, "FBURL", card->fburl); + if (card->note) addPropValue(vobj, VCNoteProp, card->note); @@ -510,6 +525,12 @@ parse_org(ECard *card, VObject *vobj) g_free(card->org); card->org = temp; } + temp = e_v_object_get_child_value(vobj, VCOrgUnitProp); + if (temp) { + if (card->org_unit) + g_free(card->org_unit); + card->org_unit = temp; + } } static void @@ -529,6 +550,22 @@ parse_role(ECard *card, VObject *vobj) } static void +parse_nickname(ECard *card, VObject *vobj) +{ + if (card->nickname) + g_free(card->nickname); + assign_string(vobj, &(card->nickname)); +} + +static void +parse_fburl(ECard *card, VObject *vobj) +{ + if (card->fburl) + g_free(card->fburl); + assign_string(vobj, &(card->fburl)); +} + +static void parse_note(ECard *card, VObject *vobj) { if (card->note) @@ -592,10 +629,16 @@ e_card_class_init (ECardClass *klass) GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL); gtk_object_add_arg_type ("ECard::org", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG); + gtk_object_add_arg_type ("ECard::org_unit", + GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT); gtk_object_add_arg_type ("ECard::title", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE); gtk_object_add_arg_type ("ECard::role", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE); + gtk_object_add_arg_type ("ECard::nickname", + GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME); + gtk_object_add_arg_type ("ECard::fburl", + GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL); gtk_object_add_arg_type ("ECard::note", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE); gtk_object_add_arg_type ("ECard::id", @@ -690,10 +733,16 @@ e_card_destroy (GtkObject *object) g_free(card->url); if (card->org) g_free(card->org); + if (card->org_unit) + g_free(card->org_unit); if (card->title) g_free(card->title); if (card->role) g_free(card->role); + if (card->nickname) + g_free(card->nickname); + if (card->fburl) + g_free(card->fburl); if (card->note) g_free(card->note); @@ -740,6 +789,11 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) g_free(card->org); card->org = g_strdup(GTK_VALUE_STRING(*arg)); break; + case ARG_ORG_UNIT: + if (card->org_unit) + g_free(card->org_unit); + card->org_unit = g_strdup(GTK_VALUE_STRING(*arg)); + break; case ARG_TITLE: if ( card->title ) g_free(card->title); @@ -750,6 +804,16 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) g_free(card->role); card->role = g_strdup(GTK_VALUE_STRING(*arg)); break; + case ARG_NICKNAME: + if (card->nickname) + g_free(card->nickname); + card->nickname = g_strdup(GTK_VALUE_STRING(*arg)); + break; + case ARG_FBURL: + if (card->fburl) + g_free(card->fburl); + card->fburl = g_strdup(GTK_VALUE_STRING(*arg)); + break; case ARG_NOTE: if (card->note) g_free (card->note); @@ -810,12 +874,21 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_ORG: GTK_VALUE_STRING(*arg) = card->org; break; + case ARG_ORG_UNIT: + GTK_VALUE_STRING(*arg) = card->org_unit; + break; case ARG_TITLE: GTK_VALUE_STRING(*arg) = card->title; break; case ARG_ROLE: GTK_VALUE_STRING(*arg) = card->role; break; + case ARG_NICKNAME: + GTK_VALUE_STRING(*arg) = card->nickname; + break; + case ARG_FBURL: + GTK_VALUE_STRING(*arg) = card->fburl; + break; case ARG_NOTE: GTK_VALUE_STRING(*arg) = card->note; break; @@ -845,8 +918,11 @@ e_card_init (ECard *card) card->address = NULL; card->url = NULL; card->org = NULL; + card->org_unit = NULL; card->title = NULL; card->role = NULL; + card->nickname = NULL; + card->fburl = NULL; card->note = NULL; #if 0 diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index e70b3337c2..15a5ca74c7 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -48,9 +48,14 @@ struct _ECard { char *org; /* The person's organization. */ - char *role; /* The person's role w/in his ord */ + char *org_unit; /* The person's organization unit. */ + char *role; /* The person's role w/in his org */ char *title; /* The person's title w/in his org */ + char *nickname; /* The person's nickname */ + + char *fburl; /* Free Busy URL */ + #if 0 ECardOrg *org; /* The person's organization. */ diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c index 598900c9e5..a60569548b 100644 --- a/addressbook/backend/ebook/test-card.c +++ b/addressbook/backend/ebook/test-card.c @@ -67,8 +67,11 @@ main (int argc, char **argv) /* Fields */ char *fname; char *org; + char *org_unit; char *title; char *role; + char *nickname; + char *fburl; ECardName *name; ECardList *address; ECardList *phone; @@ -102,8 +105,11 @@ main (int argc, char **argv) "phone", &phone, "email", &email, "org", &org, + "org_unit", &org_unit, "title", &title, "role", &role, + "nickname", &nickname, + "fburl", &fburl, "birth_date", &bday, NULL); if ( fname ) { @@ -126,12 +132,21 @@ main (int argc, char **argv) if ( org ) { printf("Company : %s\n", org); } + if ( org_unit ) { + printf("Department : %s\n", org_unit); + } if ( title ) { printf("Title : %s\n", title); } if ( role ) { printf("Profession : %s\n", role); } + if ( nickname ) { + printf("Nickname : %s\n", nickname); + } + if ( fburl ) { + printf("Free Busy URL : %s\n", fburl); + } if ( bday ) { printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day); } |