aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-08-20 04:33:11 +0800
committerChris Toshok <toshok@src.gnome.org>2004-08-20 04:33:11 +0800
commit5cb6605ddbb4e5f1157e242ca83808bce62f49cf (patch)
tree4abad6643293b5067af3a82c71219559cc6e0ce5 /addressbook
parentb2416ac03ed9c839fee54f0b63646e545e0624f1 (diff)
downloadgsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.tar
gsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.tar.gz
gsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.tar.bz2
gsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.tar.lz
gsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.tar.xz
gsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.tar.zst
gsoc2013-evolution-5cb6605ddbb4e5f1157e242ca83808bce62f49cf.zip
[ likely fixes #61500 ] remove the secondary text, since we don't have the
2004-08-19 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. svn path=/trunk/; revision=26975
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/addressbook-errors.xml1
-rw-r--r--addressbook/gui/component/addressbook-view.c76
3 files changed, 69 insertions, 20 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 31c8e616f0..90f9133d0d 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,15 @@
+2004-08-19 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-18 Sivaiah Nallagatla <snallagatla@novell.com>
* gui/component/select-names/e-select-names.c (e_select_names_init) :
diff --git a/addressbook/addressbook-errors.xml b/addressbook/addressbook-errors.xml
index b574eeb086..b936f56e97 100644
--- a/addressbook/addressbook-errors.xml
+++ b/addressbook/addressbook-errors.xml
@@ -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">
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
index bf1e5fff0a..179c9fbf26 100644
--- a/addressbook/gui/component/addressbook-view.c
+++ b/addressbook/gui/component/addressbook-view.c
@@ -648,6 +648,47 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap,
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 @@ delete_addressbook_cb (GtkWidget *widget, AddressbookView *view)
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 @@ delete_addressbook_cb (GtkWidget *widget, AddressbookView *view)
/* 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;
- 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);
+ if (e_book_async_remove (book, book_removed, closure)) {
+ e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
+ "addressbook:remove-addressbook",
+ NULL);
+
+ g_free (closure);
+
+ g_object_unref (book);
+ }
}
- g_object_unref (book);
- gtk_widget_destroy (dialog);
+ gtk_widget_set_sensitive (dialog, FALSE);
}
static void