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/ChangeLog | 35 ++++++++++++++++++++++ addressbook/gui/contact-editor/e-contact-editor.c | 23 +++++++++++++- addressbook/gui/contact-editor/e-contact-editor.h | 3 ++ .../contact-list-editor/e-contact-list-editor.c | 23 +++++++++++++- .../contact-list-editor/e-contact-list-editor.h | 3 ++ 5 files changed, 85 insertions(+), 2 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 31bd485c92..d8e5d1de3e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,38 @@ +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. + 2001-11-02 Christopher James Lahey * backend/ebook/e-card-simple.c (e_card_simple_get): Check for 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); diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 4d53d10291..69036ef9a8 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -98,6 +98,9 @@ struct _EContactEditor /* Whether the contact editor will accept modifications */ guint editable : 1; + /* Whether an async wombat call is in progress */ + guint in_async_call : 1; + EList *writable_fields; }; diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index b1bd3e351c..bb223f2f18 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -208,6 +208,7 @@ e_contact_list_editor_init (EContactListEditor *editor) editor->card = NULL; editor->changed = FALSE; editor->editable = TRUE; + editor->in_async_call = FALSE; editor->is_new_list = FALSE; gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-list-editor.glade", NULL); @@ -310,6 +311,9 @@ list_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc g_free (ecs); + gtk_widget_set_sensitive (cle->app, TRUE); + cle->in_async_call = FALSE; + e_card_set_id (cle->card, id); gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_ADDED], @@ -333,6 +337,9 @@ list_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) g_free (ecs); + gtk_widget_set_sensitive (cle->app, TRUE); + cle->in_async_call = FALSE; + gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_MODIFIED], status, cle->card); @@ -353,6 +360,9 @@ save_card (EContactListEditor *cle, gboolean should_close) ecs->cle = cle; ecs->should_close = should_close; + gtk_widget_set_sensitive (cle->app, FALSE); + cle->in_async_call = TRUE; + if (cle->is_new_list) e_book_add_card (cle->book, cle->card, GTK_SIGNAL_FUNC(list_added_cb), ecs); else @@ -407,6 +417,9 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data) static void list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle) { + gtk_widget_set_sensitive (cle->app, TRUE); + cle->in_async_call = FALSE; + gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_DELETED], status, cle->card); @@ -427,8 +440,12 @@ delete_cb (GtkWidget *widget, gpointer data) extract_info (cle); - if (!cle->is_new_list) + if (!cle->is_new_list) { + gtk_widget_set_sensitive (cle->app, FALSE); + cle->in_async_call = TRUE; + e_book_remove_card (cle->book, card, GTK_SIGNAL_FUNC(list_deleted_cb), cle); + } } gtk_object_unref(GTK_OBJECT(card)); @@ -699,6 +716,10 @@ app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) ce = E_CONTACT_LIST_EDITOR (data); + /* if we're in an async call, don't allow the dialog to close */ + if (ce->in_async_call) + return TRUE; + if (!prompt_to_save_changes (ce)) return TRUE; diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h index d83f15d6f7..37f54df170 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h @@ -75,6 +75,9 @@ struct _EContactListEditor /* Whether the contact editor will accept modifications */ guint editable : 1; + + /* Whether an async wombat call is in progress */ + guint in_async_call : 1; }; struct _EContactListEditorClass -- cgit v1.2.3