evolution r36632 - in trunk/addressbook: . tools
- From: abharath svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36632 - in trunk/addressbook: . tools
- Date: Fri, 17 Oct 2008 05:26:25 +0000 (UTC)
Author: abharath
Date: Fri Oct 17 05:26:25 2008
New Revision: 36632
URL: http://svn.gnome.org/viewvc/evolution?rev=36632&view=rev
Log:
2008-10-17 Milan Crha <mcrha redhat com>
** Fix for bug #511918
* tools/evolution-addressbook-export-list-cards.c:
(struct _EContactCSVFieldData), (csv_field_data[]),
(e_contact_csv_get_data_type), (e_contact_csv_get):
Use TRUE/FALSE texts for boolean values and do not
free returned value for them, otherwise it crashes.
Modified:
trunk/addressbook/ChangeLog
trunk/addressbook/tools/evolution-addressbook-export-list-cards.c
Modified: trunk/addressbook/tools/evolution-addressbook-export-list-cards.c
==============================================================================
--- trunk/addressbook/tools/evolution-addressbook-export-list-cards.c (original)
+++ trunk/addressbook/tools/evolution-addressbook-export-list-cards.c Fri Oct 17 05:26:25 2008
@@ -139,115 +139,96 @@
E_CONTACT_CSV_LAST
};
+typedef enum {
+ DT_STRING,
+ DT_BOOLEAN
+} EContactCSVDataType;
+
struct _EContactCSVFieldData
{
gint csv_field;
gint contact_field;
gchar *csv_name;
+ EContactCSVDataType data_type;
};
#define NOMAP -1
static EContactCSVFieldData csv_field_data[] = {
- {E_CONTACT_CSV_FILE_AS, E_CONTACT_FILE_AS, ""},
- {E_CONTACT_CSV_FULL_NAME, E_CONTACT_CSV_FULL_NAME, ""},
- {E_CONTACT_CSV_EMAIL_1, E_CONTACT_EMAIL_1, ""},
- {E_CONTACT_CSV_EMAIL_2, E_CONTACT_EMAIL_2, ""},
- {E_CONTACT_CSV_EMAIL_3, E_CONTACT_EMAIL_3, ""},
- {E_CONTACT_CSV_EMAIL_4, E_CONTACT_EMAIL_4, ""},
- {E_CONTACT_CSV_PHONE_PRIMARY, E_CONTACT_PHONE_PRIMARY,
- ""},
- {E_CONTACT_CSV_PHONE_ASSISTANT,
- E_CONTACT_PHONE_ASSISTANT, ""},
- {E_CONTACT_CSV_PHONE_BUSINESS,
- E_CONTACT_PHONE_BUSINESS, ""},
- {E_CONTACT_CSV_PHONE_CALLBACK,
- E_CONTACT_PHONE_CALLBACK, ""},
- {E_CONTACT_CSV_PHONE_COMPANY, E_CONTACT_PHONE_COMPANY,
- ""},
- {E_CONTACT_CSV_PHONE_HOME, E_CONTACT_PHONE_HOME, ""},
- {E_CONTACT_CSV_ORG, E_CONTACT_ORG, ""},
+ {E_CONTACT_CSV_FILE_AS, E_CONTACT_FILE_AS, "", DT_STRING},
+ {E_CONTACT_CSV_FULL_NAME, E_CONTACT_CSV_FULL_NAME, "", DT_STRING},
+ {E_CONTACT_CSV_EMAIL_1, E_CONTACT_EMAIL_1, "", DT_STRING},
+ {E_CONTACT_CSV_EMAIL_2, E_CONTACT_EMAIL_2, "", DT_STRING},
+ {E_CONTACT_CSV_EMAIL_3, E_CONTACT_EMAIL_3, "", DT_STRING},
+ {E_CONTACT_CSV_EMAIL_4, E_CONTACT_EMAIL_4, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_PRIMARY, E_CONTACT_PHONE_PRIMARY, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_ASSISTANT, E_CONTACT_PHONE_ASSISTANT, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_BUSINESS, E_CONTACT_PHONE_BUSINESS, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_CALLBACK, E_CONTACT_PHONE_CALLBACK, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_COMPANY, E_CONTACT_PHONE_COMPANY, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_HOME, E_CONTACT_PHONE_HOME, "", DT_STRING},
+ {E_CONTACT_CSV_ORG, E_CONTACT_ORG, "", DT_STRING},
/*E_CONTACT_CSV_ADDRESS_BUSINESS, */
- {E_CONTACT_CSV_ADDRESS_BUSINESS_STREET, NOMAP,
- "Business Address"},
- {E_CONTACT_CSV_ADDRESS_BUSINESS_EXT, NOMAP,
- "Business Address2"},
- {E_CONTACT_CSV_ADDRESS_BUSINESS_CITY, NOMAP,
- "Business Address City"},
- {E_CONTACT_CSV_ADDRESS_BUSINESS_REGION, NOMAP,
- "Business Address State"},
- {E_CONTACT_CSV_ADDRESS_BUSINESS_POSTCODE, NOMAP,
- "Business Address PostCode"},
- {E_CONTACT_CSV_ADDRESS_BUSINESS_COUNTRY, NOMAP,
- "Business Address Country"},
+ {E_CONTACT_CSV_ADDRESS_BUSINESS_STREET, NOMAP, "Business Address", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_BUSINESS_EXT, NOMAP, "Business Address2", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_BUSINESS_CITY, NOMAP, "Business Address City", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_BUSINESS_REGION, NOMAP, "Business Address State", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_BUSINESS_POSTCODE, NOMAP, "Business Address PostCode", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_BUSINESS_COUNTRY, NOMAP, "Business Address Country", DT_STRING},
/*E_CONTACT_CSV_ADDRESS_HOME, */
- {E_CONTACT_CSV_ADDRESS_HOME_STREET, NOMAP, "Home Address"},
- {E_CONTACT_CSV_ADDRESS_HOME_EXT, NOMAP, "Home Address2"},
- {E_CONTACT_CSV_ADDRESS_HOME_CITY, NOMAP, "Home Address City"},
- {E_CONTACT_CSV_ADDRESS_HOME_REGION, NOMAP,
- "Home Address State"},
- {E_CONTACT_CSV_ADDRESS_HOME_POSTCODE, NOMAP,
- "Home Address PostCode"},
- {E_CONTACT_CSV_ADDRESS_HOME_COUNTRY, NOMAP,
- "Home Address Country"},
- {E_CONTACT_CSV_PHONE_MOBILE, E_CONTACT_PHONE_MOBILE,
- ""},
- {E_CONTACT_CSV_PHONE_CAR, E_CONTACT_PHONE_CAR, ""},
- {E_CONTACT_CSV_PHONE_BUSINESS_FAX,
- E_CONTACT_PHONE_BUSINESS_FAX, ""},
- {E_CONTACT_CSV_PHONE_HOME_FAX,
- E_CONTACT_PHONE_HOME_FAX, ""},
- {E_CONTACT_CSV_PHONE_BUSINESS_2,
- E_CONTACT_PHONE_BUSINESS_2, ""},
- {E_CONTACT_CSV_PHONE_HOME_2, E_CONTACT_PHONE_HOME_2,
- ""},
- {E_CONTACT_CSV_PHONE_ISDN, E_CONTACT_PHONE_ISDN, ""},
- {E_CONTACT_CSV_PHONE_OTHER, E_CONTACT_PHONE_OTHER, ""},
- {E_CONTACT_CSV_PHONE_OTHER_FAX,
- E_CONTACT_PHONE_OTHER_FAX, ""},
- {E_CONTACT_CSV_PHONE_PAGER, E_CONTACT_PHONE_PAGER, ""},
- {E_CONTACT_CSV_PHONE_RADIO, E_CONTACT_PHONE_RADIO, ""},
- {E_CONTACT_CSV_PHONE_TELEX, E_CONTACT_PHONE_TELEX, ""},
- {E_CONTACT_CSV_PHONE_TTYTDD, E_CONTACT_PHONE_TTYTDD,
- ""},
+ {E_CONTACT_CSV_ADDRESS_HOME_STREET, NOMAP, "Home Address", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_HOME_EXT, NOMAP, "Home Address2", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_HOME_CITY, NOMAP, "Home Address City", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_HOME_REGION, NOMAP, "Home Address State", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_HOME_POSTCODE, NOMAP, "Home Address PostCode", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_HOME_COUNTRY, NOMAP, "Home Address Country", DT_STRING},
+ {E_CONTACT_CSV_PHONE_MOBILE, E_CONTACT_PHONE_MOBILE, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_CAR, E_CONTACT_PHONE_CAR, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_BUSINESS_FAX, E_CONTACT_PHONE_BUSINESS_FAX, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_HOME_FAX, E_CONTACT_PHONE_HOME_FAX, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_BUSINESS_2, E_CONTACT_PHONE_BUSINESS_2, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_HOME_2, E_CONTACT_PHONE_HOME_2, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_ISDN, E_CONTACT_PHONE_ISDN, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_OTHER, E_CONTACT_PHONE_OTHER, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_OTHER_FAX, E_CONTACT_PHONE_OTHER_FAX, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_PAGER, E_CONTACT_PHONE_PAGER, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_RADIO, E_CONTACT_PHONE_RADIO, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_TELEX, E_CONTACT_PHONE_TELEX, "", DT_STRING},
+ {E_CONTACT_CSV_PHONE_TTYTDD, E_CONTACT_PHONE_TTYTDD, "", DT_STRING},
/*E_CONTACT_CSV_ADDRESS_OTHER, */
- {E_CONTACT_CSV_ADDRESS_OTHER_STREET, NOMAP, "Other Address"},
- {E_CONTACT_CSV_ADDRESS_OTHER_EXT, NOMAP, "Other Address2"},
- {E_CONTACT_CSV_ADDRESS_OTHER_CITY, NOMAP,
- "Other Address City"},
- {E_CONTACT_CSV_ADDRESS_OTHER_REGION, NOMAP,
- "Other Address State"},
- {E_CONTACT_CSV_ADDRESS_OTHER_POSTCODE, NOMAP,
- "Other Address PostCode"},
- {E_CONTACT_CSV_ADDRESS_OTHER_COUNTRY, NOMAP,
- "Other Address Country"},
- {E_CONTACT_CSV_HOMEPAGE_URL, E_CONTACT_HOMEPAGE_URL, ""},
- {E_CONTACT_CSV_ORG_UNIT, E_CONTACT_ORG_UNIT, ""},
- {E_CONTACT_CSV_OFFICE, E_CONTACT_OFFICE, ""},
- {E_CONTACT_CSV_TITLE, E_CONTACT_TITLE, ""},
- {E_CONTACT_CSV_ROLE, E_CONTACT_ROLE, ""},
- {E_CONTACT_CSV_MANAGER, E_CONTACT_MANAGER, ""},
- {E_CONTACT_CSV_ASSISTANT, E_CONTACT_ASSISTANT, ""},
- {E_CONTACT_CSV_NICKNAME, E_CONTACT_NICKNAME, ""},
- {E_CONTACT_CSV_SPOUSE, E_CONTACT_SPOUSE, ""},
- {E_CONTACT_CSV_NOTE, E_CONTACT_NOTE, ""},
- {E_CONTACT_CSV_CALENDAR_URI, E_CONTACT_CALENDAR_URI, ""},
- {E_CONTACT_CSV_FREEBUSY_URL, E_CONTACT_FREEBUSY_URL, ""},
+ {E_CONTACT_CSV_ADDRESS_OTHER_STREET, NOMAP, "Other Address", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_OTHER_EXT, NOMAP, "Other Address2", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_OTHER_CITY, NOMAP, "Other Address City", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_OTHER_REGION, NOMAP, "Other Address State", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_OTHER_POSTCODE, NOMAP, "Other Address PostCode", DT_STRING},
+ {E_CONTACT_CSV_ADDRESS_OTHER_COUNTRY, NOMAP, "Other Address Country", DT_STRING},
+ {E_CONTACT_CSV_HOMEPAGE_URL, E_CONTACT_HOMEPAGE_URL, "", DT_STRING},
+ {E_CONTACT_CSV_ORG_UNIT, E_CONTACT_ORG_UNIT, "", DT_STRING},
+ {E_CONTACT_CSV_OFFICE, E_CONTACT_OFFICE, "", DT_STRING},
+ {E_CONTACT_CSV_TITLE, E_CONTACT_TITLE, "", DT_STRING},
+ {E_CONTACT_CSV_ROLE, E_CONTACT_ROLE, "", DT_STRING},
+ {E_CONTACT_CSV_MANAGER, E_CONTACT_MANAGER, "", DT_STRING},
+ {E_CONTACT_CSV_ASSISTANT, E_CONTACT_ASSISTANT, "", DT_STRING},
+ {E_CONTACT_CSV_NICKNAME, E_CONTACT_NICKNAME, "", DT_STRING},
+ {E_CONTACT_CSV_SPOUSE, E_CONTACT_SPOUSE, "", DT_STRING},
+ {E_CONTACT_CSV_NOTE, E_CONTACT_NOTE, "", DT_STRING},
+ {E_CONTACT_CSV_CALENDAR_URI, E_CONTACT_CALENDAR_URI, "", DT_STRING},
+ {E_CONTACT_CSV_FREEBUSY_URL, E_CONTACT_FREEBUSY_URL, "", DT_STRING},
/*E_CONTACT_ANNIVERSARY, */
- {E_CONTACT_CSV_ANNIVERSARY_YEAR, NOMAP, "Anniversary Year"},
- {E_CONTACT_CSV_ANNIVERSARY_MONTH, NOMAP, "Anniversary Month"},
- {E_CONTACT_CSV_ANNIVERSARY_DAY, NOMAP, "Anniversary Day"},
+ {E_CONTACT_CSV_ANNIVERSARY_YEAR, NOMAP, "Anniversary Year", DT_STRING},
+ {E_CONTACT_CSV_ANNIVERSARY_MONTH, NOMAP, "Anniversary Month", DT_STRING},
+ {E_CONTACT_CSV_ANNIVERSARY_DAY, NOMAP, "Anniversary Day", DT_STRING},
/*E_CONTACT_BIRTH_DATE, */
- {E_CONTACT_CSV_BIRTH_DATE_YEAR, NOMAP, "Birth Year"},
- {E_CONTACT_CSV_BIRTH_DATE_MONTH, NOMAP, "Birth Month"},
- {E_CONTACT_CSV_BIRTH_DATE_DAY, NOMAP, "Birth Day"},
- {E_CONTACT_CSV_MAILER, E_CONTACT_MAILER, ""},
- {E_CONTACT_CSV_NAME_OR_ORG, E_CONTACT_NAME_OR_ORG, ""},
- {E_CONTACT_CSV_CATEGORIES, E_CONTACT_CATEGORIES, ""},
- {E_CONTACT_CSV_FAMILY_NAME, E_CONTACT_FAMILY_NAME, ""},
- {E_CONTACT_CSV_GIVEN_NAME, E_CONTACT_GIVEN_NAME, ""},
- {E_CONTACT_CSV_WANTS_HTML, E_CONTACT_WANTS_HTML, ""},
- {E_CONTACT_CSV_IS_LIST, E_CONTACT_IS_LIST, ""},
- {E_CONTACT_CSV_LAST, NOMAP, ""}
+ {E_CONTACT_CSV_BIRTH_DATE_YEAR, NOMAP, "Birth Year", DT_STRING},
+ {E_CONTACT_CSV_BIRTH_DATE_MONTH, NOMAP, "Birth Month", DT_STRING},
+ {E_CONTACT_CSV_BIRTH_DATE_DAY, NOMAP, "Birth Day", DT_STRING},
+ {E_CONTACT_CSV_MAILER, E_CONTACT_MAILER, "", DT_STRING},
+ {E_CONTACT_CSV_NAME_OR_ORG, E_CONTACT_NAME_OR_ORG, "", DT_STRING},
+ {E_CONTACT_CSV_CATEGORIES, E_CONTACT_CATEGORIES, "", DT_STRING},
+ {E_CONTACT_CSV_FAMILY_NAME, E_CONTACT_FAMILY_NAME, "", DT_STRING},
+ {E_CONTACT_CSV_GIVEN_NAME, E_CONTACT_GIVEN_NAME, "", DT_STRING},
+ {E_CONTACT_CSV_WANTS_HTML, E_CONTACT_WANTS_HTML, "", DT_BOOLEAN},
+ {E_CONTACT_CSV_IS_LIST, E_CONTACT_IS_LIST, "", DT_BOOLEAN},
+ {E_CONTACT_CSV_LAST, NOMAP, "", DT_STRING}
};
@@ -276,6 +257,12 @@
return csv_field_data[csv_field].contact_field;
}
+static EContactCSVDataType
+e_contact_csv_get_data_type (EContactFieldCSV csv_field)
+{
+ return csv_field_data[csv_field].data_type;
+}
+
gchar *
e_contact_csv_get_name (EContactFieldCSV csv_field)
{
@@ -310,8 +297,10 @@
if (contact_field != NOMAP) {
field_value = e_contact_get (contact, contact_field);
+ if (e_contact_csv_get_data_type (csv_field) == DT_BOOLEAN) {
+ field_value = g_strdup ((GPOINTER_TO_INT (field_value)) ? "TRUE" : "FALSE");
+ }
} else {
-
switch (csv_field) {
case E_CONTACT_CSV_ADDRESS_HOME_STREET:
delivery_address = e_contact_get (contact, E_CONTACT_ADDRESS_HOME);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]