aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c48
2 files changed, 47 insertions, 10 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index c41fc4276a..6ea780c4e7 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,12 @@
+2004-08-20 Hans Petter Jansson <hpj@ximian.com>
+
+ Fixes bug #62715.
+
+ * gui/contact-editor/e-contact-editor.c
+ (fill_in_address_label_textview): Implement.
+ (fill_in_address_field): If structured address information is not
+ available, try putting the "label" blob in the free-form field.
+
2004-08-19 Hans Petter Jansson <hpj@ximian.com>
Makes the contact image selector use GtkFileChooser if available.
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 180db61d24..80983691c3 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1650,6 +1650,21 @@ fill_in_address_textview (EContactEditor *editor, gint record, EContactAddress *
}
static void
+fill_in_address_label_textview (EContactEditor *editor, gint record, const gchar *label)
+{
+ gchar *textview_name;
+ GtkWidget *textview;
+ GtkTextBuffer *text_buffer;
+
+ textview_name = g_strdup_printf ("textview-%s-address", address_name [record]);
+ textview = glade_xml_get_widget (editor->gui, textview_name);
+ g_free (textview_name);
+
+ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
+ gtk_text_buffer_set_text (text_buffer, label ? label : "", -1);
+}
+
+static void
fill_in_address_field (EContactEditor *editor, gint record, const gchar *widget_field_name,
const gchar *string)
{
@@ -1667,19 +1682,32 @@ static void
fill_in_address_record (EContactEditor *editor, gint record)
{
EContactAddress *address;
+ gchar *address_label;
address = e_contact_get (editor->contact, addresses [record]);
- if (!address)
- return;
-
- fill_in_address_textview (editor, record, address);
- fill_in_address_field (editor, record, "city", address->locality);
- fill_in_address_field (editor, record, "state", address->region);
- fill_in_address_field (editor, record, "zip", address->code);
- fill_in_address_field (editor, record, "country", address->country);
- fill_in_address_field (editor, record, "pobox", address->po);
+ address_label = e_contact_get (editor->contact, address_labels [record]);
+
+ if (address &&
+ (!STRING_IS_EMPTY (address->street) ||
+ !STRING_IS_EMPTY (address->ext) ||
+ !STRING_IS_EMPTY (address->locality) ||
+ !STRING_IS_EMPTY (address->region) ||
+ !STRING_IS_EMPTY (address->code) ||
+ !STRING_IS_EMPTY (address->po) ||
+ !STRING_IS_EMPTY (address->country))) {
+ fill_in_address_textview (editor, record, address);
+ fill_in_address_field (editor, record, "city", address->locality);
+ fill_in_address_field (editor, record, "state", address->region);
+ fill_in_address_field (editor, record, "zip", address->code);
+ fill_in_address_field (editor, record, "country", address->country);
+ fill_in_address_field (editor, record, "pobox", address->po);
+ } else if (!STRING_IS_EMPTY (address_label)) {
+ fill_in_address_label_textview (editor, record, address_label);
+ }
- g_boxed_free (e_contact_address_get_type (), address);
+ g_free (address_label);
+ if (address)
+ g_boxed_free (e_contact_address_get_type (), address);
}
static void