[evolution-patches] Addressbook: patch for #273716



Please review this patch and ignore my previous patch.

Thanks,
Sushma.
Index: addressbook/gui/widgets/eab-gui-util.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-gui-util.c,v
retrieving revision 1.41
diff -u -p -r1.41 eab-gui-util.c
--- addressbook/gui/widgets/eab-gui-util.c	19 Jul 2005 07:52:01 -0000	1.41
+++ addressbook/gui/widgets/eab-gui-util.c	2 Aug 2005 07:09:37 -0000
@@ -625,6 +625,7 @@ typedef void (*ContactCopyDone) (Contact
 
 struct ContactCopyProcess_ {
 	int count;
+	gboolean book_status;
 	GList *contacts;
 	EBook *source;
 	EBook *destination;
@@ -651,9 +652,11 @@ do_delete (gpointer data, gpointer user_
 static void
 delete_contacts (ContactCopyProcess *process)
 {
-	g_list_foreach (process->contacts,
-			do_delete,
-			process->source);
+	if (process->book_status == TRUE) {
+		g_list_foreach (process->contacts,
+				do_delete,
+				process->source);
+	}
 }
 
 static void
@@ -677,10 +680,17 @@ contact_added_cb (EBook* book, EBookStat
 	ContactCopyProcess *process = user_data;
 
 	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
+		process->book_status = FALSE;
 		eab_error_dialog (_("Error adding contact"), status);
-	} else {
-		process_unref (process);
+	} 
+	else if (status == E_BOOK_ERROR_CANCELLED) {
+		process->book_status = FALSE;
+	}
+	else {
+		/* success */
+		process->book_status = TRUE;
 	}
+	process_unref (process);
 }
 
 static void
@@ -706,6 +716,7 @@ got_book_cb (EBook *book, EBookStatus st
 	process = closure;
 	if (status == E_BOOK_ERROR_OK) {
 		process->destination = book;
+		process->book_status = TRUE;
 		g_object_ref (book);
 		g_list_foreach (process->contacts,
 				do_copy,
@@ -754,6 +765,7 @@ eab_transfer_contacts (EBook *source, GL
 
 	process = g_new (ContactCopyProcess, 1);
 	process->count = 1;
+	process->book_status = FALSE;
 	process->source = source;
 	g_object_ref (source);
 	process->contacts = contacts;
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1967
diff -u -p -r1.1967 ChangeLog
--- addressbook/ChangeLog	29 Jul 2005 06:35:21 -0000	1.1967
+++ addressbook/ChangeLog	2 Aug 2005 07:10:01 -0000
@@ -1,3 +1,13 @@
+2005-08-01  Sushma Rai  <rsushma novell com>
+
+	* gui/widgets/eab-gui-util.c (eab_transfer_contacts): Initialize the
+	flag status to FALSE.
+	(got_book_cb): Set status to TRUE on loading the address book.
+	(contact_added_cb): Set status to FALSE on error or cancel operation.
+	Set status to true on success. Call process_unref always.
+	(delete_contacts): Delete the contacts only on success.
+	Fixes #311133, #273716.
+
 2005-07-29  Srinivasa Ragavan <sragavan novell com>
 
 	* gui/contact-editor/eab-editor.c: (eab_editor_prompt_to_save_changes)


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