From d65fb37051402d1df0d125540546f63cc6b46ea6 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Mon, 11 Sep 2000 09:59:30 +0000 Subject: Removed a bunch of redundant code. Made it so that when you set an address 2000-09-11 Christopher James Lahey * 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 --- addressbook/ChangeLog | 42 ++ addressbook/backend/ebook/e-card-simple.c | 292 +++---------- addressbook/backend/ebook/e-card-simple.h | 104 ++--- addressbook/backend/ebook/e-card.c | 35 ++ addressbook/backend/ebook/e-card.h | 3 +- addressbook/contact-editor/Makefile.am | 4 + addressbook/contact-editor/contact-editor.glade | 48 +- .../contact-editor/e-contact-editor-address.c | 217 ++++++++++ .../contact-editor/e-contact-editor-address.h | 75 ++++ .../contact-editor/e-contact-editor-fullname.c | 2 +- .../contact-editor/e-contact-editor-fullname.h | 2 +- .../contact-editor/e-contact-editor-strings.h | 2 +- addressbook/contact-editor/e-contact-editor.c | 41 ++ addressbook/contact-editor/fulladdr.glade | 481 +++++++++++++++++++++ addressbook/contact-editor/fulladdr.glade.h | 18 + addressbook/contact-editor/fullname-strings.h | 10 +- addressbook/contact-editor/fullname.glade | 326 +++++++------- addressbook/ename/Makefile.am | 2 + addressbook/ename/e-address-western.c | 18 +- addressbook/gui/contact-editor/Makefile.am | 4 + .../gui/contact-editor/contact-editor.glade | 48 +- .../gui/contact-editor/e-contact-editor-address.c | 217 ++++++++++ .../gui/contact-editor/e-contact-editor-address.h | 75 ++++ .../gui/contact-editor/e-contact-editor-fullname.c | 2 +- .../gui/contact-editor/e-contact-editor-fullname.h | 2 +- .../gui/contact-editor/e-contact-editor-strings.h | 2 +- addressbook/gui/contact-editor/e-contact-editor.c | 41 ++ addressbook/gui/contact-editor/fulladdr.glade | 481 +++++++++++++++++++++ addressbook/gui/contact-editor/fulladdr.glade.h | 18 + addressbook/gui/contact-editor/fullname-strings.h | 10 +- addressbook/gui/contact-editor/fullname.glade | 326 +++++++------- e-util/ename/Makefile.am | 2 + e-util/ename/e-address-western.c | 18 +- 33 files changed, 2280 insertions(+), 688 deletions(-) create mode 100644 addressbook/contact-editor/e-contact-editor-address.c create mode 100644 addressbook/contact-editor/e-contact-editor-address.h create mode 100644 addressbook/contact-editor/fulladdr.glade create mode 100644 addressbook/contact-editor/fulladdr.glade.h create mode 100644 addressbook/gui/contact-editor/e-contact-editor-address.c create mode 100644 addressbook/gui/contact-editor/e-contact-editor-address.h create mode 100644 addressbook/gui/contact-editor/fulladdr.glade create mode 100644 addressbook/gui/contact-editor/fulladdr.glade.h diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 6305e90367..5906bf2677 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,45 @@ +2000-09-11 Christopher James Lahey + + * 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. + +2000-09-10 Christopher James Lahey + + * ename/e-address-western.c: Added by Jesse. + 2000-09-08 Lauris Kaplinski * gui/minicard/e-minicard-label.c (e_minicard_label_construct): 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 @@ -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); diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am index f51a0109ac..21363e849f 100644 --- a/addressbook/contact-editor/Makefile.am +++ b/addressbook/contact-editor/Makefile.am @@ -15,6 +15,8 @@ noinst_LIBRARIES = \ libecontacteditor.a libecontacteditor_a_SOURCES = \ + e-contact-editor-address.c \ + e-contact-editor-address.h \ e-contact-editor-categories.c \ e-contact-editor-categories.h \ e-contact-editor-fullname.c \ @@ -53,6 +55,7 @@ gladedir = $(datadir)/evolution/glade glade_DATA = \ contact-editor.glade \ + fulladdr.glade \ fullname.glade \ categories.glade \ e-contact-editor-confirm-delete.glade @@ -60,6 +63,7 @@ glade_DATA = \ EXTRA_DIST = $(evolution_DATA) \ $(glade_DATA) \ e-contact-editor-strings.h \ + fulladdr.glade.h \ fullname-strings.h \ categories-strings.h \ e-contact-editor-confirm-delete.glade.h diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade index 7c328a72ce..4e2ff11d69 100644 --- a/addressbook/contact-editor/contact-editor.glade +++ b/addressbook/contact-editor/contact-editor.glade @@ -1000,33 +1000,6 @@ - - GtkLabel - address-label - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - text-address - - 5 - 7 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - GtkEventBox eventbox1 @@ -1647,6 +1620,27 @@ True + + + GtkButton + button-fulladdr + True + + + 5 + 7 + 6 + 7 + 0 + 0 + False + False + False + False + True + True + + diff --git a/addressbook/contact-editor/e-contact-editor-address.c b/addressbook/contact-editor/e-contact-editor-address.c new file mode 100644 index 0000000000..cf6cc382cd --- /dev/null +++ b/addressbook/contact-editor/e-contact-editor-address.c @@ -0,0 +1,217 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-contact-editor-address.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include + +static void e_contact_editor_address_init (EContactEditorAddress *card); +static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass); +static void e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); +static void e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void e_contact_editor_address_destroy (GtkObject *object); + +static void fill_in_info(EContactEditorAddress *editor); +static void extract_info(EContactEditorAddress *editor); + +static GnomeDialogClass *parent_class = NULL; + +/* The arguments we take */ +enum { + ARG_0, + ARG_ADDRESS +}; + +GtkType +e_contact_editor_address_get_type (void) +{ + static GtkType contact_editor_address_type = 0; + + if (!contact_editor_address_type) + { + static const GtkTypeInfo contact_editor_address_info = + { + "EContactEditorAddress", + sizeof (EContactEditorAddress), + sizeof (EContactEditorAddressClass), + (GtkClassInitFunc) e_contact_editor_address_class_init, + (GtkObjectInitFunc) e_contact_editor_address_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + contact_editor_address_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_address_info); + } + + return contact_editor_address_type; +} + +static void +e_contact_editor_address_class_init (EContactEditorAddressClass *klass) +{ + GtkObjectClass *object_class; + GnomeDialogClass *dialog_class; + + object_class = (GtkObjectClass*) klass; + dialog_class = (GnomeDialogClass *) klass; + + parent_class = gtk_type_class (gnome_dialog_get_type ()); + + gtk_object_add_arg_type ("EContactEditorAddress::address", GTK_TYPE_POINTER, + GTK_ARG_READWRITE, ARG_ADDRESS); + + object_class->set_arg = e_contact_editor_address_set_arg; + object_class->get_arg = e_contact_editor_address_get_arg; + object_class->destroy = e_contact_editor_address_destroy; +} + +static void +e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) +{ + GladeXML *gui; + GtkWidget *widget; + + gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address), + GNOME_STOCK_BUTTON_OK); + + gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address), + GNOME_STOCK_BUTTON_CANCEL); + + gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE); + + e_contact_editor_address->address = NULL; + + gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL); + e_contact_editor_address->gui = gui; + + widget = glade_xml_get_widget(gui, "table-checkaddress"); + gtk_widget_ref(widget); + gtk_container_remove(GTK_CONTAINER(widget->parent), widget); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0); + gtk_widget_unref(widget); +} + +void +e_contact_editor_address_destroy (GtkObject *object) +{ + EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object); + + if (e_contact_editor_address->gui) + gtk_object_unref(GTK_OBJECT(e_contact_editor_address->gui)); + e_card_delivery_address_free(e_contact_editor_address->address); +} + +GtkWidget* +e_contact_editor_address_new (const ECardDeliveryAddress *address) +{ + GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_address_get_type ())); + gtk_object_set (GTK_OBJECT(widget), + "address", address, + NULL); + return widget; +} + +static void +e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +{ + EContactEditorAddress *e_contact_editor_address; + + e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (o); + + switch (arg_id){ + case ARG_ADDRESS: + if (e_contact_editor_address->address) + e_card_delivery_address_free(e_contact_editor_address->address); + e_contact_editor_address->address = e_card_delivery_address_copy(GTK_VALUE_POINTER (*arg)); + fill_in_info(e_contact_editor_address); + break; + } +} + +static void +e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + EContactEditorAddress *e_contact_editor_address; + + e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object); + + switch (arg_id) { + case ARG_ADDRESS: + extract_info(e_contact_editor_address); + GTK_VALUE_POINTER (*arg) = e_card_delivery_address_copy(e_contact_editor_address->address); + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} + +static void +fill_in_field(EContactEditorAddress *editor, char *field, char *string) +{ + GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field)); + if (editable) { + e_utf8_gtk_editable_set_text(editable, string); + } +} + +static void +fill_in_info(EContactEditorAddress *editor) +{ + ECardDeliveryAddress *address = editor->address; + if (address) { + fill_in_field(editor, "text-street" , address->street ); + fill_in_field(editor, "entry-po" , address->po ); + fill_in_field(editor, "entry-ext" , address->ext ); + fill_in_field(editor, "entry-city" , address->city ); + fill_in_field(editor, "entry-region" , address->region ); + fill_in_field(editor, "entry-code" , address->code ); + fill_in_field(editor, "entry-country", address->country); + } +} + +static char * +extract_field(EContactEditorAddress *editor, char *field) +{ + GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field)); + if (editable) + return e_utf8_gtk_editable_get_text(editable); + else + return NULL; +} + +static void +extract_info(EContactEditorAddress *editor) +{ + ECardDeliveryAddress *address = editor->address; + if (!address) + address = e_card_delivery_address_new(); + address->street = extract_field(editor, "text-street" ); + address->po = extract_field(editor, "entry-po" ); + address->ext = extract_field(editor, "entry-ext" ); + address->city = extract_field(editor, "entry-city" ); + address->region = extract_field(editor, "entry-region" ); + address->code = extract_field(editor, "entry-code" ); + address->country = extract_field(editor, "entry-country"); +} diff --git a/addressbook/contact-editor/e-contact-editor-address.h b/addressbook/contact-editor/e-contact-editor-address.h new file mode 100644 index 0000000000..a74e1bd967 --- /dev/null +++ b/addressbook/contact-editor/e-contact-editor-address.h @@ -0,0 +1,75 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* e-contact-editor-address.h + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __E_CONTACT_EDITOR_ADDRESS_H__ +#define __E_CONTACT_EDITOR_ADDRESS_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +/* EContactEditorAddress - A dialog displaying information about a contact. + * + * The following arguments are available: + * + * name type read/write description + * -------------------------------------------------------------------------------- + * name ECardName * RW The card currently being edited. Returns a copy. + */ + +#define E_CONTACT_EDITOR_ADDRESS_TYPE (e_contact_editor_address_get_type ()) +#define E_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddress)) +#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddressClass)) +#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE)) +#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE)) + + +typedef struct _EContactEditorAddress EContactEditorAddress; +typedef struct _EContactEditorAddressClass EContactEditorAddressClass; + +struct _EContactEditorAddress +{ + GnomeDialog parent; + + /* item specific fields */ + ECardDeliveryAddress *address; + GladeXML *gui; +}; + +struct _EContactEditorAddressClass +{ + GnomeDialogClass parent_class; +}; + + +GtkWidget *e_contact_editor_address_new(const ECardDeliveryAddress *name); +GtkType e_contact_editor_address_get_type (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */ diff --git a/addressbook/contact-editor/e-contact-editor-fullname.c b/addressbook/contact-editor/e-contact-editor-fullname.c index d455640164..d3f8f399bb 100644 --- a/addressbook/contact-editor/e-contact-editor-fullname.c +++ b/addressbook/contact-editor/e-contact-editor-fullname.c @@ -122,7 +122,7 @@ e_contact_editor_fullname_destroy (GtkObject *object) } GtkWidget* -e_contact_editor_fullname_new (ECardName *name) +e_contact_editor_fullname_new (const ECardName *name) { GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ())); gtk_object_set (GTK_OBJECT(widget), diff --git a/addressbook/contact-editor/e-contact-editor-fullname.h b/addressbook/contact-editor/e-contact-editor-fullname.h index 409ffc72d0..bde6733976 100644 --- a/addressbook/contact-editor/e-contact-editor-fullname.h +++ b/addressbook/contact-editor/e-contact-editor-fullname.h @@ -64,7 +64,7 @@ struct _EContactEditorFullnameClass }; -GtkWidget *e_contact_editor_fullname_new(ECardName *name); +GtkWidget *e_contact_editor_fullname_new(const ECardName *name); GtkType e_contact_editor_fullname_get_type (void); #ifdef __cplusplus diff --git a/addressbook/contact-editor/e-contact-editor-strings.h b/addressbook/contact-editor/e-contact-editor-strings.h index d5ac9daf24..bb9c0b5b30 100644 --- a/addressbook/contact-editor/e-contact-editor-strings.h +++ b/addressbook/contact-editor/e-contact-editor-strings.h @@ -15,7 +15,6 @@ gchar *s = N_("_Full Name..."); gchar *s = N_("File As:"); gchar *s = N_("Web page address:"); gchar *s = N_("Wants to receive _HTML mail"); -gchar *s = N_("Address:"); gchar *s = N_("_Business"); gchar *s = N_("_Home"); gchar *s = N_("Business _Fax"); @@ -27,6 +26,7 @@ gchar *s = N_("C_ontacts..."); gchar *s = N_("Ca_tegories..."); gchar *s = N_("_Job title:"); gchar *s = N_("_Company:"); +gchar *s = N_("_Address..."); gchar *s = N_("General"); gchar *s = N_("_Department:"); gchar *s = N_("_Office:"); diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index c2d4450a7b..16c14bf585 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -24,6 +24,7 @@ #include #include "e-contact-editor.h" #include +#include #include #include #include @@ -500,6 +501,41 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor) gtk_object_unref(GTK_OBJECT(dialog)); } +static void +full_addr_clicked(GtkWidget *button, EContactEditor *editor) +{ + GnomeDialog *dialog; + int result; + const ECardDeliveryAddress *address; + + address = e_card_simple_get_delivery_address(editor->simple, editor->address_choice); + + dialog = GNOME_DIALOG(e_contact_editor_address_new(address)); + gtk_widget_show(GTK_WIDGET(dialog)); + + result = gnome_dialog_run (dialog); + if (result == 0) { + ECardDeliveryAddress *new_address; + + gtk_object_get(GTK_OBJECT(dialog), + "address", &new_address, + NULL); + e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address); + e_card_delivery_address_free(new_address); + +#if 0 + GtkWidget *fname_widget; + fname_widget = glade_xml_get_widget(editor->gui, "text-address"); + if (fname_widget && GTK_IS_ENTRY(fname_widget)) { + char *full_name = e_card_delivery_address_to_string(address); + e_utf8_gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name); + g_free(full_name); + } +#endif + } + gtk_object_unref(GTK_OBJECT(dialog)); +} + static void categories_clicked(GtkWidget *button, EContactEditor *editor) { @@ -1014,6 +1050,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor) gtk_signal_connect(GTK_OBJECT(widget), "clicked", full_name_clicked, e_contact_editor); + widget = glade_xml_get_widget(e_contact_editor->gui, "button-fulladdr"); + if (widget && GTK_IS_BUTTON(widget)) + gtk_signal_connect(GTK_OBJECT(widget), "clicked", + full_addr_clicked, e_contact_editor); + widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories"); if (widget && GTK_IS_BUTTON(widget)) gtk_signal_connect(GTK_OBJECT(widget), "clicked", diff --git a/addressbook/contact-editor/fulladdr.glade b/addressbook/contact-editor/fulladdr.glade new file mode 100644 index 0000000000..e1ba71bebd --- /dev/null +++ b/addressbook/contact-editor/fulladdr.glade @@ -0,0 +1,481 @@ + + + + + fulladdr + fulladdr + + src + pixmaps + C + True + True + True + False + False + False + True + fulladdr.glade.h + + + + GnomeDialog + dialog-checkaddress + False + Check Address + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + vbox-container + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + hbuttonbox1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkTable + table-checkaddress + 8 + 5 + 4 + False + 6 + 21 + + 0 + True + True + + + + GtkEntry + entry-city + True + True + True + 0 + + + 1 + 4 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label2 + + GTK_JUSTIFY_LEFT + False + 0 + 0 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label5 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label7 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + entry-region + True + True + True + 0 + + + 1 + 2 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label6 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + entry-code + True + True + True + 0 + + + 3 + 4 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0 + 0 + 0 + entry-ext + + 2 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + + GtkAlignment + alignment1 + 0.5 + 0 + 1 + 0 + + 3 + 4 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + GtkEntry + entry-ext + True + True + True + 0 + + + + + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 0 + 1 + 0 + 0 + True + True + False + False + True + True + + + + GtkText + text-street + True + True + + + + + + GtkCombo + combo-country + False + True + False + True + False + USA +Canada +Finland + + + 1 + 4 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry-country + True + True + True + 0 + + + + + + GtkLabel + label8 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + entry-po + True + True + True + 0 + + + 1 + 4 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + + + diff --git a/addressbook/contact-editor/fulladdr.glade.h b/addressbook/contact-editor/fulladdr.glade.h new file mode 100644 index 0000000000..2a76706d6e --- /dev/null +++ b/addressbook/contact-editor/fulladdr.glade.h @@ -0,0 +1,18 @@ +/* + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in. + * DO NOT compile it as part of your application. + */ + +gchar *s = N_("Check Address"); +gchar *s = N_("_Street Address:"); +gchar *s = N_("City:"); +gchar *s = N_("State/Province:"); +gchar *s = N_("Country:"); +gchar *s = N_("ZIP/Postal Code:"); +gchar *s = N_("E_xt:"); +gchar *s = N_("USA\n" + "Canada\n" + "Finland\n" + ""); +gchar *s = N_("PO Box:"); diff --git a/addressbook/contact-editor/fullname-strings.h b/addressbook/contact-editor/fullname-strings.h index 0c84dfdc8f..4d4303270a 100644 --- a/addressbook/contact-editor/fullname-strings.h +++ b/addressbook/contact-editor/fullname-strings.h @@ -5,11 +5,6 @@ */ gchar *s = N_("Check Full Name"); -gchar *s = N_("_Title:"); -gchar *s = N_("_First:"); -gchar *s = N_("_Middle:"); -gchar *s = N_("_Last:"); -gchar *s = N_("_Suffix:"); gchar *s = N_("\n" "Mr.\n" "Mrs.\n" @@ -23,3 +18,8 @@ gchar *s = N_("\n" "III\n" "Esq.\n" ""); +gchar *s = N_("_First:"); +gchar *s = N_("_Title:"); +gchar *s = N_("_Middle:"); +gchar *s = N_("_Last:"); +gchar *s = N_("_Suffix:"); diff --git a/addressbook/contact-editor/fullname.glade b/addressbook/contact-editor/fullname.glade index 8f811c5616..f2dfa23834 100644 --- a/addressbook/contact-editor/fullname.glade +++ b/addressbook/contact-editor/fullname.glade @@ -14,13 +14,6 @@ False False False - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h True fullname-strings.h @@ -51,6 +44,40 @@ True + + GtkHButtonBox + GnomeDialog:action_area + hbuttonbox1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + GtkTable table-checkfullname @@ -66,136 +93,6 @@ True - - GtkAccelLabel - accellabel1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel2 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel3 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel4 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel5 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - GtkCombo combo-title @@ -350,39 +247,140 @@ Esq. False - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-first + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-title + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_CANCEL + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-middle + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label5 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-last + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-suffix + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + diff --git a/addressbook/ename/Makefile.am b/addressbook/ename/Makefile.am index 6e4d3818f2..068de01d90 100644 --- a/addressbook/ename/Makefile.am +++ b/addressbook/ename/Makefile.am @@ -21,11 +21,13 @@ ename_libs = \ lib_LTLIBRARIES = libename.la libename_la_SOURCES = \ + e-address-western.c \ e-name-western.c libenameincludedir = $(includedir)/ename libenameinclude_HEADERS = \ + e-address-western.h \ e-name-western-tables.h \ e-name-western.h diff --git a/addressbook/ename/e-address-western.c b/addressbook/ename/e-address-western.c index b6ced3bebf..3e5d491b90 100644 --- a/addressbook/ename/e-address-western.c +++ b/addressbook/ename/e-address-western.c @@ -45,7 +45,7 @@ e_address_western_is_line_blank (gchar *line) /* In the array of lines, `lines', we will erase the line at line_num, and shift the remaining lines, up to line number num_lines, up one position. */ -void +static void e_address_western_shift_line (gchar *lines[], gint line_num, gint num_lines) { gint cntr; @@ -83,10 +83,10 @@ e_address_western_remove_blank_lines (gchar *lines[], gint *linecntr) } -gboolean +static gboolean e_address_western_is_po_box (gchar *line) { - gboolean retval; + gboolean retval = FALSE; /* In which phase of processing are we? */ enum State { FIRSTCHAR, SECONDCHAR, WHITESPACE } state; @@ -138,7 +138,7 @@ e_address_western_is_po_box (gchar *line) /* A line that contains a comma followed eventually by a number is deemed to be the line in the form of . */ -gboolean +static gboolean e_address_western_is_postal (gchar *line) { gboolean retval; @@ -182,13 +182,13 @@ e_address_western_is_postal (gchar *line) return retval; } -gchar * +static gchar * e_address_western_extract_po_box (gchar *line) { return g_strdup (line); } -gchar * +static gchar * e_address_western_extract_locality (gchar *line) { gint index; @@ -206,7 +206,7 @@ e_address_western_extract_locality (gchar *line) /* Whatever resides between the comma and the start of the postal code is deemed to be the region. */ -gchar * +static gchar * e_address_western_extract_region (gchar *line) { gint start, end; @@ -231,7 +231,7 @@ e_address_western_extract_region (gchar *line) return g_strndup ( (line+start), end-start); } -gchar * +static gchar * e_address_western_extract_postal_code (gchar *line) { int start, end; @@ -261,7 +261,9 @@ e_address_western_parse (const gchar *in_address) gboolean found_po_box, found_postal; EAddressWestern *eaw; +#ifndef NO_WARNINGS gint start, end; /* To be used to classify address lines. */ +#endif if (in_address == NULL) return NULL; diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am index f51a0109ac..21363e849f 100644 --- a/addressbook/gui/contact-editor/Makefile.am +++ b/addressbook/gui/contact-editor/Makefile.am @@ -15,6 +15,8 @@ noinst_LIBRARIES = \ libecontacteditor.a libecontacteditor_a_SOURCES = \ + e-contact-editor-address.c \ + e-contact-editor-address.h \ e-contact-editor-categories.c \ e-contact-editor-categories.h \ e-contact-editor-fullname.c \ @@ -53,6 +55,7 @@ gladedir = $(datadir)/evolution/glade glade_DATA = \ contact-editor.glade \ + fulladdr.glade \ fullname.glade \ categories.glade \ e-contact-editor-confirm-delete.glade @@ -60,6 +63,7 @@ glade_DATA = \ EXTRA_DIST = $(evolution_DATA) \ $(glade_DATA) \ e-contact-editor-strings.h \ + fulladdr.glade.h \ fullname-strings.h \ categories-strings.h \ e-contact-editor-confirm-delete.glade.h diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index 7c328a72ce..4e2ff11d69 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -1000,33 +1000,6 @@ - - GtkLabel - address-label - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - text-address - - 5 - 7 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - GtkEventBox eventbox1 @@ -1647,6 +1620,27 @@ True + + + GtkButton + button-fulladdr + True + + + 5 + 7 + 6 + 7 + 0 + 0 + False + False + False + False + True + True + + diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c new file mode 100644 index 0000000000..cf6cc382cd --- /dev/null +++ b/addressbook/gui/contact-editor/e-contact-editor-address.c @@ -0,0 +1,217 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-contact-editor-address.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include + +static void e_contact_editor_address_init (EContactEditorAddress *card); +static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass); +static void e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); +static void e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void e_contact_editor_address_destroy (GtkObject *object); + +static void fill_in_info(EContactEditorAddress *editor); +static void extract_info(EContactEditorAddress *editor); + +static GnomeDialogClass *parent_class = NULL; + +/* The arguments we take */ +enum { + ARG_0, + ARG_ADDRESS +}; + +GtkType +e_contact_editor_address_get_type (void) +{ + static GtkType contact_editor_address_type = 0; + + if (!contact_editor_address_type) + { + static const GtkTypeInfo contact_editor_address_info = + { + "EContactEditorAddress", + sizeof (EContactEditorAddress), + sizeof (EContactEditorAddressClass), + (GtkClassInitFunc) e_contact_editor_address_class_init, + (GtkObjectInitFunc) e_contact_editor_address_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + contact_editor_address_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_address_info); + } + + return contact_editor_address_type; +} + +static void +e_contact_editor_address_class_init (EContactEditorAddressClass *klass) +{ + GtkObjectClass *object_class; + GnomeDialogClass *dialog_class; + + object_class = (GtkObjectClass*) klass; + dialog_class = (GnomeDialogClass *) klass; + + parent_class = gtk_type_class (gnome_dialog_get_type ()); + + gtk_object_add_arg_type ("EContactEditorAddress::address", GTK_TYPE_POINTER, + GTK_ARG_READWRITE, ARG_ADDRESS); + + object_class->set_arg = e_contact_editor_address_set_arg; + object_class->get_arg = e_contact_editor_address_get_arg; + object_class->destroy = e_contact_editor_address_destroy; +} + +static void +e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) +{ + GladeXML *gui; + GtkWidget *widget; + + gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address), + GNOME_STOCK_BUTTON_OK); + + gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address), + GNOME_STOCK_BUTTON_CANCEL); + + gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE); + + e_contact_editor_address->address = NULL; + + gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL); + e_contact_editor_address->gui = gui; + + widget = glade_xml_get_widget(gui, "table-checkaddress"); + gtk_widget_ref(widget); + gtk_container_remove(GTK_CONTAINER(widget->parent), widget); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0); + gtk_widget_unref(widget); +} + +void +e_contact_editor_address_destroy (GtkObject *object) +{ + EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object); + + if (e_contact_editor_address->gui) + gtk_object_unref(GTK_OBJECT(e_contact_editor_address->gui)); + e_card_delivery_address_free(e_contact_editor_address->address); +} + +GtkWidget* +e_contact_editor_address_new (const ECardDeliveryAddress *address) +{ + GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_address_get_type ())); + gtk_object_set (GTK_OBJECT(widget), + "address", address, + NULL); + return widget; +} + +static void +e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +{ + EContactEditorAddress *e_contact_editor_address; + + e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (o); + + switch (arg_id){ + case ARG_ADDRESS: + if (e_contact_editor_address->address) + e_card_delivery_address_free(e_contact_editor_address->address); + e_contact_editor_address->address = e_card_delivery_address_copy(GTK_VALUE_POINTER (*arg)); + fill_in_info(e_contact_editor_address); + break; + } +} + +static void +e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + EContactEditorAddress *e_contact_editor_address; + + e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object); + + switch (arg_id) { + case ARG_ADDRESS: + extract_info(e_contact_editor_address); + GTK_VALUE_POINTER (*arg) = e_card_delivery_address_copy(e_contact_editor_address->address); + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} + +static void +fill_in_field(EContactEditorAddress *editor, char *field, char *string) +{ + GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field)); + if (editable) { + e_utf8_gtk_editable_set_text(editable, string); + } +} + +static void +fill_in_info(EContactEditorAddress *editor) +{ + ECardDeliveryAddress *address = editor->address; + if (address) { + fill_in_field(editor, "text-street" , address->street ); + fill_in_field(editor, "entry-po" , address->po ); + fill_in_field(editor, "entry-ext" , address->ext ); + fill_in_field(editor, "entry-city" , address->city ); + fill_in_field(editor, "entry-region" , address->region ); + fill_in_field(editor, "entry-code" , address->code ); + fill_in_field(editor, "entry-country", address->country); + } +} + +static char * +extract_field(EContactEditorAddress *editor, char *field) +{ + GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field)); + if (editable) + return e_utf8_gtk_editable_get_text(editable); + else + return NULL; +} + +static void +extract_info(EContactEditorAddress *editor) +{ + ECardDeliveryAddress *address = editor->address; + if (!address) + address = e_card_delivery_address_new(); + address->street = extract_field(editor, "text-street" ); + address->po = extract_field(editor, "entry-po" ); + address->ext = extract_field(editor, "entry-ext" ); + address->city = extract_field(editor, "entry-city" ); + address->region = extract_field(editor, "entry-region" ); + address->code = extract_field(editor, "entry-code" ); + address->country = extract_field(editor, "entry-country"); +} diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.h b/addressbook/gui/contact-editor/e-contact-editor-address.h new file mode 100644 index 0000000000..a74e1bd967 --- /dev/null +++ b/addressbook/gui/contact-editor/e-contact-editor-address.h @@ -0,0 +1,75 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* e-contact-editor-address.h + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __E_CONTACT_EDITOR_ADDRESS_H__ +#define __E_CONTACT_EDITOR_ADDRESS_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +/* EContactEditorAddress - A dialog displaying information about a contact. + * + * The following arguments are available: + * + * name type read/write description + * -------------------------------------------------------------------------------- + * name ECardName * RW The card currently being edited. Returns a copy. + */ + +#define E_CONTACT_EDITOR_ADDRESS_TYPE (e_contact_editor_address_get_type ()) +#define E_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddress)) +#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddressClass)) +#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE)) +#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE)) + + +typedef struct _EContactEditorAddress EContactEditorAddress; +typedef struct _EContactEditorAddressClass EContactEditorAddressClass; + +struct _EContactEditorAddress +{ + GnomeDialog parent; + + /* item specific fields */ + ECardDeliveryAddress *address; + GladeXML *gui; +}; + +struct _EContactEditorAddressClass +{ + GnomeDialogClass parent_class; +}; + + +GtkWidget *e_contact_editor_address_new(const ECardDeliveryAddress *name); +GtkType e_contact_editor_address_get_type (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c index d455640164..d3f8f399bb 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c @@ -122,7 +122,7 @@ e_contact_editor_fullname_destroy (GtkObject *object) } GtkWidget* -e_contact_editor_fullname_new (ECardName *name) +e_contact_editor_fullname_new (const ECardName *name) { GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ())); gtk_object_set (GTK_OBJECT(widget), diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.h b/addressbook/gui/contact-editor/e-contact-editor-fullname.h index 409ffc72d0..bde6733976 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h +++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.h @@ -64,7 +64,7 @@ struct _EContactEditorFullnameClass }; -GtkWidget *e_contact_editor_fullname_new(ECardName *name); +GtkWidget *e_contact_editor_fullname_new(const ECardName *name); GtkType e_contact_editor_fullname_get_type (void); #ifdef __cplusplus diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h index d5ac9daf24..bb9c0b5b30 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-strings.h +++ b/addressbook/gui/contact-editor/e-contact-editor-strings.h @@ -15,7 +15,6 @@ gchar *s = N_("_Full Name..."); gchar *s = N_("File As:"); gchar *s = N_("Web page address:"); gchar *s = N_("Wants to receive _HTML mail"); -gchar *s = N_("Address:"); gchar *s = N_("_Business"); gchar *s = N_("_Home"); gchar *s = N_("Business _Fax"); @@ -27,6 +26,7 @@ gchar *s = N_("C_ontacts..."); gchar *s = N_("Ca_tegories..."); gchar *s = N_("_Job title:"); gchar *s = N_("_Company:"); +gchar *s = N_("_Address..."); gchar *s = N_("General"); gchar *s = N_("_Department:"); gchar *s = N_("_Office:"); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index c2d4450a7b..16c14bf585 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -24,6 +24,7 @@ #include #include "e-contact-editor.h" #include +#include #include #include #include @@ -500,6 +501,41 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor) gtk_object_unref(GTK_OBJECT(dialog)); } +static void +full_addr_clicked(GtkWidget *button, EContactEditor *editor) +{ + GnomeDialog *dialog; + int result; + const ECardDeliveryAddress *address; + + address = e_card_simple_get_delivery_address(editor->simple, editor->address_choice); + + dialog = GNOME_DIALOG(e_contact_editor_address_new(address)); + gtk_widget_show(GTK_WIDGET(dialog)); + + result = gnome_dialog_run (dialog); + if (result == 0) { + ECardDeliveryAddress *new_address; + + gtk_object_get(GTK_OBJECT(dialog), + "address", &new_address, + NULL); + e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address); + e_card_delivery_address_free(new_address); + +#if 0 + GtkWidget *fname_widget; + fname_widget = glade_xml_get_widget(editor->gui, "text-address"); + if (fname_widget && GTK_IS_ENTRY(fname_widget)) { + char *full_name = e_card_delivery_address_to_string(address); + e_utf8_gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name); + g_free(full_name); + } +#endif + } + gtk_object_unref(GTK_OBJECT(dialog)); +} + static void categories_clicked(GtkWidget *button, EContactEditor *editor) { @@ -1014,6 +1050,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor) gtk_signal_connect(GTK_OBJECT(widget), "clicked", full_name_clicked, e_contact_editor); + widget = glade_xml_get_widget(e_contact_editor->gui, "button-fulladdr"); + if (widget && GTK_IS_BUTTON(widget)) + gtk_signal_connect(GTK_OBJECT(widget), "clicked", + full_addr_clicked, e_contact_editor); + widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories"); if (widget && GTK_IS_BUTTON(widget)) gtk_signal_connect(GTK_OBJECT(widget), "clicked", diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade new file mode 100644 index 0000000000..e1ba71bebd --- /dev/null +++ b/addressbook/gui/contact-editor/fulladdr.glade @@ -0,0 +1,481 @@ + + + + + fulladdr + fulladdr + + src + pixmaps + C + True + True + True + False + False + False + True + fulladdr.glade.h + + + + GnomeDialog + dialog-checkaddress + False + Check Address + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + vbox-container + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + hbuttonbox1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkTable + table-checkaddress + 8 + 5 + 4 + False + 6 + 21 + + 0 + True + True + + + + GtkEntry + entry-city + True + True + True + 0 + + + 1 + 4 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label2 + + GTK_JUSTIFY_LEFT + False + 0 + 0 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label5 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label7 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + entry-region + True + True + True + 0 + + + 1 + 2 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label6 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 3 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + entry-code + True + True + True + 0 + + + 3 + 4 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0 + 0 + 0 + entry-ext + + 2 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + + GtkAlignment + alignment1 + 0.5 + 0 + 1 + 0 + + 3 + 4 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + GtkEntry + entry-ext + True + True + True + 0 + + + + + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 0 + 1 + 0 + 0 + True + True + False + False + True + True + + + + GtkText + text-street + True + True + + + + + + GtkCombo + combo-country + False + True + False + True + False + USA +Canada +Finland + + + 1 + 4 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry-country + True + True + True + 0 + + + + + + GtkLabel + label8 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + entry-po + True + True + True + 0 + + + 1 + 4 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + + + diff --git a/addressbook/gui/contact-editor/fulladdr.glade.h b/addressbook/gui/contact-editor/fulladdr.glade.h new file mode 100644 index 0000000000..2a76706d6e --- /dev/null +++ b/addressbook/gui/contact-editor/fulladdr.glade.h @@ -0,0 +1,18 @@ +/* + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in. + * DO NOT compile it as part of your application. + */ + +gchar *s = N_("Check Address"); +gchar *s = N_("_Street Address:"); +gchar *s = N_("City:"); +gchar *s = N_("State/Province:"); +gchar *s = N_("Country:"); +gchar *s = N_("ZIP/Postal Code:"); +gchar *s = N_("E_xt:"); +gchar *s = N_("USA\n" + "Canada\n" + "Finland\n" + ""); +gchar *s = N_("PO Box:"); diff --git a/addressbook/gui/contact-editor/fullname-strings.h b/addressbook/gui/contact-editor/fullname-strings.h index 0c84dfdc8f..4d4303270a 100644 --- a/addressbook/gui/contact-editor/fullname-strings.h +++ b/addressbook/gui/contact-editor/fullname-strings.h @@ -5,11 +5,6 @@ */ gchar *s = N_("Check Full Name"); -gchar *s = N_("_Title:"); -gchar *s = N_("_First:"); -gchar *s = N_("_Middle:"); -gchar *s = N_("_Last:"); -gchar *s = N_("_Suffix:"); gchar *s = N_("\n" "Mr.\n" "Mrs.\n" @@ -23,3 +18,8 @@ gchar *s = N_("\n" "III\n" "Esq.\n" ""); +gchar *s = N_("_First:"); +gchar *s = N_("_Title:"); +gchar *s = N_("_Middle:"); +gchar *s = N_("_Last:"); +gchar *s = N_("_Suffix:"); diff --git a/addressbook/gui/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade index 8f811c5616..f2dfa23834 100644 --- a/addressbook/gui/contact-editor/fullname.glade +++ b/addressbook/gui/contact-editor/fullname.glade @@ -14,13 +14,6 @@ False False False - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h True fullname-strings.h @@ -51,6 +44,40 @@ True + + GtkHButtonBox + GnomeDialog:action_area + hbuttonbox1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + GtkTable table-checkfullname @@ -66,136 +93,6 @@ True - - GtkAccelLabel - accellabel1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel2 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel3 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel4 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel5 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - GtkCombo combo-title @@ -350,39 +247,140 @@ Esq. False - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-first + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-title + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_CANCEL + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-middle + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label5 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-last + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + GtkLabel + label4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-suffix + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + diff --git a/e-util/ename/Makefile.am b/e-util/ename/Makefile.am index 6e4d3818f2..068de01d90 100644 --- a/e-util/ename/Makefile.am +++ b/e-util/ename/Makefile.am @@ -21,11 +21,13 @@ ename_libs = \ lib_LTLIBRARIES = libename.la libename_la_SOURCES = \ + e-address-western.c \ e-name-western.c libenameincludedir = $(includedir)/ename libenameinclude_HEADERS = \ + e-address-western.h \ e-name-western-tables.h \ e-name-western.h diff --git a/e-util/ename/e-address-western.c b/e-util/ename/e-address-western.c index b6ced3bebf..3e5d491b90 100644 --- a/e-util/ename/e-address-western.c +++ b/e-util/ename/e-address-western.c @@ -45,7 +45,7 @@ e_address_western_is_line_blank (gchar *line) /* In the array of lines, `lines', we will erase the line at line_num, and shift the remaining lines, up to line number num_lines, up one position. */ -void +static void e_address_western_shift_line (gchar *lines[], gint line_num, gint num_lines) { gint cntr; @@ -83,10 +83,10 @@ e_address_western_remove_blank_lines (gchar *lines[], gint *linecntr) } -gboolean +static gboolean e_address_western_is_po_box (gchar *line) { - gboolean retval; + gboolean retval = FALSE; /* In which phase of processing are we? */ enum State { FIRSTCHAR, SECONDCHAR, WHITESPACE } state; @@ -138,7 +138,7 @@ e_address_western_is_po_box (gchar *line) /* A line that contains a comma followed eventually by a number is deemed to be the line in the form of . */ -gboolean +static gboolean e_address_western_is_postal (gchar *line) { gboolean retval; @@ -182,13 +182,13 @@ e_address_western_is_postal (gchar *line) return retval; } -gchar * +static gchar * e_address_western_extract_po_box (gchar *line) { return g_strdup (line); } -gchar * +static gchar * e_address_western_extract_locality (gchar *line) { gint index; @@ -206,7 +206,7 @@ e_address_western_extract_locality (gchar *line) /* Whatever resides between the comma and the start of the postal code is deemed to be the region. */ -gchar * +static gchar * e_address_western_extract_region (gchar *line) { gint start, end; @@ -231,7 +231,7 @@ e_address_western_extract_region (gchar *line) return g_strndup ( (line+start), end-start); } -gchar * +static gchar * e_address_western_extract_postal_code (gchar *line) { int start, end; @@ -261,7 +261,9 @@ e_address_western_parse (const gchar *in_address) gboolean found_po_box, found_postal; EAddressWestern *eaw; +#ifndef NO_WARNINGS gint start, end; /* To be used to classify address lines. */ +#endif if (in_address == NULL) return NULL; -- cgit v1.2.3