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



Hi Srini ,

I have made the necessary changes as specified by you .

Thank you ,

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	7 Apr 2006 10:08:17 -0000
@@ -85,6 +85,15 @@
 
 #define d(x)
 
+typedef struct _EContactDeleteCallback  EContactDeleteCallback ;
+
+struct  _EContactDeleteCallback{
+	EBook* book;
+	EBookStatus status;
+	gpointer closure;
+};
+
+
 static void eab_view_init		(EABView		 *card);
 static void eab_view_class_init	(EABViewClass	 *klass);
 
@@ -1892,6 +1901,12 @@ 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 +1914,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 +1947,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,14 +1966,14 @@ 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);
 		}
 	}
-
+	g_free(look_up);
 	e_free_object_list(list);
 }
 
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	7 Apr 2006 10:08:33 -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]