From 270ca5fae4e9775d3c19195132566a6273280794 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 26 Jul 2000 00:05:34 +0000 Subject: add enum for e-card pilot status. 2000-07-25 Chris Toshok * backend/ebook/e-card-types.h: add enum for e-card pilot status. * conduit/address-conduit.c: #ifdef out all the archiving code with SUPPORT_ARCHIVING. (purge): implement correctly - deleting ecards whose pilot status is DELETED. (set_status): implement. (set_pilot_id): add gtk_main call here to change commit_card into a synchronous (delete_all): implement correctly - don't delete the records, just set their status to DELETED. (local_record_from_ecard): get the current status from the ecard. * backend/ebook/e-card.c (e_card_get_vcard): add vcard support for pilot status. (parse_pilot_status): new function. (e_card_class_init): add pilot status object arg. (e_card_set_arg): add pilot status support. (e_card_get_arg): same. (e_card_init): initialize pilot_status to 0. svn path=/trunk/; revision=4340 --- addressbook/backend/ebook/e-card-types.h | 8 ++++++++ addressbook/backend/ebook/e-card.c | 30 ++++++++++++++++++++++++++++++ addressbook/backend/ebook/e-card.h | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'addressbook/backend') diff --git a/addressbook/backend/ebook/e-card-types.h b/addressbook/backend/ebook/e-card-types.h index 57aed690aa..a2563d4bf6 100644 --- a/addressbook/backend/ebook/e-card-types.h +++ b/addressbook/backend/ebook/e-card-types.h @@ -86,4 +86,12 @@ typedef struct { char *value; } ECardArbitrary; +/* PILOT SYNC STATUS */ + +enum { + E_CARD_PILOT_STATUS_NONE, + E_CARD_PILOT_STATUS_MOD, + E_CARD_PILOT_STATUS_DEL +}; + #endif /* __E_CARD_TYPES_H__ */ diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 26f5df0f67..8008e052ba 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -26,6 +26,7 @@ #define has(obj,prop) (vo = isAPropertyOf ((obj), (prop))) #define XEV_PILOT_ID "X-EVOLUTION-PILOTID" +#define XEV_PILOT_STATUS "X-EVOLUTION-PILOTSTATUS" #define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY" /* Object argument IDs */ @@ -56,6 +57,7 @@ enum { ARG_CATEGORIES, ARG_CATEGORY_LIST, ARG_PILOTID, + ARG_PILOTSTATUS, ARG_ARBITRARY, ARG_ID, }; @@ -99,6 +101,7 @@ 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_pilot_status(ECard *card, VObject *object); static void parse_arbitrary(ECard *card, VObject *object); static void parse_id(ECard *card, VObject *object); @@ -137,6 +140,7 @@ struct { { VCNoteProp, parse_note }, { "CATEGORIES", parse_categories }, { XEV_PILOT_ID, parse_pilot_id }, + { XEV_PILOT_STATUS, parse_pilot_status }, { XEV_ARBITRARY, parse_arbitrary }, { VCUniqueStringProp, parse_id } }; @@ -434,6 +438,13 @@ char g_free (pilotid_str); } + if (card->pilot_status) { + gchar *pilotstatus_str; + pilotstatus_str = g_strdup_printf ("%d", card->pilot_status); + addPropValue (vobj, XEV_PILOT_STATUS, pilotstatus_str); + g_free (pilotstatus_str); + } + if (card->arbitrary) { EIterator *iterator; for (iterator = e_list_get_iterator(card->arbitrary); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { @@ -834,6 +845,16 @@ parse_pilot_id(ECard *card, VObject *vobj) } } +static void +parse_pilot_status(ECard *card, VObject *vobj) +{ + if ( vObjectValueType (vobj) ) { + char *str = fakeCString (vObjectUStringZValue (vobj)); + card->pilot_status = atoi(str); + free(str); + } +} + typedef union ValueItem { const char *strs; const wchar_t *ustrs; @@ -989,6 +1010,8 @@ e_card_class_init (ECardClass *klass) 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::pilot_status", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PILOTSTATUS); gtk_object_add_arg_type ("ECard::arbitrary", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_ARBITRARY); gtk_object_add_arg_type ("ECard::id", @@ -1418,6 +1441,9 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_PILOTID: card->pilot_id = GTK_VALUE_INT(*arg); break; + case ARG_PILOTSTATUS: + card->pilot_status = GTK_VALUE_INT(*arg); + break; case ARG_ARBITRARY: if (card->arbitrary) gtk_object_unref(GTK_OBJECT(card->arbitrary)); @@ -1555,6 +1581,9 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_PILOTID: GTK_VALUE_INT(*arg) = card->pilot_id; break; + case ARG_PILOTSTATUS: + GTK_VALUE_INT(*arg) = card->pilot_status; + break; case ARG_ARBITRARY: if (!card->arbitrary) card->arbitrary = e_list_new((EListCopyFunc) e_card_arbitrary_copy, @@ -1605,6 +1634,7 @@ e_card_init (ECard *card) card->note = NULL; card->categories = NULL; card->pilot_id = 0; + card->pilot_status = 0; card->arbitrary = NULL; #if 0 diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index 89ee88388c..5b122ad550 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -70,7 +70,7 @@ struct _ECard { EList *arbitrary; /* Arbitrary fields. */ guint32 pilot_id; /* id of the corresponding pilot */ - + guint32 pilot_status; /* status information */ #if 0 ECardPhoto *logo; /* This person's org's logo. */ -- cgit v1.2.3