From 12cd9f731c24cd5aea164737584d1f19568e48d7 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 12 Oct 2001 19:29:27 +0000 Subject: Added a boolean type here. 2001-10-12 Christopher James Lahey * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: Added a boolean type here. svn path=/trunk/; revision=13624 --- addressbook/backend/ebook/e-card-simple.c | 29 +++++++++++++++++++++++++++++ addressbook/backend/ebook/e-card-simple.h | 1 + 2 files changed, 30 insertions(+) (limited to 'addressbook/backend') diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c index 2ef73e17f6..5fefbafd65 100644 --- a/addressbook/backend/ebook/e-card-simple.c +++ b/addressbook/backend/ebook/e-card-simple.c @@ -36,6 +36,7 @@ enum _ECardSimpleInternalType { E_CARD_SIMPLE_INTERNAL_TYPE_PHONE, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL, E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL, + E_CARD_SIMPLE_INTERNAL_TYPE_BOOL, }; struct _ECardSimpleFieldData { @@ -793,6 +794,19 @@ char *e_card_simple_get (ECardSimple *simple, string = e_card_simple_get_email(simple, field_data[field].list_type_index); return g_strdup(string); + case E_CARD_SIMPLE_INTERNAL_TYPE_BOOL: + if (simple->card) { + gboolean boole; + gtk_object_get (GTK_OBJECT (simple->card), + field_data[field].ecard_field, &boole, + NULL); + if (boole) + return "true"; + else + return NULL; + } else { + return NULL; + } case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: switch (field) { case E_CARD_SIMPLE_FIELD_NAME_OR_ORG: @@ -1028,6 +1042,18 @@ void e_card_simple_set (ECardSimple *simple, break; case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: break; + case E_CARD_SIMPLE_INTERNAL_TYPE_BOOL: + if (simple->card) { + gboolean boole = TRUE; + if (data == NULL) + boole = FALSE; + else if (strcasecmp (data, "false")) + boole = FALSE; + gtk_object_set (GTK_OBJECT (simple->card), + field_data[field].ecard_field, boole, + NULL); + } + break; } break; } @@ -1045,6 +1071,9 @@ ECardSimpleType e_card_simple_type (ECardSimple *simple, default: return E_CARD_SIMPLE_TYPE_STRING; + case E_CARD_SIMPLE_INTERNAL_TYPE_BOOL: + return E_CARD_SIMPLE_TYPE_BOOL; + case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: return E_CARD_SIMPLE_TYPE_DATE; diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h index 1639e4d71b..886a859928 100644 --- a/addressbook/backend/ebook/e-card-simple.h +++ b/addressbook/backend/ebook/e-card-simple.h @@ -73,6 +73,7 @@ enum _ECardSimpleAddressId { enum _ECardSimpleType { E_CARD_SIMPLE_TYPE_STRING, E_CARD_SIMPLE_TYPE_DATE, + E_CARD_SIMPLE_TYPE_BOOL, }; enum _ECardSimpleField { -- cgit