[evolution-patches] [addressbook] Patch for Bug #269482



Hi 

The attached patch partially solves 269482 and related bugs.
Now the duplicate contact can be deleted, merging of cards still to be
implemented.

Thanks

devashish
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1990
diff -u -p -r1.1990 ChangeLog
--- addressbook/ChangeLog	26 Aug 2005 05:39:33 -0000	1.1990
+++ addressbook/ChangeLog	12 Sep 2005 12:35:33 -0000
@@ -1,3 +1,9 @@
+2005-09-12  Devashish Sharma <sdevashish novell cm>
+
+	* gui/merging/eab-contact-merging.c: Added the functionality for
+	replacing the duplicate contact in case of Duplicate Contact Detected.
+	Fixes #269482
+
 2005-08-26  Devashish Sharma <sdevashish novell com>
 
 	* gui/widgets/e-addressbook-view.etspec: In ETableSpecification source
Index: addressbook/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
--- addressbook/gui/merging/eab-contact-duplicate-detected.glade	17 Aug 2005 08:47:40 -0000	1.5
+++ addressbook/gui/merging/eab-contact-duplicate-detected.glade	12 Sep 2005 12:36:16 -0000
@@ -55,6 +55,19 @@
 	      <property name="focus_on_click">True</property>
 	      <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">Replace</property>
+	      <property name="use_stock">True</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>
Index: addressbook/gui/merging/eab-contact-merging.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/merging/eab-contact-merging.c,v
retrieving revision 1.6
diff -u -p -r1.6 eab-contact-merging.c
--- addressbook/gui/merging/eab-contact-merging.c	17 Aug 2005 09:35:22 -0000	1.6
+++ addressbook/gui/merging/eab-contact-merging.c	12 Sep 2005 12:36:36 -0000
@@ -28,6 +28,7 @@ typedef struct {
 	EContactMergingOpType op;
 	EBook *book;
 	EContact *contact;
+	EContact *match;
 	GList *avoid;
 	EBookIdCallback id_cb;
 	EBookCallback   cb;
@@ -79,6 +80,7 @@ free_lookup (EContactMergingLookup *look
 {
 	g_object_unref (lookup->book);
 	g_object_unref (lookup->contact);
+	g_object_unref (lookup->match);
 	g_list_free (lookup->avoid);
 
 	g_free (lookup);
@@ -132,6 +134,17 @@ cancelit (EContactMergingLookup *lookup)
 }
 
 static void
+replaceit (EContactMergingLookup *lookup)
+{
+	e_book_async_remove_contact (lookup->book, lookup->match, NULL, lookup);
+	if (lookup->op == E_CONTACT_MERGING_ADD)
+		e_book_async_add_contact (lookup->book, lookup->contact, final_id_cb, lookup);
+	else if (lookup->op == E_CONTACT_MERGING_COMMIT)
+		e_book_async_commit_contact (lookup->book, lookup->contact, final_cb, lookup);
+
+}
+
+static void
 response (GtkWidget *dialog, int response, EContactMergingLookup *lookup)
 {
 	gtk_widget_destroy (dialog);
@@ -143,6 +156,9 @@ response (GtkWidget *dialog, int respons
 	case 1:
 		cancelit (lookup);
 		break;
+	case 2:
+		replaceit (lookup);
+		break;
 	case GTK_RESPONSE_DELETE_EVENT:
 		cancelit (lookup);
 		break;
@@ -161,6 +177,7 @@ match_query_callback (EContact *contact,
 		
 		GtkWidget *widget;
 
+		lookup->match = g_object_ref (match);
 		if (lookup->op == E_CONTACT_MERGING_ADD)
 			ui = glade_xml_new (EVOLUTION_GLADEDIR "/eab-contact-duplicate-detected.glade", NULL, NULL);
 		else if (lookup->op == E_CONTACT_MERGING_COMMIT)
@@ -204,6 +221,7 @@ eab_merging_book_add_contact (EBook     
 	lookup->op = E_CONTACT_MERGING_ADD;
 	lookup->book = g_object_ref (book);
 	lookup->contact = g_object_ref (contact);
+	lookup->match = NULL;
 	lookup->id_cb = cb;
 	lookup->closure = closure;
 	lookup->avoid = NULL;
@@ -226,6 +244,7 @@ eab_merging_book_commit_contact (EBook  
 	lookup->op = E_CONTACT_MERGING_COMMIT;
 	lookup->book = g_object_ref (book);
 	lookup->contact = g_object_ref (contact);
+	lookup->match = NULL;
 	lookup->cb = cb;
 	lookup->closure = closure;
 	lookup->avoid = g_list_append (NULL, contact);


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