Changeset 1199

Show
Ignore:
Timestamp:
08/25/04 01:17:59
Author:
chipx86
Message:

Set person properties when the people are initially created.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/eds-feed/ChangeLog

    r1169 r1199  
     1Wed Aug 25 01:17:36 PDT 2004  Christian Hammond <chipx86@gnupdate.org> 
     2 
     3    * src/main.c: 
     4      - Set person properties when the people are initially created. 
     5 
    16Wed Aug 11 03:34:12 PDT 2004  Christian Hammond <chipx86@gnupdate.org> 
    27 
  • trunk/eds-feed/src/main.c

    r1169 r1199  
    126126 
    127127static void 
     128set_properties(GalagoPerson *person, EContact *contact) 
     129{ 
     130    EContactName *contact_name; 
     131 
     132    contact_name = e_contact_get_const(contact, E_CONTACT_NAME); 
     133 
     134    if (contact_name != NULL) 
     135    { 
     136        if (contact_name->given != NULL && *contact_name->given != '\0') 
     137        { 
     138            galago_person_set_property_string(person, 
     139                                              GALAGO_PERSON_PROP_FIRST_NAME, 
     140                                              contact_name->given); 
     141        } 
     142 
     143        if (contact_name->family != NULL && *contact_name->family != '\0') 
     144        { 
     145            galago_person_set_property_string(person, 
     146                                              GALAGO_PERSON_PROP_LAST_NAME, 
     147                                              contact_name->family); 
     148        } 
     149    } 
     150} 
     151 
     152static void 
    128153contacts_changed_cb(EBookView *book_view, const GList *contacts) 
    129154{ 
     
    133158    { 
    134159        EContact *contact = (EContact *)l->data; 
    135         EContactName *contact_name; 
    136160        GalagoPerson *person; 
    137161        const char *uid; 
    138162 
    139163        uid = e_contact_get_const(contact, E_CONTACT_UID); 
    140         contact_name = e_contact_get_const(contact, E_CONTACT_NAME); 
    141164 
    142165        person = galago_person_new(uid, TRUE); 
    143166 
    144         if (contact_name != NULL) 
    145         { 
    146             if (contact_name->given != NULL && *contact_name->given != '\0') 
    147             { 
    148                 galago_person_set_property_string(person, 
    149                                                   GALAGO_PERSON_PROP_FIRST_NAME, 
    150                                                   contact_name->given); 
    151             } 
    152  
    153             if (contact_name->family != NULL && *contact_name->family != '\0') 
    154             { 
    155                 galago_person_set_property_string(person, 
    156                                                   GALAGO_PERSON_PROP_LAST_NAME, 
    157                                                   contact_name->family); 
    158             } 
    159         } 
     167        set_properties(person, contact); 
    160168 
    161169        add_remove_accounts(person, contact, aim,       E_CONTACT_IM_AIM); 
     
    177185        EContact *contact = (EContact *)l->data; 
    178186        GalagoPerson *person; 
    179         const char *name; 
    180187        const char *uid; 
    181188 
    182         uid  = e_contact_get_const(contact, E_CONTACT_UID); 
    183         name = e_contact_get_const(contact, E_CONTACT_FULL_NAME); 
     189        uid = e_contact_get_const(contact, E_CONTACT_UID); 
    184190 
    185191        person = galago_person_new(uid, TRUE); 
     192 
     193        set_properties(person, contact); 
    186194 
    187195        add_accounts(person, contact, aim,       E_CONTACT_IM_AIM);