Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.2090
diff -u -p -r1.2090 ChangeLog
--- ChangeLog	8 Jul 2006 13:51:30 -0000	1.2090
+++ ChangeLog	28 Jul 2006 04:29:04 -0000
@@ -1,3 +1,11 @@
+2006-07-27  Ushveen Kaur <kushveen@novell.com>
+
+	* gui/merging/eab-contact-merging.c :  Added merge features to 
+	duplicate detected dialog. 
+	* gui/merging/eab-contact-duplicate-detected.glade : Added the merge
+	button to the dialog.
+	Fix for Bug #211082
+
 2006-07-08  Aishwarya K  <aishkalyan@gmail.com>
 
 	Fix for #332963
Index: gui/merging/eab-contact-merging.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/merging/eab-contact-merging.c,v
retrieving revision 1.8
diff -u -p -r1.8 eab-contact-merging.c
--- gui/merging/eab-contact-merging.c	21 Apr 2006 08:02:14 -0000	1.8
+++ gui/merging/eab-contact-merging.c	28 Jul 2006 04:29:04 -0000
@@ -29,6 +29,7 @@ typedef struct {
 	EContactMergingOpType op;
 	EBook *book;
 	EContact *contact;
+	EContact *match;
 	GList *avoid;
 	EBookIdCallback id_cb;
 	EBookCallback   cb;
@@ -81,7 +82,9 @@ free_lookup (EContactMergingLookup *look
 	g_object_unref (lookup->book);
 	g_object_unref (lookup->contact);
 	g_list_free (lookup->avoid);
-
+	if(lookup->match)
+		g_object_unref (lookup->match);
+ 
 	g_free (lookup);
 }
 
@@ -131,20 +134,50 @@ cancelit (EContactMergingLookup *lookup)
 }
 
 static void
+free_attr_list (GList *attr_list)
+{
+        GList *l;
+        for (l = attr_list; l; l = g_list_next (l)) {
+	        EVCardAttribute *attr = l->data;
+		e_vcard_attribute_free (attr);
+        }
+ 	g_list_free (attr_list);
+}
+
+static void
+mergeit(EContactMergingLookup *lookup)
+{
+	GList *old_list = e_contact_get_attributes(lookup->match, E_CONTACT_EMAIL);
+	GList *new_list = e_contact_get_attributes(lookup->contact, E_CONTACT_EMAIL);
+		
+	new_list = g_list_concat(old_list, new_list);
+	e_contact_set_attributes(lookup->match, E_CONTACT_EMAIL, new_list);
+
+	lookup->contact = lookup->match;
+	e_book_async_remove_contact (lookup->book, lookup->match, NULL, lookup);
+	e_book_async_add_contact (lookup->book, lookup->contact, final_id_cb, lookup);
+
+	free_attr_list(new_list);
+}
+
+static void
 response (GtkWidget *dialog, int response, EContactMergingLookup *lookup)
 {
 	gtk_widget_destroy (dialog);
 
 	switch (response) {
-	case 0:
-		doit (lookup);
-		break;
-	case 1:
-		cancelit (lookup);
-		break;
-	case GTK_RESPONSE_DELETE_EVENT:
-		cancelit (lookup);
-		break;
+	    case 0:
+		    doit (lookup);
+		    break;
+	    case 1:
+		    cancelit (lookup);
+		    break;
+	    case 2:
+		    mergeit (lookup);
+		    break;
+	    case GTK_RESPONSE_DELETE_EVENT:
+		    cancelit (lookup);
+		    break;
 	}
 }
 
@@ -153,7 +186,7 @@ match_query_callback (EContact *contact,
 {
 	EContactMergingLookup *lookup = closure;
 	char *gladefile;
-
+	
 	if ((gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE) {
 		doit (lookup);
 	} else {
@@ -161,6 +194,7 @@ match_query_callback (EContact *contact,
 		
 		GtkWidget *widget;
 
+		lookup->match = g_object_ref (match);
 		if (lookup->op == E_CONTACT_MERGING_ADD) {
 			gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 						      "eab-contact-duplicate-detected.glade",
@@ -215,6 +249,7 @@ eab_merging_book_add_contact (EBook     
 	lookup->id_cb = cb;
 	lookup->closure = closure;
 	lookup->avoid = NULL;
+	lookup->match = NULL;
 
 	add_lookup (lookup);
 
@@ -237,6 +272,7 @@ eab_merging_book_commit_contact (EBook  
 	lookup->cb = cb;
 	lookup->closure = closure;
 	lookup->avoid = g_list_append (NULL, contact);
+	lookup->match = NULL;
 
 	add_lookup (lookup);
 
Index: gui/merging/eab-contact-duplicate-detected.glade
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/merging/eab-contact-duplicate-detected.glade,v
retrieving revision 1.5
diff -u -p -r1.5 eab-contact-duplicate-detected.glade
--- gui/merging/eab-contact-duplicate-detected.glade	17 Aug 2005 08:47:40 -0000	1.5
+++ gui/merging/eab-contact-duplicate-detected.glade	28 Jul 2006 04:29:05 -0000
@@ -56,6 +56,19 @@
 	      <property name="response_id">0</property>
 	    </widget>
 	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="button5">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">Merge</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">2</property>
+	    </widget>
+	  </child>
+
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
