Changed the IM account field types from LIST_FIELD to MULTI_LIST_FIELD, as
authorChristian Hammond <chipx86@gnupdate.org>
Mon, 12 Jan 2004 03:17:40 +0000 (03:17 +0000)
committerJP Rosevear <jpr@src.gnome.org>
Mon, 12 Jan 2004 03:17:40 +0000 (03:17 +0000)
2003-01-11  Christian Hammond <chipx86@gnupdate.org>

  * addressbook/libebook/e-contact.[ch]: Changed the IM account field
  types from LIST_FIELD to MULTI_LIST_FIELD, as discussed with Chris
  Toshok. Added convenience fields for WORK and HOME entries for each
  IM account list. Add support for setting LIST_FIELD types.

addressbook/ChangeLog
addressbook/libebook/e-contact.c
addressbook/libebook/e-contact.h

index a1bf3b4..4bd5623 100644 (file)
@@ -1,3 +1,10 @@
+2003-01-11  Christian Hammond <chipx86@gnupdate.org>
+       * addressbook/libebook/e-contact.[ch]: Changed the IM account field
+       types from LIST_FIELD to MULTI_LIST_FIELD, as discussed with Chris
+       Toshok. Added convenience fields for WORK and HOME entries for each
+       IM account list. Add support for setting LIST_FIELD types.
 2004-01-09  Jeffrey Stedfast  <fejj@ximian.com>
 
        * tests/ebook/test-date.c (main): Don't let control reach the end
