aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-04-30 02:16:43 +0800
committerChris Lahey <clahey@src.gnome.org>2000-04-30 02:16:43 +0800
commit8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39 (patch)
tree8b84648656eec372429a21410e7ea785338822e7 /addressbook/backend
parent9a5cce66b1781608f1af25f017a8ee46373ad4d2 (diff)
downloadgsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.tar
gsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.tar.gz
gsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.tar.bz2
gsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.tar.lz
gsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.tar.xz
gsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.tar.zst
gsoc2013-evolution-8d848e0e56a38c4da1d9c47ebe2ac3e7d0a7da39.zip
Added e_card_phone_new e_card_delivery_address_new,
2000-04-29 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-card.c, backend/ebook/e-card.h: Added e_card_phone_new e_card_delivery_address_new, e_card_delivery_address_to_string, e_card_name_copy, e_card_name_new, e_card_name_to_string, and made e_card_name_free public. Removed some unused code. * backend/pas/pas-backend-file.c: Fixed a warning. * contact-editor/Makefile.am: Added e-contact-editor-fullname.[ch] and fullname.glade. Added e-name libs and includes. * contact-editor/e-contact-editor-fullname.c, contact-editor/e-contact-editor-fullname.h, contact-editor/fullname-strings.h, contact-editor/fullname.glade: New dialog for editing the fields of a name separately. * contact-editor/e-contact-editor.c, contact-editor/e-contact-editor.h: Create an EContactEditorFullname when you click on the Full Name button. Maintain a parsed name at all times. * gui/component/Makefile.am, gui/minicard/Makefile.am: Added e-name libs. svn path=/trunk/; revision=2683
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/e-card.c206
-rw-r--r--addressbook/backend/ebook/e-card.h32
-rw-r--r--addressbook/backend/pas/pas-book-factory.c2
3 files changed, 168 insertions, 72 deletions
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 1b27ed164e..eea5c16dc1 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -62,7 +62,6 @@ static void e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void assign_string(VObject *vobj, char **string);
-static void e_card_name_free(ECardName *name);
char *e_v_object_get_child_value(VObject *vobj, char *name);
static ECardDate e_card_date_from_string (char *str);
@@ -772,12 +771,23 @@ e_card_class_init (ECardClass *klass)
object_class->set_arg = e_card_set_arg;
}
+ECardPhone *
+e_card_phone_new (void)
+{
+ ECardPhone *newphone = g_new(ECardPhone, 1);
+
+ newphone->number = NULL;
+ newphone->flags = 0;
+
+ return newphone;
+}
+
void
e_card_phone_free (ECardPhone *phone)
{
if ( phone ) {
- if ( phone->number )
- g_free(phone->number);
+ g_free(phone->number);
+
g_free(phone);
}
}
@@ -794,24 +804,35 @@ e_card_phone_copy (const ECardPhone *phone)
return NULL;
}
+ECardDeliveryAddress *
+e_card_delivery_address_new (void)
+{
+ ECardDeliveryAddress *newaddr = g_new(ECardDeliveryAddress, 1);
+
+ newaddr->po = NULL;
+ newaddr->ext = NULL;
+ newaddr->street = NULL;
+ newaddr->city = NULL;
+ newaddr->region = NULL;
+ newaddr->code = NULL;
+ newaddr->country = NULL;
+ newaddr->flags = 0;
+
+ return newaddr;
+}
+
void
e_card_delivery_address_free (ECardDeliveryAddress *addr)
{
if ( addr ) {
- if ( addr->po )
- g_free(addr->po);
- if ( addr->ext )
- g_free(addr->ext);
- if ( addr->street )
- g_free(addr->street);
- if ( addr->city )
- g_free(addr->city);
- if ( addr->region )
- g_free(addr->region);
- if ( addr->code )
- g_free(addr->code);
- if ( addr->country )
- g_free(addr->country);
+ g_free(addr->po);
+ g_free(addr->ext);
+ g_free(addr->street);
+ g_free(addr->city);
+ g_free(addr->region);
+ g_free(addr->code);
+ g_free(addr->country);
+
g_free(addr);
}
}
@@ -834,12 +855,66 @@ e_card_delivery_address_copy (const ECardDeliveryAddress *addr)
return NULL;
}
+char *
+e_card_delivery_address_to_string(const ECardDeliveryAddress *addr)
+{
+ char *strings[4], **stringptr = strings;
+ char *line1, *line22, *line2;
+ char *final;
+ if (addr->po && *addr->po)
+ *(stringptr++) = addr->po;
+ if (addr->street && *addr->street)
+ *(stringptr++) = addr->street;
+ if (addr->ext && *addr->ext)
+ *(stringptr++) = addr->ext;
+ *stringptr = NULL;
+ line1 = g_strjoinv(" ", strings);
+ stringptr = strings;
+ if (addr->region && *addr->region)
+ *(stringptr++) = addr->region;
+ if (addr->code && *addr->code)
+ *(stringptr++) = addr->code;
+ *stringptr = NULL;
+ line22 = g_strjoinv(" ", strings);
+ stringptr = strings;
+ if (addr->city && *addr->city)
+ *(stringptr++) = addr->city;
+ if (line22 && *line22)
+ *(stringptr++) = line22;
+ *stringptr = NULL;
+ line2 = g_strjoinv(", ", strings);
+ stringptr = strings;
+ if (line1 && *line1)
+ *(stringptr++) = line1;
+ if (line2 && *line2)
+ *(stringptr++) = line2;
+ if (addr->country && *addr->country)
+ *(stringptr++) = addr->country;
+ *stringptr = NULL;
+ final = g_strjoinv("\n", strings);
+ g_free(line1);
+ g_free(line22);
+ g_free(line2);
+ return final;
+}
+
+ECardAddrLabel *
+e_card_address_label_new (void)
+{
+ ECardAddrLabel *newaddr = g_new(ECardAddrLabel, 1);
+
+ newaddr->data = NULL;
+ newaddr->flags = 0;
+
+ return newaddr;
+}
+
void
e_card_address_label_free (ECardAddrLabel *addr)
{
if ( addr ) {
- if ( addr->data )
- g_free(addr->data);
+ g_free(addr->data);
+
g_free(addr);
}
}
@@ -856,6 +931,69 @@ e_card_address_label_copy (const ECardAddrLabel *addr)
return NULL;
}
+ECardName *e_card_name_new(void)
+{
+ ECardName *newname = g_new(ECardName, 1);
+
+ newname->prefix = NULL;
+ newname->given = NULL;
+ newname->additional = NULL;
+ newname->family = NULL;
+ newname->suffix = NULL;
+
+ return newname;
+}
+
+void
+e_card_name_free(ECardName *name)
+{
+ if (name) {
+ if ( name->prefix )
+ g_free(name->prefix);
+ if ( name->given )
+ g_free(name->given);
+ if ( name->additional )
+ g_free(name->additional);
+ if ( name->family )
+ g_free(name->family);
+ if ( name->suffix )
+ g_free(name->suffix);
+ g_free ( name );
+ }
+}
+
+ECardName *
+e_card_name_copy(const ECardName *name)
+{
+ ECardName *newname = g_new(ECardName, 1);
+
+ newname->prefix = g_strdup(name->prefix);
+ newname->given = g_strdup(name->given);
+ newname->additional = g_strdup(name->additional);
+ newname->family = g_strdup(name->family);
+ newname->suffix = g_strdup(name->suffix);
+
+ return newname;
+}
+
+char *
+e_card_name_to_string(const ECardName *name)
+{
+ char *strings[6], **stringptr = strings;
+ if (name->prefix && *name->prefix)
+ *(stringptr++) = name->prefix;
+ if (name->given && *name->given)
+ *(stringptr++) = name->given;
+ if (name->additional && *name->additional)
+ *(stringptr++) = name->additional;
+ if (name->family && *name->family)
+ *(stringptr++) = name->family;
+ if (name->suffix && *name->suffix)
+ *(stringptr++) = name->suffix;
+ *stringptr = NULL;
+ return g_strjoinv(" ", strings);
+}
+
/*
* ECard lifecycle management and vCard loading/saving.
*/
@@ -1215,18 +1353,6 @@ e_card_str_free (CardStrProperty *sp)
}
static void
-e_card_name_free (CardName *name)
-{
- g_free (name->family);
- g_free (name->given);
- g_free (name->additional);
- g_free (name->prefix);
- g_free (name->suffix);
-
- e_card_prop_free (name->prop);
-}
-
-static void
e_card_photo_free (CardPhoto *photo)
{
g_free (photo->data);
@@ -2688,24 +2814,6 @@ e_card_date_from_string (char *str)
return date;
}
-static void
-e_card_name_free(ECardName *name)
-{
- if ( name ) {
- if ( name->prefix )
- g_free(name->prefix);
- if ( name->given )
- g_free(name->given);
- if ( name->additional )
- g_free(name->additional);
- if ( name->family )
- g_free(name->family);
- if ( name->suffix )
- g_free(name->suffix);
- g_free ( name );
- }
-}
-
char *
e_v_object_get_child_value(VObject *vobj, char *name)
{
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
index 1c48376dca..c42db15461 100644
--- a/addressbook/backend/ebook/e-card.h
+++ b/addressbook/backend/ebook/e-card.h
@@ -64,9 +64,6 @@ struct _ECard {
char *fburl; /* Free Busy URL */
#if 0
- ECardOrg *org; /* The person's organization. */
-
- char *role; /* The person's role w/in his org */
ECardPhoto *logo; /* This person's org's logo. */
ECardPhoto *photo; /* A photo of the person. */
@@ -78,8 +75,6 @@ struct _ECard {
char *categories; /* A list of the categories to which
this card belongs. */
- char *comment; /* An unstructured comment string. */
-
ECardSound *sound;
ECardKey *key; /* The person's public key. */
@@ -88,7 +83,6 @@ struct _ECard {
char *mailer; /* The user's mailer. */
- char *uid; /* This card's unique identifier. */
ECardRev *rev; /* The time this card was last
modified. */
@@ -109,31 +103,25 @@ char *e_card_get_vcard (ECard *card);
ECard *e_card_duplicate (ECard *card);
+ECardPhone *e_card_phone_new (void);
void e_card_phone_free (ECardPhone *phone);
ECardPhone *e_card_phone_copy (const ECardPhone *phone);
+
+ECardDeliveryAddress *e_card_delivery_address_new (void);
void e_card_delivery_address_free (ECardDeliveryAddress *addr);
ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr);
+char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr);
+
+ECardAddrLabel *e_card_address_label_new (void);
void e_card_address_label_free (ECardAddrLabel *addr);
ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr);
+ECardName *e_card_name_new (void);
+void e_card_name_free(ECardName *name);
+ECardName *e_card_name_copy (const ECardName *name);
+char *e_card_name_to_string(const ECardName *name);
/* Standard Gtk function */
GtkType e_card_get_type (void);
-
-#if 0
-void e_card_free (ECard *crd);
-void e_card_prop_free (CardProperty prop);
-CardProperty e_card_prop_empty (void);
-int e_card_check_prop (CardProperty prop);
-GList *e_card_load (GList *crdlist, char *fname);
-void e_card_save (ECard *crd, FILE *fp);
-char *e_card_to_vobj_string (ECard *card);
-char *e_card_to_string (ECard *card);
-
-char *e_card_bday_str (ECardDate bday);
-char *e_card_timezn_str (ECardTimeZone timezn);
-char *e_card_geopos_str (ECardGeoPos geopos);
-#endif
-
#endif /* ! __E_CARD_H__ */
diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c
index 93030447a7..77cc269f19 100644
--- a/addressbook/backend/pas/pas-book-factory.c
+++ b/addressbook/backend/pas/pas-book-factory.c
@@ -350,7 +350,7 @@ register_factory (CORBA_Object obj)
g_message ("pas_book_factory_activate: Exception "
"registering PASBookFactory!\n");
CORBA_exception_free (&ev);
- return;
+ return FALSE;
}
CORBA_exception_free (&ev);