aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-11 17:59:30 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-11 17:59:30 +0800
commitd65fb37051402d1df0d125540546f63cc6b46ea6 (patch)
tree287b9cc05ed644eab851b234dc837c16d457d611 /addressbook/backend
parente30911d7d0806677fbd6ee239d0c47284c05a228 (diff)
downloadgsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.tar
gsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.tar.gz
gsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.tar.bz2
gsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.tar.lz
gsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.tar.xz
gsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.tar.zst
gsoc2013-evolution-d65fb37051402d1df0d125540546f63cc6b46ea6.zip
Removed a bunch of redundant code. Made it so that when you set an address
2000-09-11 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: Removed a bunch of redundant code. Made it so that when you set an address label, it sets the delivery address as well. Added functions to set and get the delivery address. * backend/ebook/e-card.c, backend/ebook/e-card.h: Added code to convert and address label to a delivery address. * contact-editor/Makefile.am: Added e-contact-editor-address.[ch], fulladdr.glade, fulladdr.glade.h. * contact-editor/contact-editor.glade, contact-editor/e-contact-editor-strings.h: Switched from a label to a button to show the parsed address. * contact-editor/e-contact-editor-address.c, contact-editor/e-contact-editor-address.h: New class to implement the parsed address dialog. * contact-editor/e-contact-editor-fullname.c, contact-editor/e-contact-editor-fullname.h: Added const to the _new function. * contact-editor/e-contact-editor.c: Implemented clicking on the address button. * contact-editor/fulladdr.glade, contact-editor/fulladdr.glade.h: New glade files for the parsed address dialog. * contact-editor/fullname-strings.h, fullname.glade: Changed these accellabels to labels. * ename/Makefile.am: Added e-address-western.c. * ename/e-address-western.c: Fixed some warnings. svn path=/trunk/; revision=5317
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/e-card-simple.c292
-rw-r--r--addressbook/backend/ebook/e-card-simple.h104
-rw-r--r--addressbook/backend/ebook/e-card.c35
-rw-r--r--addressbook/backend/ebook/e-card.h3
4 files changed, 160 insertions, 274 deletions
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index 0efda1a8d7..54cd9c6419 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -311,52 +311,6 @@ e_card_simple_class_init (ECardSimpleClass *klass)
gtk_object_add_arg_type ("ECardSimple::card",
GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD);
-#if 0
- gtk_object_add_arg_type ("ECardSimple::file_as",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FILE_AS);
- gtk_object_add_arg_type ("ECardSimple::full_name",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FULL_NAME);
- gtk_object_add_arg_type ("ECardSimple::name",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME);
- gtk_object_add_arg_type ("ECardSimple::address",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS);
- gtk_object_add_arg_type ("ECardSimple::address_label",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL);
- gtk_object_add_arg_type ("ECardSimple::phone",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE);
- gtk_object_add_arg_type ("ECardSimple::email",
- GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_EMAIL);
- gtk_object_add_arg_type ("ECardSimple::birth_date",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE);
- gtk_object_add_arg_type ("ECardSimple::url",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL);
- gtk_object_add_arg_type ("ECardSimple::org",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG);
- gtk_object_add_arg_type ("ECardSimple::org_unit",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT);
- gtk_object_add_arg_type ("ECardSimple::office",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_OFFICE);
- gtk_object_add_arg_type ("ECardSimple::title",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE);
- gtk_object_add_arg_type ("ECardSimple::role",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE);
- gtk_object_add_arg_type ("ECardSimple::manager",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MANAGER);
- gtk_object_add_arg_type ("ECardSimple::assistant",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ASSISTANT);
- gtk_object_add_arg_type ("ECardSimple::nickname",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME);
- gtk_object_add_arg_type ("ECardSimple::spouse",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE);
- gtk_object_add_arg_type ("ECardSimple::anniversary",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY);
- gtk_object_add_arg_type ("ECardSimple::fburl",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL);
- gtk_object_add_arg_type ("ECardSimple::note",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE);
- gtk_object_add_arg_type ("ECardSimple::id",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID);
-#endif
object_class->destroy = e_card_simple_destroy;
object_class->get_arg = e_card_simple_get_arg;
@@ -413,98 +367,6 @@ e_card_simple_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
gtk_object_ref(GTK_OBJECT(simple->card));
fill_in_info(simple);
break;
-#if 0
- case ARG_FILE_AS:
- if (simple->file_as)
- g_free(simple->file_as);
- simple->file_as = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_FULL_NAME:
- if ( simple->fname )
- g_free(simple->fname);
- simple->fname = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NAME:
- if ( simple->name )
- e_card_simple_name_free(simple->name);
- simple->name = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_BIRTH_DATE:
- if ( simple->bday )
- g_free(simple->bday);
- simple->bday = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_URL:
- if ( simple->url )
- g_free(simple->url);
- simple->url = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ORG:
- if (simple->org)
- g_free(simple->org);
- simple->org = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ORG_UNIT:
- if (simple->org_unit)
- g_free(simple->org_unit);
- simple->org_unit = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_OFFICE:
- if (simple->office)
- g_free(simple->office);
- simple->office = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_TITLE:
- if ( simple->title )
- g_free(simple->title);
- simple->title = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ROLE:
- if (simple->role)
- g_free(simple->role);
- simple->role = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_MANAGER:
- if (simple->manager)
- g_free(simple->manager);
- simple->manager = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ASSISTANT:
- if (simple->assistant)
- g_free(simple->assistant);
- simple->assistant = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NICKNAME:
- if (simple->nickname)
- g_free(simple->nickname);
- simple->nickname = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_SPOUSE:
- if (simple->spouse)
- g_free(simple->spouse);
- simple->spouse = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ANNIVERSARY:
- if ( simple->anniversary )
- g_free(simple->anniversary);
- simple->anniversary = GTK_VALUE_POINTER(*arg);
- break;
- case ARG_FBURL:
- if (simple->fburl)
- g_free(simple->fburl);
- simple->fburl = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_NOTE:
- if (simple->note)
- g_free (simple->note);
- simple->note = g_strdup(GTK_VALUE_STRING(*arg));
- break;
- case ARG_ID:
- if (simple->id)
- g_free(simple->id);
- simple->id = g_strdup(GTK_VALUE_STRING(*arg));
- break;
-#endif
default:
return;
}
@@ -526,90 +388,6 @@ e_card_simple_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
else
GTK_VALUE_OBJECT (*arg) = NULL;
break;
-#if 0
- case ARG_FILE_AS:
- GTK_VALUE_STRING (*arg);
- break;
- case ARG_FULL_NAME:
- GTK_VALUE_STRING (*arg) = simple->fname;
- break;
- case ARG_NAME:
- GTK_VALUE_POINTER(*arg) = simple->name;
- break;
- case ARG_ADDRESS:
- if (!simple->address)
- simple->address = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_delivery_address_copy,
- (ECardSimpleListFreeFunc) e_card_simple_delivery_address_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->address);
- break;
- case ARG_ADDRESS_LABEL:
- if (!simple->address_label)
- simple->address_label = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_address_label_copy,
- (ECardSimpleListFreeFunc) e_card_simple_address_label_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->address_label);
- break;
- case ARG_PHONE:
- if (!simple->phone)
- simple->phone = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_phone_copy,
- (ECardSimpleListFreeFunc) e_card_simple_phone_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->phone);
- break;
- case ARG_EMAIL:
- if (!simple->email)
- simple->email = e_card_simple_list_new((ECardSimpleListCopyFunc) g_strdup,
- (ECardSimpleListFreeFunc) g_free,
- NULL);
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->email);
- break;
- case ARG_BIRTH_DATE:
- GTK_VALUE_POINTER(*arg) = simple->bday;
- break;
- case ARG_URL:
- GTK_VALUE_STRING(*arg) = simple->url;
- break;
- case ARG_ORG:
- GTK_VALUE_STRING(*arg) = simple->org;
- break;
- case ARG_ORG_UNIT:
- GTK_VALUE_STRING(*arg) = simple->org_unit;
- break;
- case ARG_OFFICE:
- GTK_VALUE_STRING(*arg) = simple->office;
- break;
- case ARG_TITLE:
- GTK_VALUE_STRING(*arg) = simple->title;
- break;
- case ARG_ROLE:
- GTK_VALUE_STRING(*arg) = simple->role;
- break;
- case ARG_MANAGER:
- GTK_VALUE_STRING(*arg) = simple->manager;
- break;
- case ARG_ASSISTANT:
- GTK_VALUE_STRING(*arg) = simple->assistant;
- break;
- case ARG_NICKNAME:
- GTK_VALUE_STRING(*arg) = simple->nickname;
- break;
- case ARG_SPOUSE:
- GTK_VALUE_STRING(*arg) = simple->spouse;
- break;
- case ARG_ANNIVERSARY:
- GTK_VALUE_POINTER(*arg) = simple->anniversary;
- break;
- case ARG_FBURL:
- GTK_VALUE_STRING(*arg) = simple->fburl;
- break;
- case ARG_NOTE:
- GTK_VALUE_STRING(*arg) = simple->note;
- break;
- case ARG_ID:
- GTK_VALUE_STRING(*arg) = simple->id;
- break;
-#endif
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -642,15 +420,18 @@ fill_in_info(ECardSimple *simple)
EList *address_list;
EList *phone_list;
EList *email_list;
+ EList *delivery_list;
const ECardPhone *phone;
const char *email;
const ECardAddrLabel *address;
+ const ECardDeliveryAddress *delivery;
int i;
EIterator *iterator;
gtk_object_get(GTK_OBJECT(card),
"address_label", &address_list,
+ "address", &delivery_list,
"phone", &phone_list,
"email", &email_list,
NULL);
@@ -698,6 +479,21 @@ fill_in_info(ECardSimple *simple)
}
}
gtk_object_unref(GTK_OBJECT(iterator));
+
+ for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
+ e_card_delivery_address_free(simple->delivery[i]);
+ simple->delivery[i] = NULL;
+ }
+ for (iterator = e_list_get_iterator(delivery_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ delivery = e_iterator_get(iterator);
+ for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) {
+ if (((delivery->flags & addr_correspondences[i]) == addr_correspondences[i]) && (simple->delivery[i] == NULL)) {
+ simple->delivery[i] = e_card_delivery_address_copy(delivery);
+ break;
+ }
+ }
+ }
+ gtk_object_unref(GTK_OBJECT(iterator));
}
}
@@ -709,8 +505,10 @@ e_card_simple_sync_card(ECardSimple *simple)
EList *address_list;
EList *phone_list;
EList *email_list;
+ EList *delivery_list;
const ECardPhone *phone;
const ECardAddrLabel *address;
+ const ECardDeliveryAddress *delivery;
const char *email;
int i;
int iterator_next = 1;
@@ -719,6 +517,7 @@ e_card_simple_sync_card(ECardSimple *simple)
gtk_object_get(GTK_OBJECT(card),
"address_label", &address_list,
+ "address", &delivery_list,
"phone", &phone_list,
"email", &email_list,
NULL);
@@ -811,6 +610,37 @@ e_card_simple_sync_card(ECardSimple *simple)
simple->address[i] = NULL;
}
}
+
+ for (iterator = e_list_get_iterator(delivery_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) {
+ int i;
+ delivery = e_iterator_get(iterator);
+ iterator_next = 1;
+ for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) {
+ if ((delivery->flags & addr_correspondences[i]) == addr_correspondences[i]) {
+ if (simple->delivery[i]) {
+ simple->delivery[i]->flags = addr_correspondences[i];
+ if (!e_card_delivery_address_is_empty(simple->delivery[i])) {
+ e_iterator_set(iterator, simple->delivery[i]);
+ } else {
+ e_iterator_delete(iterator);
+ iterator_next = 0;
+ }
+ e_card_delivery_address_free(simple->delivery[i]);
+ simple->delivery[i] = NULL;
+ break;
+ }
+ }
+ }
+ }
+ gtk_object_unref(GTK_OBJECT(iterator));
+ for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) {
+ if (simple->delivery[i]) {
+ simple->delivery[i]->flags = addr_correspondences[i];
+ e_list_append(delivery_list, simple->delivery[i]);
+ e_card_delivery_address_free(simple->delivery[i]);
+ simple->delivery[i] = NULL;
+ }
+ }
fill_in_info(simple);
}
}
@@ -833,6 +663,12 @@ const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
return simple->address[id];
}
+const ECardDeliveryAddress *e_card_simple_get_delivery_address (ECardSimple *simple,
+ ECardSimpleAddressId id)
+{
+ return simple->delivery[id];
+}
+
void e_card_simple_set_phone (ECardSimple *simple,
ECardSimplePhoneId id,
const ECardPhone *phone)
@@ -858,6 +694,18 @@ void e_card_simple_set_address (ECardSimple *simple,
if (simple->address[id])
e_card_address_label_free(simple->address[id]);
simple->address[id] = e_card_address_label_copy(address);
+ if (simple->delivery[id])
+ e_card_delivery_address_free(simple->delivery[id]);
+ simple->delivery[id] = e_card_delivery_address_from_label(simple->address[id]);
+}
+
+void e_card_simple_set_delivery_address (ECardSimple *simple,
+ ECardSimpleAddressId id,
+ const ECardDeliveryAddress *delivery)
+{
+ if (simple->delivery[id])
+ e_card_delivery_address_free(simple->delivery[id]);
+ simple->delivery[id] = e_card_delivery_address_copy(delivery);
}
const char *e_card_simple_get_const (ECardSimple *simple,
diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h
index 2d3b1cb4f4..6b9d7391fc 100644
--- a/addressbook/backend/ebook/e-card-simple.h
+++ b/addressbook/backend/ebook/e-card-simple.h
@@ -127,6 +127,7 @@ struct _ECardSimple {
ECardPhone *phone[E_CARD_SIMPLE_PHONE_ID_LAST];
char *email[E_CARD_SIMPLE_EMAIL_ID_LAST];
ECardAddrLabel *address[E_CARD_SIMPLE_ADDRESS_ID_LAST];
+ ECardDeliveryAddress *delivery[E_CARD_SIMPLE_ADDRESS_ID_LAST];
};
struct _ECardSimpleClass {
@@ -134,65 +135,66 @@ struct _ECardSimpleClass {
};
typedef void (*ECardSimpleArbitraryCallback) (const ECardArbitrary *arbitrary, gpointer closure);
-
-ECardSimple *e_card_simple_new (ECard *card);
-char *e_card_simple_get_id (ECardSimple *simple);
-void e_card_simple_set_id (ECardSimple *simple,
- const gchar *character);
-char *e_card_simple_get_vcard (ECardSimple *simple);
-
-ECardSimple *e_card_simple_duplicate (ECardSimple *simple);
-
-char *e_card_simple_get (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_const (ECardSimple *simple,
- ECardSimpleField field);
-void e_card_simple_set (ECardSimple *simple,
- ECardSimpleField field,
- const char *data);
-
-ECardSimpleType e_card_simple_type (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_name (ECardSimple *simple,
- ECardSimpleField field);
-const char *e_card_simple_get_short_name (ECardSimple *simple,
- ECardSimpleField field);
+ECardSimple *e_card_simple_new (ECard *card);
+char *e_card_simple_get_id (ECardSimple *simple);
+void e_card_simple_set_id (ECardSimple *simple,
+ const gchar *character);
+char *e_card_simple_get_vcard (ECardSimple *simple);
+ECardSimple *e_card_simple_duplicate (ECardSimple *simple);
+char *e_card_simple_get (ECardSimple *simple,
+ ECardSimpleField field);
+const char *e_card_simple_get_const (ECardSimple *simple,
+ ECardSimpleField field);
+void e_card_simple_set (ECardSimple *simple,
+ ECardSimpleField field,
+ const char *data);
+ECardSimpleType e_card_simple_type (ECardSimple *simple,
+ ECardSimpleField field);
+const char *e_card_simple_get_name (ECardSimple *simple,
+ ECardSimpleField field);
+const char *e_card_simple_get_short_name (ECardSimple *simple,
+ ECardSimpleField field);
/* Use these only if building lists of specific types. It should be
* easier to use the above if you consider a phone field to be the
* same as any other field.
*/
-const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
- ECardSimplePhoneId id);
-const char *e_card_simple_get_email (ECardSimple *simple,
- ECardSimpleEmailId id);
-const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
- ECardSimpleAddressId id);
-void e_card_simple_set_phone (ECardSimple *simple,
- ECardSimplePhoneId id,
- const ECardPhone *phone);
-void e_card_simple_set_email (ECardSimple *simple,
- ECardSimpleEmailId id,
- const char *email);
-void e_card_simple_set_address (ECardSimple *simple,
- ECardSimpleAddressId id,
- const ECardAddrLabel *address);
-
-void e_card_simple_arbitrary_foreach (ECardSimple *simple,
- ECardSimpleArbitraryCallback *callback,
- gpointer closure);
-const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple,
- const char *key);
+const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
+ ECardSimplePhoneId id);
+const char *e_card_simple_get_email (ECardSimple *simple,
+ ECardSimpleEmailId id);
+const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple,
+ ECardSimpleAddressId id);
+const ECardDeliveryAddress *e_card_simple_get_delivery_address (ECardSimple *simple,
+ ECardSimpleAddressId id);
+void e_card_simple_set_phone (ECardSimple *simple,
+ ECardSimplePhoneId id,
+ const ECardPhone *phone);
+void e_card_simple_set_email (ECardSimple *simple,
+ ECardSimpleEmailId id,
+ const char *email);
+void e_card_simple_set_address (ECardSimple *simple,
+ ECardSimpleAddressId id,
+ const ECardAddrLabel *address);
+void e_card_simple_set_delivery_address (ECardSimple *simple,
+ ECardSimpleAddressId id,
+ const ECardDeliveryAddress *delivery);
+void e_card_simple_arbitrary_foreach (ECardSimple *simple,
+ ECardSimpleArbitraryCallback *callback,
+ gpointer closure);
+const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple,
+ const char *key);
/* Any of these except key can be NULL */
-void e_card_simple_set_arbitrary (ECardSimple *simple,
- const char *key,
- const char *type,
- const char *value);
-
-void e_card_simple_sync_card (ECardSimple *simple);
+void e_card_simple_set_arbitrary (ECardSimple *simple,
+ const char *key,
+ const char *type,
+ const char *value);
+void e_card_simple_sync_card (ECardSimple *simple);
/* Standard Gtk function */
-GtkType e_card_simple_get_type (void);
+GtkType e_card_simple_get_type (void);
#endif /* ! __E_CARD_SIMPLE_H__ */
+
+
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index be18e1c359..83f321bc24 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -18,6 +18,7 @@
#include "e-card.h"
#include "e-card-pairs.h"
#include "e-name-western.h"
+#include "e-address-western.h"
#include <e-util/e-util.h>
@@ -295,7 +296,9 @@ char
addPropValue(addressprop, VCPostalCodeProp, address->code);
if ( address->country )
addPropValue(addressprop, VCCountryNameProp, address->country);
+#if 0
addProp(addressprop, VCQuotedPrintableProp);
+#endif
}
gtk_object_unref(GTK_OBJECT(iterator));
}
@@ -1108,6 +1111,38 @@ e_card_delivery_address_copy (const ECardDeliveryAddress *addr)
return NULL;
}
+gboolean
+e_card_delivery_address_is_empty (const ECardDeliveryAddress *addr)
+{
+ return (((addr->po == NULL) || (*addr->po == 0)) &&
+ ((addr->ext == NULL) || (*addr->ext == 0)) &&
+ ((addr->street == NULL) || (*addr->street == 0)) &&
+ ((addr->city == NULL) || (*addr->city == 0)) &&
+ ((addr->region == NULL) || (*addr->region == 0)) &&
+ ((addr->code == NULL) || (*addr->code == 0)) &&
+ ((addr->country == NULL) || (*addr->country == 0)));
+}
+
+ECardDeliveryAddress *
+e_card_delivery_address_from_label(const ECardAddrLabel *label)
+{
+ ECardDeliveryAddress *addr = g_new(ECardDeliveryAddress, 1);
+ EAddressWestern *western = e_address_western_parse (label->data);
+
+ addr->po = g_strdup (western->po_box );
+ addr->ext = g_strdup (western->extended );
+ addr->street = g_strdup (western->street );
+ addr->city = g_strdup (western->locality );
+ addr->region = g_strdup (western->region );
+ addr->code = g_strdup (western->postal_code);
+ addr->country = g_strdup (western->country );
+ addr->flags = label->flags;
+
+ e_address_western_free(western);
+
+ return addr;
+}
+
char *
e_card_delivery_address_to_string(const ECardDeliveryAddress *addr)
{
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
index 8b0ac11b4d..4a6935419d 100644
--- a/addressbook/backend/ebook/e-card.h
+++ b/addressbook/backend/ebook/e-card.h
@@ -118,8 +118,9 @@ void e_card_phone_free ( ECardPhone *phone);
ECardDeliveryAddress *e_card_delivery_address_new (void);
ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr);
void e_card_delivery_address_free ( ECardDeliveryAddress *addr);
+gboolean e_card_delivery_address_is_empty (const ECardDeliveryAddress *addr);
char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr);
-ECardDeliveryAddress *e_card_delivery_address_from_string (const char *full_addr);
+ECardDeliveryAddress *e_card_delivery_address_from_label (const ECardAddrLabel *label);
ECardAddrLabel *e_card_address_label_new (void);
ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr);