diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 13 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card-types.h | 2 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 97 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.h | 7 | ||||
-rw-r--r-- | addressbook/contact-editor/contact-editor.glade | 484 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor-strings.h | 2 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.c | 243 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.h | 2 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/contact-editor.glade | 484 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor-strings.h | 2 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 243 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 2 |
12 files changed, 737 insertions, 844 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d8a7152bb9..859932ff81 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,18 @@ 2000-04-26 Christopher James Lahey <clahey@helixcode.com> + * backend/ebook/e-card-types.h, backend/ebook/e-card.c, + backend/ebook/e-card.h: Added an address label field. + + * contact-editor/contact-editor.glade, + contact-editor/e-contact-editor-strings.h: Got rid of some unused + fields. + + * contact-editor/e-contact-editor.c, + contact-editor/e-contact-editor.h: Added the address label field. + Load only. Editing these fields seems to mess things up. + +2000-04-26 Christopher James Lahey <clahey@helixcode.com> + * contact-editor/e-contact-editor.c: Added proper handling of the email field. diff --git a/addressbook/backend/ebook/e-card-types.h b/addressbook/backend/ebook/e-card-types.h index d530f69f8b..eb39565aa6 100644 --- a/addressbook/backend/ebook/e-card-types.h +++ b/addressbook/backend/ebook/e-card-types.h @@ -200,12 +200,12 @@ typedef struct { char *country; } ECardDeliveryAddress; -#if 0 typedef struct { ECardAddressFlags flags; char *data; } ECardAddrLabel; +#if 0 /* ORGANIZATIONAL PROPERTIES */ typedef struct { diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 23c9df5d36..8c7139da79 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -28,6 +28,7 @@ enum { ARG_FULL_NAME, ARG_NAME, ARG_ADDRESS, + ARG_ADDRESS_LABEL, ARG_PHONE, ARG_EMAIL, ARG_BIRTH_DATE, @@ -65,6 +66,7 @@ static void parse_name(ECard *card, VObject *object); static void parse_email(ECard *card, VObject *object); static void parse_phone(ECard *card, VObject *object); static void parse_address(ECard *card, VObject *object); +static void parse_address_label(ECard *card, VObject *object); static void parse_url(ECard *card, VObject *object); static void parse_org(ECard *card, VObject *object); static void parse_title(ECard *card, VObject *object); @@ -86,20 +88,21 @@ struct { ParsePropertyFunc function; } attribute_jump_array[] = { - { VCFullNameProp, parse_full_name }, - { VCNameProp, parse_name }, - { VCBirthDateProp, parse_bday }, - { VCEmailAddressProp, parse_email }, - { VCTelephoneProp, parse_phone }, - { VCAdrProp, parse_address }, - { VCURLProp, parse_url }, - { VCOrgProp, parse_org }, - { VCTitleProp, parse_title }, - { VCBusinessRoleProp, parse_role }, - { "NICKNAME", parse_nickname }, - { "FBURL", parse_fburl }, - { VCNoteProp, parse_note }, - { VCUniqueStringProp, parse_id } + { VCFullNameProp, parse_full_name }, + { VCNameProp, parse_name }, + { VCBirthDateProp, parse_bday }, + { VCEmailAddressProp, parse_email }, + { VCTelephoneProp, parse_phone }, + { VCAdrProp, parse_address }, + { VCDeliveryLabelProp, parse_address_label }, + { VCURLProp, parse_url }, + { VCOrgProp, parse_org }, + { VCTitleProp, parse_title }, + { VCBusinessRoleProp, parse_role }, + { "NICKNAME", parse_nickname }, + { "FBURL", parse_fburl }, + { VCNoteProp, parse_note }, + { VCUniqueStringProp, parse_id } }; /** @@ -251,6 +254,22 @@ char gtk_object_unref(GTK_OBJECT(iterator)); } + if ( card->address_label ) { + ECardIterator *iterator = e_card_list_get_iterator(card->address_label); + for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) { + VObject *labelprop; + ECardAddrLabel *address_label = (ECardAddrLabel *) e_card_iterator_get(iterator); + if (address_label->data) + labelprop = addPropValue(vobj, VCDeliveryLabelProp, address_label->data); + else + labelprop = addProp(vobj, VCDeliveryLabelProp); + + set_address_flags (labelprop, address_label->flags); + addProp(labelprop, VCQuotedPrintableProp); + } + gtk_object_unref(GTK_OBJECT(iterator)); + } + if ( card->phone ) { ECardIterator *iterator = e_card_list_get_iterator(card->phone); for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) { @@ -507,6 +526,22 @@ parse_address(ECard *card, VObject *vobj) } static void +parse_address_label(ECard *card, VObject *vobj) +{ + ECardAddrLabel *next_addr = g_new(ECardAddrLabel, 1); + ECardList *list; + + next_addr->flags = get_address_flags (vobj); + assign_string(vobj, &next_addr->data); + + gtk_object_get(GTK_OBJECT(card), + "address_label", &list, + NULL); + e_card_list_append(list, next_addr); + e_card_address_label_free (next_addr); +} + +static void parse_url(ECard *card, VObject *vobj) { if (card->url) @@ -619,6 +654,8 @@ e_card_class_init (ECardClass *klass) GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME); gtk_object_add_arg_type ("ECard::address", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS); + gtk_object_add_arg_type ("ECard::address_label", + GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL); gtk_object_add_arg_type ("ECard::phone", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE); gtk_object_add_arg_type ("ECard::email", @@ -712,6 +749,28 @@ e_card_delivery_address_copy (const ECardDeliveryAddress *addr) return NULL; } +void +e_card_address_label_free (ECardAddrLabel *addr) +{ + if ( addr ) { + if ( addr->data ) + g_free(addr->data); + g_free(addr); + } +} + +ECardAddrLabel * +e_card_address_label_copy (const ECardAddrLabel *addr) +{ + if ( addr ) { + ECardAddrLabel *addr_copy = g_new(ECardAddrLabel, 1); + addr_copy->data = g_strdup(addr->data); + addr_copy->flags = addr->flags; + return addr_copy; + } else + return NULL; +} + /* * ECard lifecycle management and vCard loading/saving. */ @@ -752,6 +811,8 @@ e_card_destroy (GtkObject *object) gtk_object_unref(GTK_OBJECT(card->phone)); if (card->address) gtk_object_unref(GTK_OBJECT(card->address)); + if (card->address_label) + gtk_object_unref(GTK_OBJECT(card->address_label)); } @@ -851,6 +912,13 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address); break; + case ARG_ADDRESS_LABEL: + if (!card->address_label) + card->address_label = e_card_list_new((ECardListCopyFunc) e_card_address_label_copy, + (ECardListFreeFunc) e_card_address_label_free, + NULL); + GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address_label); + break; case ARG_PHONE: if (!card->phone) card->phone = e_card_list_new((ECardListCopyFunc) e_card_phone_copy, @@ -916,6 +984,7 @@ e_card_init (ECard *card) card->email = NULL; card->phone = NULL; card->address = NULL; + card->address_label = NULL; card->url = NULL; card->org = NULL; card->org_unit = NULL; diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index b10585c4a8..774c327371 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -34,10 +34,9 @@ struct _ECard { char *fname; /* The full name. */ ECardName *name; /* The structured name. */ ECardList *address; /* Delivery addresses (ECardDeliveryAddress *) */ -#if 0 - GList *del_labels; /* Delivery address labels + ECardList *address_label; /* Delivery address labels * (ECardAddrLabel *) */ -#endif + ECardList *phone; /* Phone numbers (ECardPhone *) */ ECardList *email; /* Email addresses (char *) */ char *url; /* The person's web page. */ @@ -106,6 +105,8 @@ void e_card_phone_free (ECardPhone *phone); ECardPhone *e_card_phone_copy (const ECardPhone *phone); void e_card_delivery_address_free (ECardDeliveryAddress *addr); ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr); +void e_card_address_label_free (ECardAddrLabel *addr); +ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr); /* Standard Gtk function */ diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade index 139e652056..cd17ffd288 100644 --- a/addressbook/contact-editor/contact-editor.glade +++ b/addressbook/contact-editor/contact-editor.glade @@ -47,7 +47,7 @@ <class>GtkTable</class> <name>table-contact-editor-general</name> <border_width>7</border_width> - <rows>12</rows> + <rows>11</rows> <columns>8</columns> <homogeneous>False</homogeneous> <row_spacing>4</row_spacing> @@ -150,54 +150,6 @@ </widget> <widget> - <class>GtkEntry</class> - <name>entry-fullname</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>0</top_attach> - <bottom_attach>1</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>GtkEntry</class> - <name>entry-web</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>8</top_attach> - <bottom_attach>9</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>label-phone3</name> <label>Business Fax</label> @@ -483,7 +435,7 @@ <spacing>0</spacing> <child> <left_attach>0</left_attach> - <right_attach>8</right_attach> + <right_attach>7</right_attach> <top_attach>10</top_attach> <bottom_attach>11</bottom_attach> <xpad>0</xpad> @@ -528,81 +480,6 @@ </widget> <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <left_attach>0</left_attach> - <right_attach>8</right_attach> - <top_attach>11</top_attach> - <bottom_attach>12</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-contacts</name> - <can_focus>True</can_focus> - <label>Contacts...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-contacts</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-categories</name> - <can_focus>True</can_focus> - <label>Categories...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-categories</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> <class>GtkAlignment</class> <name>alignment2</name> <xalign>0</xalign> @@ -656,141 +533,6 @@ </widget> <widget> - <class>GtkEntry</class> - <name>entry-jobtitle</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>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> - <class>GtkEntry</class> - <name>entry-company</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>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>GtkCombo</class> - <name>combo-fileas</name> - <can_focus>True</can_focus> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>True</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - <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>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-fileas</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>GtkHBox</class> - <name>hbox4</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>5</top_attach> - <bottom_attach>6</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> - <name>entry-email1</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button23</name> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> <class>GtkAlignment</class> <name>alignment3</name> <xalign>1</xalign> @@ -978,12 +720,12 @@ <widget> <class>GtkHSeparator</class> - <name>hseparator6</name> + <name>hseparator4</name> <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>7</top_attach> - <bottom_attach>8</bottom_attach> + <left_attach>4</left_attach> + <right_attach>8</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> <xpad>0</xpad> <ypad>2</ypad> <xexpand>True</xexpand> @@ -991,20 +733,153 @@ <xshrink>False</xshrink> <yshrink>False</yshrink> <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkAlignment</class> + <name>alignment6</name> + <xalign>1</xalign> + <yalign>0.5</yalign> + <xscale>0</xscale> + <yscale>0</yscale> + <child> + <left_attach>6</left_attach> + <right_attach>7</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> + <class>GtkButton</class> + <name>button-phone3</name> + + <widget> + <class>Placeholder</class> + </widget> + </widget> </widget> <widget> - <class>GtkHSeparator</class> - <name>hseparator4</name> + <class>GtkEntry</class> + <name>entry-fullname</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>4</left_attach> - <right_attach>8</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> <xpad>0</xpad> - <ypad>2</ypad> + <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>GtkEntry</class> + <name>entry-jobtitle</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>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> + <class>GtkEntry</class> + <name>entry-company</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>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>GtkEntry</class> + <name>entry-email1</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>5</top_attach> + <bottom_attach>6</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>GtkEntry</class> + <name>entry-web</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>8</top_attach> + <bottom_attach>9</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> @@ -1034,38 +909,61 @@ </widget> <widget> - <class>GtkAlignment</class> - <name>alignment6</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> + <class>GtkCombo</class> + <name>combo-fileas</name> + <value_in_list>False</value_in_list> + <ok_if_empty>True</ok_if_empty> + <case_sensitive>True</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items></items> <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> + <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> + <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> <yshrink>False</yshrink> <xfill>True</xfill> - <yfill>True</yfill> + <yfill>False</yfill> </child> <widget> - <class>GtkButton</class> - <name>button-phone3</name> - - <widget> - <class>Placeholder</class> - </widget> + <class>GtkEntry</class> + <child_name>GtkCombo:entry</child_name> + <name>combo-entry1</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>GtkHSeparator</class> + <name>hseparator6</name> + <child> + <left_attach>0</left_attach> + <right_attach>4</right_attach> + <top_attach>7</top_attach> + <bottom_attach>8</bottom_attach> + <xpad>0</xpad> + <ypad>2</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> <class>GtkCheckButton</class> <name>checkbutton-htmlmail</name> <can_focus>True</can_focus> @@ -1081,10 +979,10 @@ <ypad>0</ypad> <xexpand>True</xexpand> <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> + <xshrink>True</xshrink> + <yshrink>True</yshrink> <xfill>True</xfill> - <yfill>False</yfill> + <yfill>True</yfill> </child> </widget> </widget> diff --git a/addressbook/contact-editor/e-contact-editor-strings.h b/addressbook/contact-editor/e-contact-editor-strings.h index 28fce326e1..7f0a8a83f1 100644 --- a/addressbook/contact-editor/e-contact-editor-strings.h +++ b/addressbook/contact-editor/e-contact-editor-strings.h @@ -15,8 +15,6 @@ gchar *s = N_("Job Title:"); gchar *s = N_("Company:"); gchar *s = N_("File As:"); gchar *s = N_("Web page address:"); -gchar *s = N_("Contacts..."); -gchar *s = N_("Categories..."); gchar *s = N_("This is the mailing address"); gchar *s = N_("A_ddress..."); gchar *s = N_("Business"); diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index f12660be18..91339e9da3 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -76,14 +76,12 @@ ECardPhoneFlags phone_correspondences[] = { 0xFF, /* E_CONTACT_EDITOR_PHONE_ID_TTYTTD, */ }; -#if 0 -enum _EContactEditorAddressId { - E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS, - E_CONTACT_EDITOR_ADDRESS_ID_HOME, - E_CONTACT_EDITOR_ADDRESS_ID_OTHER, +ECardAddressFlags addr_correspondences[] = { + E_CARD_ADDR_WORK, /* E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS, */ + E_CARD_ADDR_HOME, /* E_CONTACT_EDITOR_ADDRESS_ID_HOME, */ + E_CARD_ADDR_POSTAL, /* E_CONTACT_EDITOR_ADDRESS_ID_OTHER, */ E_CONTACT_EDITOR_ADDRESS_ID_LAST }; -#endif GtkType e_contact_editor_get_type (void) @@ -161,8 +159,7 @@ _add_details_images(GtkTable *table) { _add_image(table, DATADIR "/evolution/briefcase.png", 0, 1, 0, 2); _add_image(table, DATADIR "/evolution/head.png", 0, 1, 4, 6); - _add_image(table, DATADIR "/evolution/netmeeting.png", 0, 1, 7, 9); - _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 10, 12); + _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 7, 9); } static void @@ -191,7 +188,7 @@ _replace_buttons(EContactEditor *editor) } static void -phone_label_changed (GtkWidget *widget, EContactEditor *editor) +phone_entry_changed (GtkWidget *widget, EContactEditor *editor) { int which; gchar *string; @@ -208,30 +205,21 @@ phone_label_changed (GtkWidget *widget, EContactEditor *editor) } else return; string = gtk_entry_get_text(entry); - if (string) { - if (editor->phone[editor->phone_choice[which - 1]]) { - if (editor->phone[editor->phone_choice[which - 1]]->number) - g_free(editor->phone[editor->phone_choice[which - 1]]->number); - editor->phone[editor->phone_choice[which - 1]]->number = NULL; - } else { - editor->phone[editor->phone_choice[which - 1]] = g_new(ECardPhone, 1); - editor->phone[editor->phone_choice[which - 1]]->number = NULL; - editor->phone[editor->phone_choice[which - 1]]->flags = 0; - } - editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(string); + if (editor->phone[editor->phone_choice[which - 1]]) { + if (editor->phone[editor->phone_choice[which - 1]]->number) + g_free(editor->phone[editor->phone_choice[which - 1]]->number); + editor->phone[editor->phone_choice[which - 1]]->number = NULL; } else { - if (editor->phone[editor->phone_choice[which - 1]]) { - if (editor->phone[editor->phone_choice[which - 1]]->number) { - g_free(editor->phone[editor->phone_choice[which - 1]]->number); - editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(""); - } - } + editor->phone[editor->phone_choice[which - 1]] = g_new(ECardPhone, 1); + editor->phone[editor->phone_choice[which - 1]]->number = NULL; + editor->phone[editor->phone_choice[which - 1]]->flags = 0; } + editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(string); set_fields(editor); } static void -email_label_changed (GtkWidget *widget, EContactEditor *editor) +email_entry_changed (GtkWidget *widget, EContactEditor *editor) { gchar *string; GtkEntry *entry = GTK_ENTRY(widget); @@ -244,8 +232,31 @@ email_label_changed (GtkWidget *widget, EContactEditor *editor) string = gtk_entry_get_text(entry); editor->email[editor->email_choice] = g_strdup(string); +} - set_fields(editor); +static void +address_text_changed (GtkWidget *widget, EContactEditor *editor) +{ + gchar *string; + GtkEditable *editable = GTK_EDITABLE(widget); + + if (editor->address[editor->address_choice]) { + g_free(editor->address[editor->address_choice]); + editor->address[editor->address_choice] = NULL; + } + + string = gtk_editable_get_chars(editable, 0, -1); + if (editor->address[editor->address_choice]) { + if (editor->address[editor->address_choice]->data) + g_free(editor->address[editor->address_choice]->data); + editor->address[editor->address_choice]->data = NULL; + } else { + editor->address[editor->address_choice] = g_new(ECardAddrLabel, 1); + editor->address[editor->address_choice]->data = NULL; + editor->address[editor->address_choice]->flags = 0; + } + editor->address[editor->address_choice]->data = g_strdup(string); + g_free(string); } static void @@ -253,7 +264,7 @@ set_entry_changed_signal_phone(EContactEditor *editor, char *id) { GtkWidget *widget = glade_xml_get_widget(editor->gui, id); gtk_signal_connect(GTK_OBJECT(widget), "changed", - phone_label_changed, editor); + phone_entry_changed, editor); } static void @@ -266,7 +277,10 @@ set_entry_changed_signals(EContactEditor *editor) set_entry_changed_signal_phone(editor, "entry-phone4"); widget = glade_xml_get_widget(editor->gui, "entry-email1"); gtk_signal_connect(GTK_OBJECT(widget), "changed", - email_label_changed, editor); + email_entry_changed, editor); + widget = glade_xml_get_widget(editor->gui, "text-address"); + gtk_signal_connect(GTK_OBJECT(widget), "changed", + address_text_changed, editor); } static void @@ -699,8 +713,12 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito editor->address_popup = gnome_popup_menu_new(editor->address_info); } - result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "entry-address1", "Add new Address type"); - result ++; + result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "text-address", "Add new Address type"); + + if (result != -1) { + editor->address_choice = result; + set_fields(editor); + } } static void @@ -715,6 +733,9 @@ static void set_fields(EContactEditor *editor) { GtkEntry *entry; + GtkEditable *editable; + char *string = NULL; + int position; entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-phone1")); if (editor->phone[editor->phone_choice[0]]) @@ -731,6 +752,7 @@ set_fields(EContactEditor *editor) set_field(entry, editor->phone[editor->phone_choice[2]]->number); else set_field(entry, ""); + entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-phone4")); if (editor->phone[editor->phone_choice[3]]) set_field(entry, editor->phone[editor->phone_choice[3]]->number); @@ -741,6 +763,17 @@ set_fields(EContactEditor *editor) set_field(entry, editor->email[editor->email_choice]); else set_field(entry, ""); + + if (editor->address[editor->address_choice]) { + string = g_strdup (editor->address[editor->address_choice]->data); + } + position = 0; + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); + gtk_editable_delete_text(editable, 0, -1); + if (string) { + gtk_editable_insert_text(editable, string, strlen(string), &position); + g_free(string); + } } static void @@ -763,25 +796,26 @@ fill_in_info(EContactEditor *editor) const ECardPhone *phone; const char *email; const ECardDate *bday; + const ECardAddrLabel *address; GtkEditable *editable; int position = 0; ECardIterator *iterator; gtk_object_get(GTK_OBJECT(card), - "full_name", &fname, - "address", &address_list, - "phone", &phone_list, - "email", &email_list, - "url", &url, - "org", &org, - "org_unit", &org_unit, - "title", &title, - "role", &role, - "nickname", &nickname, - "fburl", &fburl, - "note", ¬e, - "birth_date", &bday, + "full_name", &fname, + "address_label", &address_list, + "phone", &phone_list, + "email", &email_list, + "url", &url, + "org", &org, + "org_unit", &org_unit, + "title", &title, + "role", &role, + "nickname", &nickname, + "fburl", &fburl, + "note", ¬e, + "birth_date", &bday, NULL); position = 0; @@ -789,39 +823,7 @@ fill_in_info(EContactEditor *editor) gtk_editable_delete_text(editable, 0, -1); if (fname) gtk_editable_insert_text(editable, fname, strlen(fname), &position); -#if 0 - position = 0; - iterator = e_card_list_get_iterator(address_list); - for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - address = e_card_iterator_get(iterator); - if (address->flags & E_CARD_ADDR_WORK) { - if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS]) { - e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS]); - } - editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS] = - e_card_delivery_address_copy(address); - } - if (address->flags & E_CARD_ADDR_HOME) { - if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME]) { - e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME]); - } - editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME] = - e_card_delivery_address_copy(address); - } - if (address->flags & E_CARD_ADDR_PARCEL) { - if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER]) { - e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER]); - } - editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER] = - e_card_delivery_address_copy(address); - } - } - editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); - gtk_editable_delete_text(editable, 0, -1); - if (address) - gtk_editable_insert_text(editable, address->city, strlen(address->city), &position); - gtk_object_unref(GTK_OBJECT(iterator)); -#endif + for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { int i; phone = e_card_iterator_get(iterator); @@ -846,6 +848,18 @@ fill_in_info(EContactEditor *editor) } gtk_object_unref(GTK_OBJECT(iterator)); + for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { + int i; + address = e_card_iterator_get(iterator); + for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) { + if (((address->flags & addr_correspondences[i]) == addr_correspondences[i]) && (editor->address[i] == NULL)) { + editor->address[i] = e_card_address_label_copy(address); + break; + } + } + } + gtk_object_unref(GTK_OBJECT(iterator)); + position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-web")); gtk_editable_delete_text(editable, 0, -1); @@ -927,6 +941,7 @@ extract_info(EContactEditor *editor) char *fburl; char *note; const ECardPhone *phone; + const ECardAddrLabel *address; const char *email; ECardDate *bday; GtkEditable *editable; @@ -940,9 +955,9 @@ extract_info(EContactEditor *editor) ECardIterator *iterator; gtk_object_get(GTK_OBJECT(card), - "address", &address_list, - "phone", &phone_list, - "email", &email_list, + "address_label", &address_list, + "phone", &phone_list, + "email", &email_list, NULL); position = 0; @@ -953,29 +968,6 @@ extract_info(EContactEditor *editor) "full_name", fname, NULL); g_free(fname); -#if 0 - iterator = e_card_list_get_iterator(address_list); - address = e_card_iterator_get(iterator); - editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); - string = gtk_editable_get_chars(editable, 0, -1); - if (string && *string) { - if (address) { - address_copy = e_card_delivery_address_copy(address); - if (address_copy->city) - g_free(address_copy->city); - address_copy->city = string; - e_card_iterator_set(iterator, address_copy); - e_card_delivery_address_free(address_copy); - } else { - address_copy = g_new0(ECardDeliveryAddress, 1); - address_copy->city = string; - e_card_list_append(address_list, address_copy); - e_card_delivery_address_free(address_copy); - } - } else - g_free(string); - gtk_object_unref(GTK_OBJECT(iterator)); -#endif for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { int i; @@ -1033,20 +1025,37 @@ extract_info(EContactEditor *editor) editor->email[i] = NULL; } } -#if 0 - position = 0; - iterator = e_card_list_get_iterator(email_list); - editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-email1")); - email = gtk_editable_get_chars(editable, 0, -1); - if (email && *email) { - if (e_card_iterator_is_valid(iterator)) - e_card_iterator_set(iterator, email); - else - e_card_list_append(email_list, email); - } - g_free(email); + + for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { + int i; + address = e_card_iterator_get(iterator); + iterator_next = 1; + for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) { + if ((address->flags & addr_correspondences[i]) == addr_correspondences[i]) { + if (editor->address[i]) { + if (editor->address[i]->data && *editor->address[i]->data) { + e_card_iterator_set(iterator, editor->address[i]); + } else { + e_card_iterator_delete(iterator); + iterator_next = 0; + } + e_card_address_label_free(editor->address[i]); + editor->address[i] = NULL; + break; + } + } + } + } gtk_object_unref(GTK_OBJECT(iterator)); -#endif + for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) { + if (editor->address[i]) { + editor->address[i]->flags = addr_correspondences[i]; + e_card_list_append(address_list, editor->address[i]); + e_card_address_label_free(editor->address[i]); + editor->address[i] = NULL; + } + } + position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-web")); url = gtk_editable_get_chars(editable, 0, -1); diff --git a/addressbook/contact-editor/e-contact-editor.h b/addressbook/contact-editor/e-contact-editor.h index fd80dc4c00..394d136eed 100644 --- a/addressbook/contact-editor/e-contact-editor.h +++ b/addressbook/contact-editor/e-contact-editor.h @@ -112,7 +112,7 @@ struct _EContactEditor ECardPhone *phone[E_CONTACT_EDITOR_PHONE_ID_LAST]; char *email[E_CONTACT_EDITOR_EMAIL_ID_LAST]; - ECardDeliveryAddress *address[E_CONTACT_EDITOR_ADDRESS_ID_LAST]; + ECardAddrLabel *address[E_CONTACT_EDITOR_ADDRESS_ID_LAST]; EContactEditorEmailId email_choice; EContactEditorPhoneId phone_choice[4]; diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index 139e652056..cd17ffd288 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -47,7 +47,7 @@ <class>GtkTable</class> <name>table-contact-editor-general</name> <border_width>7</border_width> - <rows>12</rows> + <rows>11</rows> <columns>8</columns> <homogeneous>False</homogeneous> <row_spacing>4</row_spacing> @@ -150,54 +150,6 @@ </widget> <widget> - <class>GtkEntry</class> - <name>entry-fullname</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>0</top_attach> - <bottom_attach>1</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>GtkEntry</class> - <name>entry-web</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>8</top_attach> - <bottom_attach>9</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>label-phone3</name> <label>Business Fax</label> @@ -483,7 +435,7 @@ <spacing>0</spacing> <child> <left_attach>0</left_attach> - <right_attach>8</right_attach> + <right_attach>7</right_attach> <top_attach>10</top_attach> <bottom_attach>11</bottom_attach> <xpad>0</xpad> @@ -528,81 +480,6 @@ </widget> <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - <child> - <left_attach>0</left_attach> - <right_attach>8</right_attach> - <top_attach>11</top_attach> - <bottom_attach>12</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-contacts</name> - <can_focus>True</can_focus> - <label>Contacts...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-contacts</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-categories</name> - <can_focus>True</can_focus> - <label>Categories...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-categories</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> <class>GtkAlignment</class> <name>alignment2</name> <xalign>0</xalign> @@ -656,141 +533,6 @@ </widget> <widget> - <class>GtkEntry</class> - <name>entry-jobtitle</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>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> - <class>GtkEntry</class> - <name>entry-company</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>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>GtkCombo</class> - <name>combo-fileas</name> - <can_focus>True</can_focus> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>True</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - <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>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-fileas</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>GtkHBox</class> - <name>hbox4</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>5</top_attach> - <bottom_attach>6</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> - <name>entry-email1</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button23</name> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> <class>GtkAlignment</class> <name>alignment3</name> <xalign>1</xalign> @@ -978,12 +720,12 @@ <widget> <class>GtkHSeparator</class> - <name>hseparator6</name> + <name>hseparator4</name> <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>7</top_attach> - <bottom_attach>8</bottom_attach> + <left_attach>4</left_attach> + <right_attach>8</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> <xpad>0</xpad> <ypad>2</ypad> <xexpand>True</xexpand> @@ -991,20 +733,153 @@ <xshrink>False</xshrink> <yshrink>False</yshrink> <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkAlignment</class> + <name>alignment6</name> + <xalign>1</xalign> + <yalign>0.5</yalign> + <xscale>0</xscale> + <yscale>0</yscale> + <child> + <left_attach>6</left_attach> + <right_attach>7</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> + <class>GtkButton</class> + <name>button-phone3</name> + + <widget> + <class>Placeholder</class> + </widget> + </widget> </widget> <widget> - <class>GtkHSeparator</class> - <name>hseparator4</name> + <class>GtkEntry</class> + <name>entry-fullname</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>4</left_attach> - <right_attach>8</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> <xpad>0</xpad> - <ypad>2</ypad> + <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>GtkEntry</class> + <name>entry-jobtitle</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>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> + <class>GtkEntry</class> + <name>entry-company</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>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>GtkEntry</class> + <name>entry-email1</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>5</top_attach> + <bottom_attach>6</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>GtkEntry</class> + <name>entry-web</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>8</top_attach> + <bottom_attach>9</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> @@ -1034,38 +909,61 @@ </widget> <widget> - <class>GtkAlignment</class> - <name>alignment6</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> + <class>GtkCombo</class> + <name>combo-fileas</name> + <value_in_list>False</value_in_list> + <ok_if_empty>True</ok_if_empty> + <case_sensitive>True</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items></items> <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> + <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> + <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> <yshrink>False</yshrink> <xfill>True</xfill> - <yfill>True</yfill> + <yfill>False</yfill> </child> <widget> - <class>GtkButton</class> - <name>button-phone3</name> - - <widget> - <class>Placeholder</class> - </widget> + <class>GtkEntry</class> + <child_name>GtkCombo:entry</child_name> + <name>combo-entry1</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>GtkHSeparator</class> + <name>hseparator6</name> + <child> + <left_attach>0</left_attach> + <right_attach>4</right_attach> + <top_attach>7</top_attach> + <bottom_attach>8</bottom_attach> + <xpad>0</xpad> + <ypad>2</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> + + <widget> <class>GtkCheckButton</class> <name>checkbutton-htmlmail</name> <can_focus>True</can_focus> @@ -1081,10 +979,10 @@ <ypad>0</ypad> <xexpand>True</xexpand> <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> + <xshrink>True</xshrink> + <yshrink>True</yshrink> <xfill>True</xfill> - <yfill>False</yfill> + <yfill>True</yfill> </child> </widget> </widget> diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h index 28fce326e1..7f0a8a83f1 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-strings.h +++ b/addressbook/gui/contact-editor/e-contact-editor-strings.h @@ -15,8 +15,6 @@ gchar *s = N_("Job Title:"); gchar *s = N_("Company:"); gchar *s = N_("File As:"); gchar *s = N_("Web page address:"); -gchar *s = N_("Contacts..."); -gchar *s = N_("Categories..."); gchar *s = N_("This is the mailing address"); gchar *s = N_("A_ddress..."); gchar *s = N_("Business"); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index f12660be18..91339e9da3 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -76,14 +76,12 @@ ECardPhoneFlags phone_correspondences[] = { 0xFF, /* E_CONTACT_EDITOR_PHONE_ID_TTYTTD, */ }; -#if 0 -enum _EContactEditorAddressId { - E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS, - E_CONTACT_EDITOR_ADDRESS_ID_HOME, - E_CONTACT_EDITOR_ADDRESS_ID_OTHER, +ECardAddressFlags addr_correspondences[] = { + E_CARD_ADDR_WORK, /* E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS, */ + E_CARD_ADDR_HOME, /* E_CONTACT_EDITOR_ADDRESS_ID_HOME, */ + E_CARD_ADDR_POSTAL, /* E_CONTACT_EDITOR_ADDRESS_ID_OTHER, */ E_CONTACT_EDITOR_ADDRESS_ID_LAST }; -#endif GtkType e_contact_editor_get_type (void) @@ -161,8 +159,7 @@ _add_details_images(GtkTable *table) { _add_image(table, DATADIR "/evolution/briefcase.png", 0, 1, 0, 2); _add_image(table, DATADIR "/evolution/head.png", 0, 1, 4, 6); - _add_image(table, DATADIR "/evolution/netmeeting.png", 0, 1, 7, 9); - _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 10, 12); + _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 7, 9); } static void @@ -191,7 +188,7 @@ _replace_buttons(EContactEditor *editor) } static void -phone_label_changed (GtkWidget *widget, EContactEditor *editor) +phone_entry_changed (GtkWidget *widget, EContactEditor *editor) { int which; gchar *string; @@ -208,30 +205,21 @@ phone_label_changed (GtkWidget *widget, EContactEditor *editor) } else return; string = gtk_entry_get_text(entry); - if (string) { - if (editor->phone[editor->phone_choice[which - 1]]) { - if (editor->phone[editor->phone_choice[which - 1]]->number) - g_free(editor->phone[editor->phone_choice[which - 1]]->number); - editor->phone[editor->phone_choice[which - 1]]->number = NULL; - } else { - editor->phone[editor->phone_choice[which - 1]] = g_new(ECardPhone, 1); - editor->phone[editor->phone_choice[which - 1]]->number = NULL; - editor->phone[editor->phone_choice[which - 1]]->flags = 0; - } - editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(string); + if (editor->phone[editor->phone_choice[which - 1]]) { + if (editor->phone[editor->phone_choice[which - 1]]->number) + g_free(editor->phone[editor->phone_choice[which - 1]]->number); + editor->phone[editor->phone_choice[which - 1]]->number = NULL; } else { - if (editor->phone[editor->phone_choice[which - 1]]) { - if (editor->phone[editor->phone_choice[which - 1]]->number) { - g_free(editor->phone[editor->phone_choice[which - 1]]->number); - editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(""); - } - } + editor->phone[editor->phone_choice[which - 1]] = g_new(ECardPhone, 1); + editor->phone[editor->phone_choice[which - 1]]->number = NULL; + editor->phone[editor->phone_choice[which - 1]]->flags = 0; } + editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(string); set_fields(editor); } static void -email_label_changed (GtkWidget *widget, EContactEditor *editor) +email_entry_changed (GtkWidget *widget, EContactEditor *editor) { gchar *string; GtkEntry *entry = GTK_ENTRY(widget); @@ -244,8 +232,31 @@ email_label_changed (GtkWidget *widget, EContactEditor *editor) string = gtk_entry_get_text(entry); editor->email[editor->email_choice] = g_strdup(string); +} - set_fields(editor); +static void +address_text_changed (GtkWidget *widget, EContactEditor *editor) +{ + gchar *string; + GtkEditable *editable = GTK_EDITABLE(widget); + + if (editor->address[editor->address_choice]) { + g_free(editor->address[editor->address_choice]); + editor->address[editor->address_choice] = NULL; + } + + string = gtk_editable_get_chars(editable, 0, -1); + if (editor->address[editor->address_choice]) { + if (editor->address[editor->address_choice]->data) + g_free(editor->address[editor->address_choice]->data); + editor->address[editor->address_choice]->data = NULL; + } else { + editor->address[editor->address_choice] = g_new(ECardAddrLabel, 1); + editor->address[editor->address_choice]->data = NULL; + editor->address[editor->address_choice]->flags = 0; + } + editor->address[editor->address_choice]->data = g_strdup(string); + g_free(string); } static void @@ -253,7 +264,7 @@ set_entry_changed_signal_phone(EContactEditor *editor, char *id) { GtkWidget *widget = glade_xml_get_widget(editor->gui, id); gtk_signal_connect(GTK_OBJECT(widget), "changed", - phone_label_changed, editor); + phone_entry_changed, editor); } static void @@ -266,7 +277,10 @@ set_entry_changed_signals(EContactEditor *editor) set_entry_changed_signal_phone(editor, "entry-phone4"); widget = glade_xml_get_widget(editor->gui, "entry-email1"); gtk_signal_connect(GTK_OBJECT(widget), "changed", - email_label_changed, editor); + email_entry_changed, editor); + widget = glade_xml_get_widget(editor->gui, "text-address"); + gtk_signal_connect(GTK_OBJECT(widget), "changed", + address_text_changed, editor); } static void @@ -699,8 +713,12 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito editor->address_popup = gnome_popup_menu_new(editor->address_info); } - result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "entry-address1", "Add new Address type"); - result ++; + result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "text-address", "Add new Address type"); + + if (result != -1) { + editor->address_choice = result; + set_fields(editor); + } } static void @@ -715,6 +733,9 @@ static void set_fields(EContactEditor *editor) { GtkEntry *entry; + GtkEditable *editable; + char *string = NULL; + int position; entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-phone1")); if (editor->phone[editor->phone_choice[0]]) @@ -731,6 +752,7 @@ set_fields(EContactEditor *editor) set_field(entry, editor->phone[editor->phone_choice[2]]->number); else set_field(entry, ""); + entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-phone4")); if (editor->phone[editor->phone_choice[3]]) set_field(entry, editor->phone[editor->phone_choice[3]]->number); @@ -741,6 +763,17 @@ set_fields(EContactEditor *editor) set_field(entry, editor->email[editor->email_choice]); else set_field(entry, ""); + + if (editor->address[editor->address_choice]) { + string = g_strdup (editor->address[editor->address_choice]->data); + } + position = 0; + editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); + gtk_editable_delete_text(editable, 0, -1); + if (string) { + gtk_editable_insert_text(editable, string, strlen(string), &position); + g_free(string); + } } static void @@ -763,25 +796,26 @@ fill_in_info(EContactEditor *editor) const ECardPhone *phone; const char *email; const ECardDate *bday; + const ECardAddrLabel *address; GtkEditable *editable; int position = 0; ECardIterator *iterator; gtk_object_get(GTK_OBJECT(card), - "full_name", &fname, - "address", &address_list, - "phone", &phone_list, - "email", &email_list, - "url", &url, - "org", &org, - "org_unit", &org_unit, - "title", &title, - "role", &role, - "nickname", &nickname, - "fburl", &fburl, - "note", ¬e, - "birth_date", &bday, + "full_name", &fname, + "address_label", &address_list, + "phone", &phone_list, + "email", &email_list, + "url", &url, + "org", &org, + "org_unit", &org_unit, + "title", &title, + "role", &role, + "nickname", &nickname, + "fburl", &fburl, + "note", ¬e, + "birth_date", &bday, NULL); position = 0; @@ -789,39 +823,7 @@ fill_in_info(EContactEditor *editor) gtk_editable_delete_text(editable, 0, -1); if (fname) gtk_editable_insert_text(editable, fname, strlen(fname), &position); -#if 0 - position = 0; - iterator = e_card_list_get_iterator(address_list); - for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - address = e_card_iterator_get(iterator); - if (address->flags & E_CARD_ADDR_WORK) { - if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS]) { - e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS]); - } - editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS] = - e_card_delivery_address_copy(address); - } - if (address->flags & E_CARD_ADDR_HOME) { - if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME]) { - e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME]); - } - editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME] = - e_card_delivery_address_copy(address); - } - if (address->flags & E_CARD_ADDR_PARCEL) { - if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER]) { - e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER]); - } - editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER] = - e_card_delivery_address_copy(address); - } - } - editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); - gtk_editable_delete_text(editable, 0, -1); - if (address) - gtk_editable_insert_text(editable, address->city, strlen(address->city), &position); - gtk_object_unref(GTK_OBJECT(iterator)); -#endif + for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { int i; phone = e_card_iterator_get(iterator); @@ -846,6 +848,18 @@ fill_in_info(EContactEditor *editor) } gtk_object_unref(GTK_OBJECT(iterator)); + for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { + int i; + address = e_card_iterator_get(iterator); + for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) { + if (((address->flags & addr_correspondences[i]) == addr_correspondences[i]) && (editor->address[i] == NULL)) { + editor->address[i] = e_card_address_label_copy(address); + break; + } + } + } + gtk_object_unref(GTK_OBJECT(iterator)); + position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-web")); gtk_editable_delete_text(editable, 0, -1); @@ -927,6 +941,7 @@ extract_info(EContactEditor *editor) char *fburl; char *note; const ECardPhone *phone; + const ECardAddrLabel *address; const char *email; ECardDate *bday; GtkEditable *editable; @@ -940,9 +955,9 @@ extract_info(EContactEditor *editor) ECardIterator *iterator; gtk_object_get(GTK_OBJECT(card), - "address", &address_list, - "phone", &phone_list, - "email", &email_list, + "address_label", &address_list, + "phone", &phone_list, + "email", &email_list, NULL); position = 0; @@ -953,29 +968,6 @@ extract_info(EContactEditor *editor) "full_name", fname, NULL); g_free(fname); -#if 0 - iterator = e_card_list_get_iterator(address_list); - address = e_card_iterator_get(iterator); - editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); - string = gtk_editable_get_chars(editable, 0, -1); - if (string && *string) { - if (address) { - address_copy = e_card_delivery_address_copy(address); - if (address_copy->city) - g_free(address_copy->city); - address_copy->city = string; - e_card_iterator_set(iterator, address_copy); - e_card_delivery_address_free(address_copy); - } else { - address_copy = g_new0(ECardDeliveryAddress, 1); - address_copy->city = string; - e_card_list_append(address_list, address_copy); - e_card_delivery_address_free(address_copy); - } - } else - g_free(string); - gtk_object_unref(GTK_OBJECT(iterator)); -#endif for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { int i; @@ -1033,20 +1025,37 @@ extract_info(EContactEditor *editor) editor->email[i] = NULL; } } -#if 0 - position = 0; - iterator = e_card_list_get_iterator(email_list); - editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-email1")); - email = gtk_editable_get_chars(editable, 0, -1); - if (email && *email) { - if (e_card_iterator_is_valid(iterator)) - e_card_iterator_set(iterator, email); - else - e_card_list_append(email_list, email); - } - g_free(email); + + for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { + int i; + address = e_card_iterator_get(iterator); + iterator_next = 1; + for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) { + if ((address->flags & addr_correspondences[i]) == addr_correspondences[i]) { + if (editor->address[i]) { + if (editor->address[i]->data && *editor->address[i]->data) { + e_card_iterator_set(iterator, editor->address[i]); + } else { + e_card_iterator_delete(iterator); + iterator_next = 0; + } + e_card_address_label_free(editor->address[i]); + editor->address[i] = NULL; + break; + } + } + } + } gtk_object_unref(GTK_OBJECT(iterator)); -#endif + for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) { + if (editor->address[i]) { + editor->address[i]->flags = addr_correspondences[i]; + e_card_list_append(address_list, editor->address[i]); + e_card_address_label_free(editor->address[i]); + editor->address[i] = NULL; + } + } + position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-web")); url = gtk_editable_get_chars(editable, 0, -1); diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index fd80dc4c00..394d136eed 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -112,7 +112,7 @@ struct _EContactEditor ECardPhone *phone[E_CONTACT_EDITOR_PHONE_ID_LAST]; char *email[E_CONTACT_EDITOR_EMAIL_ID_LAST]; - ECardDeliveryAddress *address[E_CONTACT_EDITOR_ADDRESS_ID_LAST]; + ECardAddrLabel *address[E_CONTACT_EDITOR_ADDRESS_ID_LAST]; EContactEditorEmailId email_choice; EContactEditorPhoneId phone_choice[4]; |