index 74e348f..d29eb53 100644 (file)
@@ -147,11 +147,42 @@ static EContactFieldInfo field_info[] = {
        BOOLEAN_FIELD        (E_CONTACT_WANTS_HTML, EVC_X_WANTS_HTML, "wants_html", N_("Wants HTML Mail"), FALSE),
 
        /* Instant messaging fields */
-       LIST_FIELD (E_CONTACT_IM_AIM,    EVC_X_AIM,    "im_aim",    N_("AIM Screen Name List"),    FALSE),
-       LIST_FIELD (E_CONTACT_IM_JABBER, EVC_X_JABBER, "im_jabber", N_("Jabber Id List"),          FALSE),
-       LIST_FIELD (E_CONTACT_IM_YAHOO,  EVC_X_YAHOO,  "im_yahoo",  N_("Yahoo! Screen Name List"), FALSE),
-       LIST_FIELD (E_CONTACT_IM_MSN,    EVC_X_MSN,    "im_msn",    N_("MSN Screen Name List"),    FALSE),
-       LIST_FIELD (E_CONTACT_IM_ICQ,    EVC_X_ICQ,    "im_icq",    N_("ICQ Id List"),             FALSE),
+       MULTI_LIST_FIELD (E_CONTACT_IM_AIM,    EVC_X_AIM,    "im_aim",    N_("AIM Screen Name List"),    FALSE),
+       MULTI_LIST_FIELD (E_CONTACT_IM_JABBER, EVC_X_JABBER, "im_jabber", N_("Jabber Id List"),          FALSE),
+       MULTI_LIST_FIELD (E_CONTACT_IM_YAHOO,  EVC_X_YAHOO,  "im_yahoo",  N_("Yahoo! Screen Name List"), FALSE),
+       MULTI_LIST_FIELD (E_CONTACT_IM_MSN,    EVC_X_MSN,    "im_msn",    N_("MSN Screen Name List"),    FALSE),
+       MULTI_LIST_FIELD (E_CONTACT_IM_ICQ,    EVC_X_ICQ,    "im_icq",    N_("ICQ Id List"),             FALSE),
+
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_AIM_HOME_1,    EVC_X_AIM,    "im_aim_home_1",    N_("AIM Home Screen Name 1"),    FALSE, "HOME", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_AIM_HOME_2,    EVC_X_AIM,    "im_aim_home_2",    N_("AIM Home Screen Name 2"),    FALSE, "HOME", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_AIM_HOME_3,    EVC_X_AIM,    "im_aim_home_3",    N_("AIM Home Screen Name 3"),    FALSE, "HOME", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_AIM_WORK_1,    EVC_X_AIM,    "im_aim_work_1",    N_("AIM Work Screen Name 1"),    FALSE, "WORK", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_AIM_WORK_2,    EVC_X_AIM,    "im_aim_work_2",    N_("AIM Work Screen Name 2"),    FALSE, "WORK", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_AIM_WORK_3,    EVC_X_AIM,    "im_aim_work_3",    N_("AIM Work Screen Name 3"),    FALSE, "WORK", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_JABBER_HOME_1, EVC_X_JABBER, "im_jabber_home_1", N_("Jabber Home Id 1"),          FALSE, "HOME", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_JABBER_HOME_2, EVC_X_JABBER, "im_jabber_home_2", N_("Jabber Home Id 2"),          FALSE, "HOME", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_JABBER_HOME_3, EVC_X_JABBER, "im_jabber_home_3", N_("Jabber Home Id 3"),          FALSE, "HOME", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_JABBER_WORK_1, EVC_X_JABBER, "im_jabber_work_1", N_("Jabber Work Id 1"),          FALSE, "WORK", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_JABBER_WORK_2, EVC_X_JABBER, "im_jabber_work_3", N_("Jabber Work Id 2"),          FALSE, "WORK", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_JABBER_WORK_3, EVC_X_JABBER, "im_jabber_work_2", N_("Jabber Work Id 3"),          FALSE, "WORK", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_YAHOO_HOME_1,  EVC_X_YAHOO,  "im_yahoo_home_1",  N_("Yahoo! Home Screen Name 1"), FALSE, "HOME", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_YAHOO_HOME_2,  EVC_X_YAHOO,  "im_yahoo_home_2",  N_("Yahoo! Home Screen Name 2"), FALSE, "HOME", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_YAHOO_HOME_3,  EVC_X_YAHOO,  "im_yahoo_home_3",  N_("Yahoo! Home Screen Name 3"), FALSE, "HOME", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_YAHOO_WORK_1,  EVC_X_YAHOO,  "im_yahoo_work_1",  N_("Yahoo! Work Screen Name 1"), FALSE, "WORK", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_YAHOO_WORK_2,  EVC_X_YAHOO,  "im_yahoo_work_2",  N_("Yahoo! Work Screen Name 2"), FALSE, "WORK", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_YAHOO_WORK_3,  EVC_X_YAHOO,  "im_yahoo_work_3",  N_("Yahoo! Work Screen Name 3"), FALSE, "WORK", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_MSN_HOME_1,    EVC_X_MSN,    "im_msn_home_1",    N_("MSN Home Screen Name 1"),    FALSE, "HOME", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_MSN_HOME_2,    EVC_X_MSN,    "im_msn_home_2",    N_("MSN Home Screen Name 2"),    FALSE, "HOME", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_MSN_HOME_3,    EVC_X_MSN,    "im_msn_home_3",    N_("MSN Home Screen Name 3"),    FALSE, "HOME", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_MSN_WORK_1,    EVC_X_MSN,    "im_msn_work_1",    N_("MSN Work Screen Name 1"),    FALSE, "WORK", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_MSN_WORK_2,    EVC_X_MSN,    "im_msn_work_2",    N_("MSN Work Screen Name 2"),    FALSE, "WORK", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_MSN_WORK_3,    EVC_X_MSN,    "im_msn_work_3",    N_("MSN Work Screen Name 3"),    FALSE, "WORK", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_ICQ_HOME_1,    EVC_X_ICQ,    "im_icq_home_1",    N_("ICQ Home Id 1"),             FALSE, "HOME", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_ICQ_HOME_2,    EVC_X_ICQ,    "im_icq_home_2",    N_("ICQ Home Id 2"),             FALSE, "HOME", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_ICQ_HOME_3,    EVC_X_ICQ,    "im_icq_home_3",    N_("ICQ Home Id 3"),             FALSE, "HOME", 2),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_ICQ_WORK_1,    EVC_X_ICQ,    "im_icq_work_1",    N_("ICQ Work Id 1"),             FALSE, "WORK", 0),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_ICQ_WORK_2,    EVC_X_ICQ,    "im_icq_work_2",    N_("ICQ Work Id 2"),             FALSE, "WORK", 1),
+       ATTR_TYPE_STR_FIELD (E_CONTACT_IM_ICQ_WORK_3,    EVC_X_ICQ,    "im_icq_work_3",    N_("ICQ Work Id 3"),             FALSE, "WORK", 2),
 
        /* Organizational fields */
        LIST_ELEM_STR_FIELD (E_CONTACT_ORG,      EVC_ORG, "org",      N_("Organization"),        FALSE, 0),
