diff options
-rw-r--r-- | addressbook/ChangeLog | 13 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 73 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.h | 8 |
3 files changed, 94 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index c56c8b395f..5ca176dff7 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,16 @@ +2001-06-28 Chris Toshok <toshok@ximian.com> + + * backend/ebook/e-card.c (e_card_get_vobject): add support for + X-EVOLUTION-LIST and X-EVOLUTION-LIST-SHOW-ADDRESSES. + (parse_list): new function, parse the boolean X-EVOLUTION-LIST. + (parse_list_show_addresses): new function, parse the boolean + X-EVOLUTION-LIST-SHOW-ADDRESSES. + (e_card_class_init): add args for "list" and + "list_show_addresses". + (e_card_set_arg): add support for list and list_show_addresses. + (e_card_get_arg): same. + (e_card_init): init list and list_show_addresses. + 2001-06-27 Ettore Perazzoli <ettore@ximian.com> * gui/component/addressbook-component.c (factory_fn): Pass NULL as diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 7131107fa9..d80cd63369 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -33,6 +33,8 @@ #define XEV_WANTS_HTML "X-MOZILLA-HTML" #define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY" +#define XEV_LIST "X-EVOLUTION-LIST" +#define XEV_LIST_SHOW_ADDRESSES "X-EVOLUTION-LIST-SHOW_ADDRESSES" /* Object argument IDs */ enum { @@ -63,6 +65,8 @@ enum { ARG_CATEGORY_LIST, ARG_WANTS_HTML, ARG_WANTS_HTML_SET, + ARG_EVOLUTION_LIST, + ARG_EVOLUTION_LIST_SHOW_ADDRESSES, ARG_ARBITRARY, ARG_ID, }; @@ -106,6 +110,8 @@ 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_wants_html(ECard *card, VObject *object); +static void parse_list(ECard *card, VObject *object); +static void parse_list_show_addresses(ECard *card, VObject *object); static void parse_arbitrary(ECard *card, VObject *object); static void parse_id(ECard *card, VObject *object); @@ -145,6 +151,8 @@ struct { { "CATEGORIES", parse_categories }, { XEV_WANTS_HTML, parse_wants_html }, { XEV_ARBITRARY, parse_arbitrary }, + { XEV_LIST, parse_list }, + { XEV_LIST_SHOW_ADDRESSES, parse_list_show_addresses }, { VCUniqueStringProp, parse_id } }; @@ -446,6 +454,11 @@ e_card_get_vobject (ECard *card) addPropValue (vobj, XEV_WANTS_HTML, card->wants_html ? "TRUE" : "FALSE"); } + if (card->list) { + addPropValue (vobj, XEV_LIST, "TRUE"); + addPropValue (vobj, XEV_LIST_SHOW_ADDRESSES, card->list_show_addresses ? "TRUE" : "FALSE"); + } + if (card->arbitrary) { EIterator *iterator; for (iterator = e_list_get_iterator(card->arbitrary); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { @@ -893,6 +906,36 @@ parse_wants_html(ECard *card, VObject *vobj) } } +static void +parse_list(ECard *card, VObject *vobj) +{ + if ( vObjectValueType (vobj) ) { + char *str = fakeCString (vObjectUStringZValue (vobj)); + if (!strcasecmp(str, "true")) { + card->list = TRUE; + } + if (!strcasecmp(str, "false")) { + card->list = FALSE; + } + free(str); + } +} + +static void +parse_list_show_addresses(ECard *card, VObject *vobj) +{ + if ( vObjectValueType (vobj) ) { + char *str = fakeCString (vObjectUStringZValue (vobj)); + if (!strcasecmp(str, "true")) { + card->list_show_addresses = TRUE; + } + if (!strcasecmp(str, "false")) { + card->list_show_addresses = FALSE; + } + free(str); + } +} + typedef union ValueItem { const char *strs; const wchar_t *ustrs; @@ -1048,6 +1091,10 @@ e_card_class_init (ECardClass *klass) GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WANTS_HTML); gtk_object_add_arg_type ("ECard::wants_html_set", GTK_TYPE_BOOL, GTK_ARG_READABLE, ARG_WANTS_HTML); + gtk_object_add_arg_type ("ECard::list", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EVOLUTION_LIST); + gtk_object_add_arg_type ("ECard::list_show_addresses", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EVOLUTION_LIST_SHOW_ADDRESSES); gtk_object_add_arg_type ("ECard::arbitrary", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_ARBITRARY); gtk_object_add_arg_type ("ECard::id", @@ -1771,6 +1818,12 @@ 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_EVOLUTION_LIST: + card->list = GTK_VALUE_BOOL(*arg); + break; + case ARG_EVOLUTION_LIST_SHOW_ADDRESSES: + card->list_show_addresses = GTK_VALUE_BOOL(*arg); + break; default: return; } @@ -1911,6 +1964,12 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_ID: GTK_VALUE_STRING(*arg) = card->id; break; + case ARG_EVOLUTION_LIST: + GTK_VALUE_BOOL(*arg) = card->list; + break; + case ARG_EVOLUTION_LIST_SHOW_ADDRESSES: + GTK_VALUE_BOOL(*arg) = card->list_show_addresses; + break; default: arg->type = GTK_TYPE_INVALID; break; @@ -1951,6 +2010,8 @@ e_card_init (ECard *card) card->categories = NULL; card->wants_html = FALSE; card->wants_html_set = FALSE; + card->list = FALSE; + card->list_show_addresses = FALSE; card->arbitrary = NULL; #if 0 @@ -3811,3 +3872,15 @@ e_card_send (ECard *card, ECardDisposition disposition) e_card_list_send (list, disposition); g_list_free (list); } + +gboolean +e_card_evolution_list (ECard *card) +{ + return card->list; +} + +gboolean +e_card_evolution_list_show_addresses (ECard *card) +{ + return card->list_show_addresses; +} diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index 0000147a0e..78c6f3d661 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -74,6 +74,10 @@ struct _ECard { guint32 wants_html : 1; /* Wants html mail. */ guint32 wants_html_set : 1; /* Wants html mail. */ + guint32 list : 1; /* If the card corresponds to a contact list */ + guint32 list_show_addresses : 1; /* Whether to show the addresses + in the To: or Bcc: field */ + #if 0 ECardPhoto *logo; /* This person's org's logo. */ @@ -115,6 +119,10 @@ char *e_card_get_vcard (ECard char *e_card_list_get_vcard (GList *list); ECard *e_card_duplicate (ECard *card); +/* Evolution List convenience functions */ +gboolean e_card_evolution_list (ECard *card); +gboolean e_card_evolution_list_show_addresses(ECard *card); + /* ECardPhone manipulation */ ECardPhone *e_card_phone_new (void); ECardPhone *e_card_phone_copy (const ECardPhone *phone); |