diff options
-rw-r--r-- | addressbook/ChangeLog | 7 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 43 |
2 files changed, 37 insertions, 13 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d7d2cf1a15..748c8a0c4e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2000-07-25 Christopher James Lahey <clahey@helixcode.com> + + * backend/ebook/e-card.c: Added a #define for + "X-EVOLUTION-PILOTID". Added a parse_pilot_id to read pilot id's + in properly from VCards. Rearranged some field orders. Added a + get_arg case for ARG_PILOTID. Initialize pilot_id field to 0. + 2000-07-24 Chris Toshok <toshok@helixcode.com> * backend/ebook/e-card.h: add pilot_id. diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 97574303ac..26f5df0f67 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -25,6 +25,7 @@ #define str_val(obj) (the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1)) #define has(obj,prop) (vo = isAPropertyOf ((obj), (prop))) +#define XEV_PILOT_ID "X-EVOLUTION-PILOTID" #define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY" /* Object argument IDs */ @@ -54,9 +55,9 @@ enum { ARG_NOTE, ARG_CATEGORIES, ARG_CATEGORY_LIST, + ARG_PILOTID, ARG_ARBITRARY, ARG_ID, - ARG_PILOTID }; #if 0 @@ -97,6 +98,7 @@ 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_pilot_id(ECard *card, VObject *object); static void parse_arbitrary(ECard *card, VObject *object); static void parse_id(ECard *card, VObject *object); @@ -134,6 +136,7 @@ struct { { "FBURL", parse_fburl }, { VCNoteProp, parse_note }, { "CATEGORIES", parse_categories }, + { XEV_PILOT_ID, parse_pilot_id }, { XEV_ARBITRARY, parse_arbitrary }, { VCUniqueStringProp, parse_id } }; @@ -424,6 +427,13 @@ char g_free(string); } + if (card->pilot_id) { + gchar *pilotid_str; + pilotid_str = g_strdup_printf ("%d", card->pilot_id); + addPropValue (vobj, XEV_PILOT_ID, pilotid_str); + g_free (pilotid_str); + } + if (card->arbitrary) { EIterator *iterator; for (iterator = e_list_get_iterator(card->arbitrary); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { @@ -445,13 +455,6 @@ char if (card->id) addPropValue (vobj, VCUniqueStringProp, card->id); - - if (card->pilot_id) { - gchar *pilotid_str; - pilotid_str = g_strdup_printf ("%d", card->pilot_id); - addPropValue (vobj, "X-EVOLUTION-PILOTID", pilotid_str); - g_free (pilotid_str); - } #if 0 @@ -821,6 +824,16 @@ parse_categories(ECard *card, VObject *vobj) } } +static void +parse_pilot_id(ECard *card, VObject *vobj) +{ + if ( vObjectValueType (vobj) ) { + char *str = fakeCString (vObjectUStringZValue (vobj)); + card->pilot_id = atoi(str); + free(str); + } +} + typedef union ValueItem { const char *strs; const wchar_t *ustrs; @@ -974,12 +987,12 @@ 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::pilot_id", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PILOTID); 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); - gtk_object_add_arg_type ("ECard::pilot_id", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PILOTID); object_class->destroy = e_card_destroy; @@ -1402,6 +1415,9 @@ 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_PILOTID: + card->pilot_id = GTK_VALUE_INT(*arg); + break; case ARG_ARBITRARY: if (card->arbitrary) gtk_object_unref(GTK_OBJECT(card->arbitrary)); @@ -1413,9 +1429,6 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) g_free(card->id); card->id = g_strdup(GTK_VALUE_STRING(*arg)); break; - case ARG_PILOTID: - card->pilot_id = GTK_VALUE_INT(*arg); - break; default: return; } @@ -1539,6 +1552,9 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_NOTE: GTK_VALUE_STRING(*arg) = card->note; break; + case ARG_PILOTID: + GTK_VALUE_INT(*arg) = card->pilot_id; + break; case ARG_ARBITRARY: if (!card->arbitrary) card->arbitrary = e_list_new((EListCopyFunc) e_card_arbitrary_copy, @@ -1588,6 +1604,7 @@ e_card_init (ECard *card) card->fburl = NULL; card->note = NULL; card->categories = NULL; + card->pilot_id = 0; card->arbitrary = NULL; #if 0 |