@@ -836,6 +867,28 @@ e_contact_set_property (GObject *object,
                                                          g_value_get_string (value));
                }
        }
+       else if (info->t & E_CONTACT_FIELD_TYPE_LIST) {
+               EVCardAttribute *attr;
+               GList *values, *l;
+
+               values = g_value_get_pointer (value);
+
+               attr = e_contact_get_first_attr (contact, info->vcard_field_name);
+
+               if (attr) {
+                       e_vcard_attribute_remove_values (attr);
+
+                       if (!values)
+                               e_vcard_remove_attribute (E_VCARD (contact), attr);
+               }
+               else if (values) {
+                       attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
+                       e_vcard_add_attribute (E_VCARD (contact), attr);
+               }
+
+               for (l = values; l != NULL; l = l->next)
+                       e_vcard_attribute_add_value (attr, l->data);
+       }
        else {
                g_warning ("unhandled attribute `%s'", info->vcard_field_name);
        }
index 3e4a46f..d6420dc 100644 (file)
@@ -108,6 +108,37 @@ typedef enum {
        E_CONTACT_IM_MSN,        /* Multi-valued */
        E_CONTACT_IM_ICQ,        /* Multi-valued */
 
+       E_CONTACT_IM_AIM_HOME_1,     /* Synthetic string field */
+       E_CONTACT_IM_AIM_HOME_2,     /* Synthetic string field */
+       E_CONTACT_IM_AIM_HOME_3,     /* Synthetic string field */
+       E_CONTACT_IM_AIM_WORK_1,     /* Synthetic string field */
+       E_CONTACT_IM_AIM_WORK_2,     /* Synthetic string field */
+       E_CONTACT_IM_AIM_WORK_3,     /* Synthetic string field */
+       E_CONTACT_IM_JABBER_HOME_1,  /* Synthetic string field */
+       E_CONTACT_IM_JABBER_HOME_2,  /* Synthetic string field */
+       E_CONTACT_IM_JABBER_HOME_3,  /* Synthetic string field */
+       E_CONTACT_IM_JABBER_WORK_1,  /* Synthetic string field */
+       E_CONTACT_IM_JABBER_WORK_2,  /* Synthetic string field */
+       E_CONTACT_IM_JABBER_WORK_3,  /* Synthetic string field */
+       E_CONTACT_IM_YAHOO_HOME_1,   /* Synthetic string field */
+       E_CONTACT_IM_YAHOO_HOME_2,   /* Synthetic string field */
+       E_CONTACT_IM_YAHOO_HOME_3,   /* Synthetic string field */
+       E_CONTACT_IM_YAHOO_WORK_1,   /* Synthetic string field */
+       E_CONTACT_IM_YAHOO_WORK_2,   /* Synthetic string field */
+       E_CONTACT_IM_YAHOO_WORK_3,   /* Synthetic string field */
+       E_CONTACT_IM_MSN_HOME_1,     /* Synthetic string field */
+       E_CONTACT_IM_MSN_HOME_2,     /* Synthetic string field */
+       E_CONTACT_IM_MSN_HOME_3,     /* Synthetic string field */
+       E_CONTACT_IM_MSN_WORK_1,     /* Synthetic string field */
+       E_CONTACT_IM_MSN_WORK_2,     /* Synthetic string field */
+       E_CONTACT_IM_MSN_WORK_3,     /* Synthetic string field */
+       E_CONTACT_IM_ICQ_HOME_1,     /* Synthetic string field */
+       E_CONTACT_IM_ICQ_HOME_2,     /* Synthetic string field */
+       E_CONTACT_IM_ICQ_HOME_3,     /* Synthetic string field */
+       E_CONTACT_IM_ICQ_WORK_1,     /* Synthetic string field */
+       E_CONTACT_IM_ICQ_WORK_2,     /* Synthetic string field */
+       E_CONTACT_IM_ICQ_WORK_3,     /* Synthetic string field */
+
        /* Address fields */
        E_CONTACT_ADDRESS,       /* Multi-valued structured (EContactAddress) */
        E_CONTACT_ADDRESS_HOME,  /* synthetic structured field (EContactAddress) */