[evolution-patches] [Addressbook] Fix for bug #62715



This patch should make sure address information is preserved, even if
it's just available in the form of a label blob.

-- 
Hans Petter
? 57795.patch
? 58921.patch
? 60529.patch
? 62085.patch
? 62142.patch
? 62715.patch
? birthdate.patch
? log.diff
? out.diff
? gui/component/ldap-config.gladep
? gui/component/old
? gui/component/out
? gui/component/select-names/crap
? gui/contact-editor/hpj-contact-editor.glade
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1811
diff -u -p -r1.1811 ChangeLog
--- ChangeLog	16 Aug 2004 23:43:33 -0000	1.1811
+++ ChangeLog	18 Aug 2004 05:27:51 -0000
@@ -1,3 +1,12 @@
+2004-08-18  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-11  Hans Petter Jansson  <hpj ximian com>
 
 	* gui/contact-editor/e-contact-editor.c (app_delete_event_cb):
Index: gui/contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.214
diff -u -p -r1.214 e-contact-editor.c
--- gui/contact-editor/e-contact-editor.c	16 Aug 2004 23:43:34 -0000	1.214
+++ gui/contact-editor/e-contact-editor.c	18 Aug 2004 05:27:51 -0000
@@ -1650,6 +1650,21 @@ fill_in_address_textview (EContactEditor
 }
 
 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]);
 
-	g_boxed_free (e_contact_address_get_type (), address);
+	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_free (address_label);
+	if (address)
+		g_boxed_free (e_contact_address_get_type (), address);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]