diff options
33 files changed, 2280 insertions, 688 deletions
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 <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. + +2000-09-10 Christopher James Lahey <clahey@helixcode.com> + + * ename/e-address-western.c: Added by Jesse. + 2000-09-08 Lauris Kaplinski <lauris@helixcode.com> * 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 <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); 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 @@ -1001,33 +1001,6 @@ </widget> <widget> - <class>GtkLabel</class> - <name>address-label</name> - <label>Address:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>text-address</focus_target> - <child> - <left_attach>5</left_attach> - <right_attach>7</right_attach> - <top_attach>6</top_attach> - <bottom_attach>7</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> <class>GtkEventBox</class> <name>eventbox1</name> <child> @@ -1647,6 +1620,27 @@ <yfill>True</yfill> </child> </widget> + + <widget> + <class>GtkButton</class> + <name>button-fulladdr</name> + <can_focus>True</can_focus> + <label>_Address...</label> + <child> + <left_attach>5</left_attach> + <right_attach>7</right_attach> + <top_attach>6</top_attach> + <bottom_attach>7</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> </widget> <widget> 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 <clahey@helixcode.com> + * + * 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 <config.h> +#include <gnome.h> +#include <e-util/e-unicode.h> +#include <e-contact-editor-address.h> + +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 <clahey@helixcode.com> + * + * 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 <gnome.h> +#include <glade/glade.h> +#include <ebook/e-card.h> + +#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 <gnome.h> #include "e-contact-editor.h" #include <e-contact-editor-fullname.h> +#include <e-contact-editor-address.h> #include <e-contact-editor-categories.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gnome-canvas-pixbuf.h> @@ -501,6 +502,41 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor) } 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) { char *categories; @@ -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 @@ +<?xml version="1.0"?> +<GTK-Interface> + +<project> + <name>fulladdr</name> + <program_name>fulladdr</program_name> + <directory></directory> + <source_directory>src</source_directory> + <pixmaps_directory>pixmaps</pixmaps_directory> + <language>C</language> + <gnome_support>True</gnome_support> + <gettext_support>True</gettext_support> + <use_widget_names>True</use_widget_names> + <output_main_file>False</output_main_file> + <output_support_files>False</output_support_files> + <output_build_files>False</output_build_files> + <output_translatable_strings>True</output_translatable_strings> + <translatable_strings_file>fulladdr.glade.h</translatable_strings_file> +</project> + +<widget> + <class>GnomeDialog</class> + <name>dialog-checkaddress</name> + <visible>False</visible> + <title>Check Address</title> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>True</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>False</auto_shrink> + <auto_close>False</auto_close> + <hide_on_close>False</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>vbox-container</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>hbuttonbox1</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button2</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> + <class>GtkTable</class> + <name>table-checkaddress</name> + <border_width>8</border_width> + <rows>5</rows> + <columns>4</columns> + <homogeneous>False</homogeneous> + <row_spacing>6</row_spacing> + <column_spacing>21</column_spacing> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkEntry</class> + <name>entry-city</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label2</name> + <label>_Street Address:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label4</name> + <label>City:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label5</name> + <label>State/Province:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label7</name> + <label>Country:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-region</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label6</name> + <label>ZIP/Postal Code:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-code</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label3</name> + <label>E_xt:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-ext</focus_target> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkAlignment</class> + <name>alignment1</name> + <xalign>0.5</xalign> + <yalign>0</yalign> + <xscale>1</xscale> + <yscale>0</yscale> + <child> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkEntry</class> + <name>entry-ext</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkText</class> + <name>text-street</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkCombo</class> + <name>combo-country</name> + <value_in_list>False</value_in_list> + <ok_if_empty>True</ok_if_empty> + <case_sensitive>False</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items>USA +Canada +Finland +</items> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + + <widget> + <class>GtkEntry</class> + <child_name>GtkCombo:entry</child_name> + <name>entry-country</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label8</name> + <label>PO Box:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-po</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + </widget> +</widget> + +</GTK-Interface> 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 @@ <output_main_file>False</output_main_file> <output_support_files>False</output_support_files> <output_build_files>False</output_build_files> - <backup_source_files>True</backup_source_files> - <main_source_file>interface.c</main_source_file> - <main_header_file>interface.h</main_header_file> - <handler_source_file>callbacks.c</handler_source_file> - <handler_header_file>callbacks.h</handler_header_file> - <support_source_file>support.c</support_source_file> - <support_header_file>support.h</support_header_file> <output_translatable_strings>True</output_translatable_strings> <translatable_strings_file>fullname-strings.h</translatable_strings_file> </project> @@ -52,6 +45,40 @@ </child> <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>hbuttonbox1</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button2</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> <class>GtkTable</class> <name>table-checkfullname</name> <border_width>8</border_width> @@ -67,136 +94,6 @@ </child> <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>_Title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>_First:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel3</name> - <label>_Middle:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel4</name> - <label>_Last:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel5</name> - <label>_Suffix:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> <class>GtkCombo</class> <name>combo-title</name> <value_in_list>False</value_in_list> @@ -350,39 +247,140 @@ Esq. <yfill>False</yfill> </child> </widget> - </widget> - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> + <widget> + <class>GtkLabel</class> + <name>label2</name> + <label>_First:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-first</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + <class>GtkLabel</class> + <name>label1</name> + <label>_Title:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-title</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> </widget> <widget> - <class>GtkButton</class> - <name>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + <class>GtkLabel</class> + <name>label3</name> + <label>_Middle:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-middle</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label5</name> + <label>_Last:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-last</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label4</name> + <label>_Suffix:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-suffix</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> </widget> </widget> </widget> 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 <town, region postal-code>. */ -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 @@ -1001,33 +1001,6 @@ </widget> <widget> - <class>GtkLabel</class> - <name>address-label</name> - <label>Address:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>text-address</focus_target> - <child> - <left_attach>5</left_attach> - <right_attach>7</right_attach> - <top_attach>6</top_attach> - <bottom_attach>7</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> <class>GtkEventBox</class> <name>eventbox1</name> <child> @@ -1647,6 +1620,27 @@ <yfill>True</yfill> </child> </widget> + + <widget> + <class>GtkButton</class> + <name>button-fulladdr</name> + <can_focus>True</can_focus> + <label>_Address...</label> + <child> + <left_attach>5</left_attach> + <right_attach>7</right_attach> + <top_attach>6</top_attach> + <bottom_attach>7</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> </widget> <widget> 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 <clahey@helixcode.com> + * + * 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 <config.h> +#include <gnome.h> +#include <e-util/e-unicode.h> +#include <e-contact-editor-address.h> + +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 <clahey@helixcode.com> + * + * 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 <gnome.h> +#include <glade/glade.h> +#include <ebook/e-card.h> + +#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 <gnome.h> #include "e-contact-editor.h" #include <e-contact-editor-fullname.h> +#include <e-contact-editor-address.h> #include <e-contact-editor-categories.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gnome-canvas-pixbuf.h> @@ -501,6 +502,41 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor) } 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) { char *categories; @@ -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 @@ +<?xml version="1.0"?> +<GTK-Interface> + +<project> + <name>fulladdr</name> + <program_name>fulladdr</program_name> + <directory></directory> + <source_directory>src</source_directory> + <pixmaps_directory>pixmaps</pixmaps_directory> + <language>C</language> + <gnome_support>True</gnome_support> + <gettext_support>True</gettext_support> + <use_widget_names>True</use_widget_names> + <output_main_file>False</output_main_file> + <output_support_files>False</output_support_files> + <output_build_files>False</output_build_files> + <output_translatable_strings>True</output_translatable_strings> + <translatable_strings_file>fulladdr.glade.h</translatable_strings_file> +</project> + +<widget> + <class>GnomeDialog</class> + <name>dialog-checkaddress</name> + <visible>False</visible> + <title>Check Address</title> + <type>GTK_WINDOW_TOPLEVEL</type> + <position>GTK_WIN_POS_NONE</position> + <modal>True</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>False</auto_shrink> + <auto_close>False</auto_close> + <hide_on_close>False</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>vbox-container</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>hbuttonbox1</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button2</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> + <class>GtkTable</class> + <name>table-checkaddress</name> + <border_width>8</border_width> + <rows>5</rows> + <columns>4</columns> + <homogeneous>False</homogeneous> + <row_spacing>6</row_spacing> + <column_spacing>21</column_spacing> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkEntry</class> + <name>entry-city</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label2</name> + <label>_Street Address:</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label4</name> + <label>City:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label5</name> + <label>State/Province:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label7</name> + <label>Country:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-region</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label6</name> + <label>ZIP/Postal Code:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-code</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label3</name> + <label>E_xt:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-ext</focus_target> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkAlignment</class> + <name>alignment1</name> + <xalign>0.5</xalign> + <yalign>0</yalign> + <xscale>1</xscale> + <yscale>0</yscale> + <child> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkEntry</class> + <name>entry-ext</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>True</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + + <widget> + <class>GtkText</class> + <name>text-street</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkCombo</class> + <name>combo-country</name> + <value_in_list>False</value_in_list> + <ok_if_empty>True</ok_if_empty> + <case_sensitive>False</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items>USA +Canada +Finland +</items> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + + <widget> + <class>GtkEntry</class> + <child_name>GtkCombo:entry</child_name> + <name>entry-country</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label8</name> + <label>PO Box:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-po</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>4</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + </widget> + </widget> +</widget> + +</GTK-Interface> 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 @@ <output_main_file>False</output_main_file> <output_support_files>False</output_support_files> <output_build_files>False</output_build_files> - <backup_source_files>True</backup_source_files> - <main_source_file>interface.c</main_source_file> - <main_header_file>interface.h</main_header_file> - <handler_source_file>callbacks.c</handler_source_file> - <handler_header_file>callbacks.h</handler_header_file> - <support_source_file>support.c</support_source_file> - <support_header_file>support.h</support_header_file> <output_translatable_strings>True</output_translatable_strings> <translatable_strings_file>fullname-strings.h</translatable_strings_file> </project> @@ -52,6 +45,40 @@ </child> <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>hbuttonbox1</name> + <layout_style>GTK_BUTTONBOX_END</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button2</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> <class>GtkTable</class> <name>table-checkfullname</name> <border_width>8</border_width> @@ -67,136 +94,6 @@ </child> <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>_Title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>_First:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel3</name> - <label>_Middle:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel4</name> - <label>_Last:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel5</name> - <label>_Suffix:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> <class>GtkCombo</class> <name>combo-title</name> <value_in_list>False</value_in_list> @@ -350,39 +247,140 @@ Esq. <yfill>False</yfill> </child> </widget> - </widget> - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> + <widget> + <class>GtkLabel</class> + <name>label2</name> + <label>_First:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-first</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + <class>GtkLabel</class> + <name>label1</name> + <label>_Title:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-title</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> </widget> <widget> - <class>GtkButton</class> - <name>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + <class>GtkLabel</class> + <name>label3</name> + <label>_Middle:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-middle</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label5</name> + <label>_Last:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-last</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> + <class>GtkLabel</class> + <name>label4</name> + <label>_Suffix:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <focus_target>entry-suffix</focus_target> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> </widget> </widget> </widget> 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 <town, region postal-code>. */ -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; |