[evolution-patches] patch for addressbook 61500



This patch just switches us from using the async call from the sync call
of e_book_remove.  Not sure if it'll actually fix the problem, but
making the sync call from the gui thread is bad, so at the very least we
should fix that :)

Chris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1808
diff -u -r1.1808 ChangeLog
--- ChangeLog	12 Aug 2004 06:54:17 -0000	1.1808
+++ ChangeLog	16 Aug 2004 18:41:01 -0000
@@ -1,3 +1,21 @@
+2004-08-16  Chris Toshok  <toshok ximian com>
+
+	[ likely fixes #61500 ]
+	* addressbook-errors.xml (remove-addressbook): remove the
+	secondary text, since we don't have the gerror text to supply it
+	anymore.
+
+	* gui/component/addressbook-view.c (book_removed): new function,
+	move the error handling here.
+	(delete_addressbook_cb): create a closure with necessary data, and
+	call the e_book_async_remove instead of e_book_remove.
+
+2004-08-09  Chris Toshok  <toshok ximian com>
+
+	* gui/widgets/eab-gui-util.c (eab_show_multiple_contacts):
+	reinstate the ngettext patch that was part of the #53464 commit of
+	2004-03-24 by dsegan gmx net 
+
 2004-08-10  Not Zed  <NotZed Ximian com>
 
 	* gui/component/addressbook.c (addressbook_authenticate): e
Index: addressbook-errors.xml
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/addressbook-errors.xml,v
retrieving revision 1.1
diff -u -r1.1 addressbook-errors.xml
--- addressbook-errors.xml	25 May 2004 14:57:03 -0000	1.1
+++ addressbook-errors.xml	16 Aug 2004 18:41:01 -0000
@@ -30,7 +30,6 @@
 
  <error id="remove-addressbook" type="error" modal="true">
   <primary>Could not remove addressbook.</primary>
-  <secondary>{0}</secondary>
  </error>
 
  <error id="edit-categories" type="error">
Index: gui/component/addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-view.c,v
retrieving revision 1.16
diff -u -r1.16 addressbook-view.c
--- gui/component/addressbook-view.c	12 Aug 2004 05:30:56 -0000	1.16
+++ gui/component/addressbook-view.c	16 Aug 2004 18:41:02 -0000
@@ -648,6 +648,47 @@
 	gtk_widget_show (item);
 }
 
+typedef struct {
+	AddressbookView *view;
+	ESource *selected_source;
+	GtkWidget *toplevel;
+	GtkWidget *dialog;
+} BookRemovedClosure;
+
+static void
+book_removed (EBook *book, EBookStatus status, gpointer data)
+{
+	BookRemovedClosure *closure = data;
+	AddressbookView *view = closure->view;
+	AddressbookViewPrivate *priv = view->priv;
+	ESource *source = closure->selected_source;
+	GtkWidget *dialog = closure->dialog;
+	GtkWidget *toplevel = closure->toplevel;
+
+	g_free (closure);
+
+	g_object_unref (book);
+
+	if (E_BOOK_ERROR_OK == status) {
+		/* Remove source */
+		if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->selector),
+							  source))
+			e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->selector),
+							   source);
+		
+		e_source_group_remove_source (e_source_peek_group (source), source);
+
+		e_source_list_sync (priv->source_list, NULL);
+	}
+	else {
+		e_error_run (GTK_WINDOW (toplevel),
+			     "addressbook:remove-addressbook",
+			     NULL);
+	}
+
+	gtk_widget_destroy (dialog);
+}
+
 static void
 delete_addressbook_cb (GtkWidget *widget, AddressbookView *view)
 {
@@ -655,7 +696,6 @@
 	ESource *selected_source;
 	GtkWidget *dialog;
 	EBook  *book;
-	gboolean removed = FALSE;
 	GError *error = NULL;
 
 	selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
@@ -679,28 +719,26 @@
 
 	/* Remove local data */
 	book = e_book_new (selected_source, &error);
-	if (book)
-		removed = e_book_remove (book, &error);
+	if (book) {
+		BookRemovedClosure *closure = g_new (BookRemovedClosure, 1);
 
-	if (removed) {
-		/* Remove source */
-		if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->selector),
-							  selected_source))
-			e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->selector),
-							   selected_source);
-		
-		e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
+		closure->toplevel = gtk_widget_get_toplevel (widget);
+		closure->view = view;
+		closure->selected_source = selected_source;
+		closure->dialog = dialog;
+
+		if (e_book_async_remove (book, book_removed, closure)) {
+			e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
+				     "addressbook:remove-addressbook",
+				     NULL);
 
-		e_source_list_sync (priv->source_list, NULL);
-	} else {
-		e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
-			     "addressbook:remove-addressbook",
-			     error->message, NULL);
-		g_error_free (error);
+			g_free (closure);
+
+			g_object_unref (book);
+		}
 	}
 
-	g_object_unref (book);
-	gtk_widget_destroy (dialog);
+	gtk_widget_set_sensitive (dialog, FALSE);
 }
 
 static void


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