[evolution-patches] [addressbook] - Fix for bug : 260403



Hi ,

The attached patch fixes the bug : 260403 : Evolution is not giving
Warning message when tried to delete one contact from public-contact
folder.

I have added a call back function and a structure.
Please review .

thanks ,

Vandana.
Index: e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.180
diff -u -p -r1.180 e-addressbook-view.c
--- e-addressbook-view.c	22 Feb 2006 07:41:12 -0000	1.180
+++ e-addressbook-view.c	6 Apr 2006 11:07:55 -0000
@@ -1892,6 +1892,13 @@ eab_view_print_preview(EABView *view)
 #endif
 }
 
+static void before_deleted_cb (EBook *book,  EBookStatus status,  gpointer closure)
+{
+	if (status != E_BOOK_ERROR_OK && status != E_BOOK_ERROR_CANCELLED) {
+			eab_error_dialog ( _("Error deleting contact"), status);
+	}
+}
+
 void
 eab_view_delete_selection(EABView *view, gboolean is_delete)
 {
@@ -1899,6 +1906,9 @@ eab_view_delete_selection(EABView *view,
 	gboolean plural = FALSE, is_list = FALSE;
 	EContact *contact;
 	char *name = NULL;
+	
+	EContactDeleteCallback *look_up ;
+	look_up = g_new ( EContactDeleteCallback , 1 );
 
 	list = get_selected_contacts (view);
 	contact = list->data;
@@ -1929,12 +1939,18 @@ eab_view_delete_selection(EABView *view,
 			ids = g_list_prepend (ids, (char*)e_contact_get_const (contact, E_CONTACT_UID));
 		}
 
+		look_up->book = view->book;
+		look_up->status = E_BOOK_ERROR_OK ;
+		look_up->closure = NULL;
+
+		
+
 		/* Remove the cards all at once. */
-		/* XXX no callback specified... ugh */
+		/*  callback specified */
 		e_book_async_remove_contacts (view->book,
 					      ids,
-					      NULL,
-					      NULL);
+					      before_deleted_cb,
+					      look_up);
 			
 		g_list_free (ids);
 	}
@@ -1942,11 +1958,11 @@ eab_view_delete_selection(EABView *view,
 		for (l=list;l;l=g_list_next(l)) {
 			contact = l->data;
 			/* Remove the card. */
-			/* XXX no callback specified... ugh */
+			/* no callback specified*/
 			e_book_async_remove_contact (view->book,
 						     contact,
-						     NULL,
-						     NULL);
+						     before_deleted_cb,
+						     look_up);
 		}
 	}
 
Index: e-addressbook-view.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.h,v
retrieving revision 1.40
diff -u -p -r1.40 e-addressbook-view.h
--- e-addressbook-view.h	30 Jan 2006 10:03:20 -0000	1.40
+++ e-addressbook-view.h	6 Apr 2006 11:08:06 -0000
@@ -114,6 +114,14 @@ struct _EABViewClass
 	void (*command_state_change)  (EABView *view);
 };
 
+typedef struct _EContactDeleteCallback  EContactDeleteCallback ;
+
+struct  _EContactDeleteCallback{
+	EBook* book;
+	EBookStatus status;
+	gpointer closure;
+};
+
 GtkWidget *eab_view_new                 (void);
 GType      eab_view_get_type            (void);
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.2064
diff -u -p -r1.2064 ChangeLog
--- ChangeLog	10 Mar 2006 07:28:56 -0000	1.2064
+++ ChangeLog	6 Apr 2006 11:08:38 -0000
@@ -1,3 +1,11 @@
+2006-04-06  Vandana Shenoy  <shvandana novell com>
+
+	* gui/widgets/e-addressbook-view.c   (eab_view_delete_selection):
+	  Added function to handle callbacks from deleting a contact
+	* gui/widgets/e-addressbook-view.h:   Added structure _EContactDeleteCallback 
+	  Fix for Bug 260403 : Evolution is not giving Warning message when
+	  tried to delete one contact from public-contact folder
+
 2006-03-10  Devashish Sharma  <sdevashish novell com>
 
 	* gui/component/ldap-config.glade : ldap port numbers


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