From 9a49145291a39e4e2baca6acd0dba70572aa9bb2 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sun, 4 Nov 2001 04:39:08 +0000 Subject: [ Fixes Ximian bug #14410 ] init in_async_call to FALSE. (card_added_cb): 2001-11-03 Chris Toshok [ Fixes Ximian bug #14410 ] * gui/contact-editor/e-contact-editor.c (e_contact_editor_init): init in_async_call to FALSE. (card_added_cb): turn the UI back on and set in_async_call to FALSE. (card_modified_cb): same. (card_deleted_cb): same. (save_card): turn off the UI by setting the dialog insensitive, and set in_async_call to TRUE. (delete_cb): same. (app_delete_event_cb): if we're in an async call don't let the window get deleted. * gui/contact-editor/e-contact-editor.h (struct _EContactEditor): add in_async_call flag for when we make a wombat call and need to disable the UI. * gui/contact-list-editor/e-contact-list-editor.c (e_contact_list_editor_init): init in_async_call to FALSE. (list_added_cb): turn the UI back on and set in_async_call to FALSE. (list_modified_cb): same. (list_deleted_cb): same. (save_card): turn off the UI by setting the dialog insensitive, and set in_async_call to TRUE. (delete_cb): same. (app_delete_event_cb): if we're in an async call don't let the window get deleted. * gui/contact-list-editor/e-contact-list-editor.h (struct _EContactListEditor): add in_async_call flag for when we make a wombat call and need to disable the UI. svn path=/trunk/; revision=14582 --- addressbook/gui/contact-editor/e-contact-editor.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'addressbook/gui/contact-editor/e-contact-editor.c') diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 25824206bb..2983cd8a24 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -825,6 +825,9 @@ card_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc EContactEditor *ce = ecs->ce; gboolean should_close = ecs->should_close; + gtk_widget_set_sensitive (ce->app, TRUE); + ce->in_async_call = FALSE; + e_card_set_id (ce->card, id); gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_ADDED], @@ -852,6 +855,9 @@ card_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) EContactEditor *ce = ecs->ce; gboolean should_close = ecs->should_close; + gtk_widget_set_sensitive (ce->app, TRUE); + ce->in_async_call = FALSE; + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_MODIFIED], status, ce->card); @@ -884,6 +890,9 @@ save_card (EContactEditor *ce, gboolean should_close) ecs->should_close = should_close; + gtk_widget_set_sensitive (ce->app, FALSE); + ce->in_async_call = TRUE; + if (ce->is_new_card) e_card_merging_book_add_card (ce->book, ce->card, GTK_SIGNAL_FUNC(card_added_cb), ecs); else @@ -1013,6 +1022,9 @@ e_contact_editor_confirm_delete(GtkWindow *parent) static void card_deleted_cb (EBook *book, EBookStatus status, EContactEditor *ce) { + gtk_widget_set_sensitive (ce->app, TRUE); + ce->in_async_call = FALSE; + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_DELETED], status, ce->card); @@ -1036,8 +1048,12 @@ delete_cb (GtkWidget *widget, gpointer data) extract_info (ce); e_card_simple_sync_card (simple); - if (!ce->is_new_card && ce->book) + if (!ce->is_new_card && ce->book) { + gtk_widget_set_sensitive (ce->app, FALSE); + ce->in_async_call = TRUE; + e_book_remove_card (ce->book, card, GTK_SIGNAL_FUNC(card_deleted_cb), ce); + } } gtk_object_unref(GTK_OBJECT(card)); @@ -1137,6 +1153,10 @@ app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) ce = E_CONTACT_EDITOR (data); + /* if we're saving, don't allow the dialog to close */ + if (ce->in_async_call) + return TRUE; + if (!prompt_to_save_changes (ce)) return TRUE; @@ -1217,6 +1237,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) e_contact_editor->card = NULL; e_contact_editor->changed = FALSE; + e_contact_editor->in_async_call = FALSE; e_contact_editor->editable = TRUE; gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); -- cgit v1.2.3