diff options
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 26 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.h | 5 | ||||
-rw-r--r-- | addressbook/backend/ebook/test-card.c | 7 |
3 files changed, 36 insertions, 2 deletions
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 9c135e4d1f..429e68e832 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -32,6 +32,7 @@ enum { ARG_EMAIL, ARG_BIRTH_DATE, ARG_URL, + ARG_TITLE, ARG_ID }; @@ -59,6 +60,7 @@ static void parse_email(ECard *card, VObject *object); static void parse_phone(ECard *card, VObject *object); static void parse_address(ECard *card, VObject *object); static void parse_url(ECard *card, VObject *object); +static void parse_title(ECard *card, VObject *object); static void parse_id(ECard *card, VObject *object); static ECardPhoneFlags get_phone_flags (VObject *vobj); @@ -80,6 +82,7 @@ struct { { VCTelephoneProp, parse_phone }, { VCAdrProp, parse_address }, { VCURLProp, parse_url }, + { VCTitleProp, parse_title }, { VCUniqueStringProp, parse_id } }; @@ -472,6 +475,14 @@ parse_url(ECard *card, VObject *vobj) } static void +parse_title(ECard *card, VObject *vobj) +{ + if ( card->title ) + g_free(card->title); + assign_string(vobj, &(card->title)); +} + +static void parse_id(ECard *card, VObject *vobj) { if ( card->id ) @@ -525,6 +536,8 @@ e_card_class_init (ECardClass *klass) GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE); gtk_object_add_arg_type ("ECard::url", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL); + gtk_object_add_arg_type ("ECard::title", + GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE); gtk_object_add_arg_type ("ECard::id", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID); @@ -616,6 +629,9 @@ e_card_destroy (GtkObject *object) if (card->url) g_free(card->url); + if (card->title) + g_free(card->title); + if (card->email) gtk_object_unref(GTK_OBJECT(card->email)); if (card->phone) @@ -654,6 +670,11 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) g_free(card->url); card->url = GTK_VALUE_STRING(*arg); break; + case ARG_TITLE: + if ( card->title ) + g_free(card->title); + card->title = GTK_VALUE_STRING(*arg); + break; case ARG_ID: if (card->id) g_free(card->id); @@ -706,6 +727,9 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_URL: GTK_VALUE_STRING(*arg) = card->url; break; + case ARG_TITLE: + GTK_VALUE_STRING(*arg) = card->title; + break; case ARG_ID: GTK_VALUE_STRING(*arg) = card->id; break; @@ -731,13 +755,13 @@ e_card_init (ECard *card) card->phone = NULL; card->address = NULL; card->url = NULL; + card->title = NULL; #if 0 c = g_new0 (ECard, 1); c->fname = c->mailer = - c->title = c->role = c->comment = c->categories = diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index 8eaf235c81..19221488a5 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -43,10 +43,13 @@ struct _ECard { char *url; /* The person's web page. */ ECardDate *bday; /* The person's birthday. */ -#if 0 + +#if 0 ECardOrg *org; /* The person's organization. */ +#endif char *title; /* The person's title w/in his org */ +#if 0 char *role; /* The person's role w/in his org */ ECardPhoto *logo; /* This person's org's logo. */ diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c index 70ced1a8d5..e31495ec3b 100644 --- a/addressbook/backend/ebook/test-card.c +++ b/addressbook/backend/ebook/test-card.c @@ -8,6 +8,8 @@ " \ "N:Friedman;Nat;D;Mr. " \ +"TITLE:Head Geek +" \ "BDAY:1977-08-06 " \ "TEL;WORK:617 679 1984 @@ -60,6 +62,7 @@ main (int argc, char **argv) /* Fields */ char *fname; + char *title; ECardName *name; ECardList *address; ECardList *phone; @@ -92,6 +95,7 @@ main (int argc, char **argv) "address", &address, "phone", &phone, "email", &email, + "title", &title, "birth_date", &bday, NULL); if ( fname ) { @@ -111,6 +115,9 @@ main (int argc, char **argv) if ( name->suffix ) printf(" suffix : %s\n", name->suffix); } + if ( title ) { + printf("Title : %s\n", title); + } if ( bday ) { printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day); } |