Index: addressbook/gui/contact-editor/e-contact-editor.c
===================================================================
--- addressbook/gui/contact-editor/e-contact-editor.c	(revision 36419)
+++ addressbook/gui/contact-editor/e-contact-editor.c	(working copy)
@@ -693,7 +693,7 @@ init_email_record_location (EContactEdit
 
 		item = gtk_menu_item_new_with_label (_(common_location [i].pretty_name));
 		gtk_menu_shell_append (GTK_MENU_SHELL (location_menu), item);
-+		g_signal_connect (item, "activate", G_CALLBACK (email_menu_changed), email_entry);
+		g_signal_connect (item, "activate", G_CALLBACK (email_menu_changed), email_entry);
 	}
 
 	gtk_widget_show_all (location_menu);
@@ -962,7 +962,8 @@ extract_email (EContactEditor *editor)
 	GList *l, *l_next;
 	gint   i;
 
-	for (i = 1; i <= EMAIL_SLOTS; i++) {
+	/* do this in reverse order, to get right order in a vCard */
+	for (i = EMAIL_SLOTS; i >= 1; i--) {
 		gchar *address;
 		gint   location;
 
@@ -1184,7 +1185,8 @@ extract_phone (EContactEditor *editor)
 	GList *l, *l_next;
 	gint   i;
 
-	for (i = 1; i <= PHONE_SLOTS; i++) {
+	/* do this in reverse order, to get right order in a vCard */
+	for (i = PHONE_SLOTS; i >= 1; i--) {
 		gchar *phone;
 		gint   phone_type;
 
@@ -1544,7 +1546,8 @@ extract_im (EContactEditor *editor)
 
 	service_attr_list = g_new0 (GList *, G_N_ELEMENTS (im_service));
 
-	for (i = 1; i <= IM_SLOTS; i++) {
+	/* do this in reverse order, to get right order in a vCard */
+	for (i = IM_SLOTS; i >= 1; i--) {
 		EVCardAttribute *attr;
 		gchar           *name;
 		gint             service;
Index: addressbook/gui/contact-editor/contact-editor.glade
===================================================================
--- addressbook/gui/contact-editor/contact-editor.glade	(revision 36419)
+++ addressbook/gui/contact-editor/contact-editor.glade	(working copy)
@@ -480,7 +480,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkOptionMenu" id="optionmenu-email-2">
+			    <widget class="GtkOptionMenu" id="optionmenu-email-3">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="history">0</property>
@@ -519,7 +519,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkEntry" id="entry-email-2">
+			    <widget class="GtkEntry" id="entry-email-3">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="editable">True</property>
@@ -530,7 +530,7 @@
 			      <property name="invisible_char">*</property>
 			      <property name="activates_default">False</property>
 			      <accessibility>
-				<atkrelation target="optionmenu-email-2" type="labelled-by"/>
+				<atkrelation target="optionmenu-email-3" type="labelled-by"/>
 			      </accessibility>
 			    </widget>
 			    <packing>
@@ -543,7 +543,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkOptionMenu" id="optionmenu-email-3">
+			    <widget class="GtkOptionMenu" id="optionmenu-email-2">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="history">0</property>
@@ -645,7 +645,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkEntry" id="entry-email-3">
+			    <widget class="GtkEntry" id="entry-email-2">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="editable">True</property>
@@ -656,7 +656,7 @@
 			      <property name="invisible_char">*</property>
 			      <property name="activates_default">False</property>
 			      <accessibility>
-				<atkrelation target="optionmenu-email-3" type="labelled-by"/>
+				<atkrelation target="optionmenu-email-2" type="labelled-by"/>
 			      </accessibility>
 			    </widget>
 			    <packing>
@@ -800,7 +800,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkEntry" id="entry-phone-2">
+				    <widget class="GtkEntry" id="entry-phone-3">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="editable">True</property>
@@ -811,7 +811,7 @@
 				      <property name="invisible_char">*</property>
 				      <property name="activates_default">False</property>
 				      <accessibility>
-					<atkrelation target="optionmenu-phone-2" type="labelled-by"/>
+					<atkrelation target="optionmenu-phone-3" type="labelled-by"/>
 				      </accessibility>
 				    </widget>
 				    <packing>
@@ -848,7 +848,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkEntry" id="entry-phone-3">
+				    <widget class="GtkEntry" id="entry-phone-2">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="editable">True</property>
@@ -859,7 +859,7 @@
 				      <property name="invisible_char">*</property>
 				      <property name="activates_default">False</property>
 				      <accessibility>
-					<atkrelation target="optionmenu-phone-3" type="labelled-by"/>
+					<atkrelation target="optionmenu-phone-2" type="labelled-by"/>
 				      </accessibility>
 				    </widget>
 				    <packing>
@@ -911,7 +911,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkOptionMenu" id="optionmenu-phone-2">
+				    <widget class="GtkOptionMenu" id="optionmenu-phone-3">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="history">0</property>
@@ -950,7 +950,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkOptionMenu" id="optionmenu-phone-3">
+				    <widget class="GtkOptionMenu" id="optionmenu-phone-2">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="history">0</property>
@@ -1082,7 +1082,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkOptionMenu" id="optionmenu-phone-6">
+				    <widget class="GtkOptionMenu" id="optionmenu-phone-7">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="history">0</property>
@@ -1145,7 +1145,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkEntry" id="entry-phone-6">
+				    <widget class="GtkEntry" id="entry-phone-7">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="editable">True</property>
@@ -1156,7 +1156,7 @@
 				      <property name="invisible_char">*</property>
 				      <property name="activates_default">False</property>
 				      <accessibility>
-					<atkrelation target="optionmenu-phone-6" type="labelled-by"/>
+					<atkrelation target="optionmenu-phone-7" type="labelled-by"/>
 				      </accessibility>
 				    </widget>
 				    <packing>
@@ -1169,7 +1169,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkOptionMenu" id="optionmenu-phone-7">
+				    <widget class="GtkOptionMenu" id="optionmenu-phone-6">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="history">0</property>
@@ -1247,7 +1247,7 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkEntry" id="entry-phone-7">
+				    <widget class="GtkEntry" id="entry-phone-6">
 				      <property name="visible">True</property>
 				      <property name="can_focus">True</property>
 				      <property name="editable">True</property>
@@ -1258,7 +1258,7 @@
 				      <property name="invisible_char">*</property>
 				      <property name="activates_default">False</property>
 				      <accessibility>
-					<atkrelation target="optionmenu-phone-7" type="labelled-by"/>
+					<atkrelation target="optionmenu-phone-6" type="labelled-by"/>
 				      </accessibility>
 				    </widget>
 				    <packing>
@@ -1474,7 +1474,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkOptionMenu" id="optionmenu-im-service-2">
+			    <widget class="GtkOptionMenu" id="optionmenu-im-service-3">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="history">0</property>
@@ -1522,7 +1522,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkEntry" id="entry-im-name-2">
+			    <widget class="GtkEntry" id="entry-im-name-3">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="editable">True</property>
@@ -1533,7 +1533,7 @@
 			      <property name="invisible_char">*</property>
 			      <property name="activates_default">False</property>
 			      <accessibility>
-				<atkrelation target="optionmenu-im-service-2" type="labelled-by"/>
+				<atkrelation target="optionmenu-im-service-3" type="labelled-by"/>
 			      </accessibility>
 			    </widget>
 			    <packing>
@@ -1546,7 +1546,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkOptionMenu" id="optionmenu-im-service-3">
+			    <widget class="GtkOptionMenu" id="optionmenu-im-service-2">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="history">0</property>
@@ -1594,7 +1594,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkEntry" id="entry-im-name-3">
+			    <widget class="GtkEntry" id="entry-im-name-2">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
 			      <property name="editable">True</property>
@@ -1605,7 +1605,7 @@
 			      <property name="invisible_char">*</property>
 			      <property name="activates_default">False</property>
 			      <accessibility>
-				<atkrelation target="optionmenu-im-service-3" type="labelled-by"/>
+				<atkrelation target="optionmenu-im-service-2" type="labelled-by"/>
 			      </accessibility>
 			    </widget>
 			    <packing>
Index: addressbook/importers/evolution-ldif-importer.c
===================================================================
--- addressbook/importers/evolution-ldif-importer.c	(revision 36419)
+++ addressbook/importers/evolution-ldif-importer.c	(working copy)
@@ -419,6 +419,9 @@ resolve_list_card (LDIFImporter *gci, EC
 			email_attrs = g_list_append (email_attrs, attr);
 		}
 	}
+
+	/* set it in reverse order to honor file's order */
+	email_attrs = g_list_reverse (email_attrs);
 	e_contact_set_attributes (contact, E_CONTACT_EMAIL, email_attrs);
 
 	g_list_foreach (email, (GFunc) g_free, NULL);
Index: addressbook/importers/evolution-vcard-importer.c
===================================================================
--- addressbook/importers/evolution-vcard-importer.c	(revision 36419)
+++ addressbook/importers/evolution-vcard-importer.c	(working copy)
@@ -123,6 +123,9 @@ vcard_import_contact(VCardImporter *gci,
 			}
 		}
 	}
+
+	/* set it in reverse order to honor file's order */
+	attrs = g_list_reverse (attrs);
 	e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs);
 
 	/*
Index: addressbook/ChangeLog
===================================================================
--- addressbook/ChangeLog	(revision 36419)
+++ addressbook/ChangeLog	(working copy)
@@ -1,3 +1,18 @@
+2008-09-22  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #523775
+
+	* gui/contact-editor/contact-editor.glade:
+	* gui/contact-editor/e-contact-editor.c: (extract_email),
+	(extract_phone), (extract_im): Store values in a vCard
+	in same order as user entered it in the GUI.
+	* importers/evolution-ldif-importer.c: (resolve_list_card):
+	* importers/evolution-vcard-importer.c: (vcard_import_contact):
+	Honor files order of multi value attributes when importing.
+
+	* gui/contact-editor/e-contact-editor.c: (init_email_record_location):
+	Fix a typo in the code.
+
 2008-09-19  Sankar P  <psankar@novell.com>
 
 License Changes
