From f64bfabfa514536408915328c490748f7273b9cc Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Tue, 20 Aug 2002 02:00:45 +0000 Subject: take and pass the CallStatus to our listener. 2002-08-19 Chris Toshok * backend/pas/pas-book-view.c (pas_book_view_notify_complete): take and pass the CallStatus to our listener. * backend/pas/pas-book-view.h: change the prototype for notify_complete to include the CallStatus. * gui/component/select-names/e-select-names-completion.c (e_select_names_completion_seq_complete_cb): add the status arg. * gui/widgets/e-addressbook-view.c (e_addressbook_view_class_init): init the search_result signal. (e_addressbook_view_init): connect to the model's search_result signal. (emit_search_result): emit our search_result signal. (search_result): call emit_search_result. * gui/widgets/e-addressbook-view.h (struct _EAddressbookViewClass): add the search_result signal. * gui/widgets/e-addressbook-model.c (sequence_complete): emit both a "search_result" as well as the "stop_state_changed" signal. (e_addressbook_model_class_init): init the search_result signal. * gui/widgets/e-addressbook-model.h: add search_result signal. * gui/component/addressbook.c (search_result): pop up a dialog telling the user why the search failed or was truncated. (addressbook_factory_new_control): connect to the "search_result" signal on the view. * conduit/address-conduit.c (sequence_complete): add the status parameter to sequence_complete. * backend/idl/addressbook.idl: add BookViewListener_CallStatus, and change notifySequenceComplete to take a CallStatus. * backend/pas/pas-backend-ldap.c (create_card_handler): pass status back in the notify_complete call. (remove_card_handler): same. (modify_card_modify_handler): same (ldap_search_handler): same, and parse out the ldap return code so we can report limits being properly. * backend/pas/pas-backend-file.c (do_summary_query): pass status back in the notify_complete call. (pas_backend_file_search): same, and get rid of the status_message, as the status is passed back properly. (pas_backend_file_search): pass status back in the notify_complete call. (pas_backend_file_changes): same. (pas_backend_file_process_create_card): same. (pas_backend_file_process_remove_card): same. (pas_backend_file_process_modify_card): same. * backend/ebook/e-book-util.c (simple_query_sequence_complete_cb): add status parameter. * backend/ebook/e-book-view-listener.c (e_book_view_listener_queue_status_event): change name from _queue_empty_event, and take a status arg. (e_book_view_listener_queue_id_event): init resp->status (to SUCCESS). (e_book_view_listener_queue_sequence_event): same. (e_book_view_listener_queue_message_event): same. (impl_BookViewListener_notify_sequence_complete): call queue_status_event, and convert the corba status to EBookViewStatus. (e_book_view_listener_convert_status): new function, conver the corba status to EBookViewStatus. * backend/ebook/e-book-view-listener.h: add a "status" slot to EBookViewListenerResponse. * backend/ebook/e-book-view.h: change prototype for sequence_complete signal. * backend/ebook/e-book-view.c (e_book_view_do_complete_event): sequence_complete takes a parameter now (EBookViewStatus). (e_book_view_class_init): add the enum arg to the signal. * backend/ebook/e-book-types.h: add EBookViewStatus enum. svn path=/trunk/; revision=17814 --- addressbook/backend/pas/pas-backend-file.c | 16 +++++++--------- addressbook/backend/pas/pas-backend-ldap.c | 21 +++++++++++++++------ addressbook/backend/pas/pas-book-view.c | 5 +++-- addressbook/backend/pas/pas-book-view.h | 3 ++- 4 files changed, 27 insertions(+), 18 deletions(-) (limited to 'addressbook/backend/pas') diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index fe14be3f07..542ab47c0b 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -190,7 +190,7 @@ do_summary_query (PASBackendFile *bf, if (card_count) pas_book_view_notify_add (view->book_view, cards); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); g_list_foreach (cards, (GFunc)g_free, NULL); g_list_free (cards); @@ -377,9 +377,7 @@ pas_backend_file_search (PASBackendFile *bf, view->card_sexp = pas_backend_card_sexp_new (view->search); if (!view->card_sexp) { - /* need a different error message here. */ - pas_book_view_notify_status_message (view->book_view, _("Error in search expression.")); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_InvalidQuery); return; } @@ -436,7 +434,7 @@ pas_backend_file_search (PASBackendFile *bf, if (card_count) pas_book_view_notify_add (view->book_view, cards); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); /* ** It's fine to do this now since the data has been handed off. @@ -561,7 +559,7 @@ pas_backend_file_changes (PASBackendFile *bf, pas_book_view_notify_remove (view->book_view, id); } - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); } /* Update the hash */ @@ -658,7 +656,7 @@ pas_backend_file_process_create_card (PASBackend *backend, if (vcard_matches_search (view, vcard)) { bonobo_object_ref (BONOBO_OBJECT (view->book_view)); pas_book_view_notify_add_1 (view->book_view, vcard); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); bonobo_object_unref (BONOBO_OBJECT (view->book_view)); } } @@ -728,7 +726,7 @@ pas_backend_file_process_remove_card (PASBackend *backend, if (vcard_matches_search (view, vcard_string)) { bonobo_object_ref (BONOBO_OBJECT (view->book_view)); pas_book_view_notify_remove (view->book_view, req->id); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); bonobo_object_unref (BONOBO_OBJECT (view->book_view)); } } @@ -809,7 +807,7 @@ pas_backend_file_process_modify_card (PASBackend *backend, else /* if (old_match) */ pas_book_view_notify_remove (view->book_view, id); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev); diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 296bb8797a..2d30ef508c 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -1059,7 +1059,7 @@ create_card_handler (LDAPOp *op, LDAPMessage *res) pas_book_view_notify_add_1 (view->book_view, new_vcard); } - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); g_free (new_vcard); @@ -1071,7 +1071,7 @@ create_card_handler (LDAPOp *op, LDAPMessage *res) } if (op->view) - pas_book_view_notify_complete (op->view); + pas_book_view_notify_complete (op->view, GNOME_Evolution_Addressbook_BookViewListener_Success); /* and lastly respond */ response = ldap_error_to_response (ldap_error); @@ -1259,7 +1259,7 @@ remove_card_handler (LDAPOp *op, LDAPMessage *res) ldap_error_to_response (ldap_error)); if (op->view) - pas_book_view_notify_complete (op->view); + pas_book_view_notify_complete (op->view, GNOME_Evolution_Addressbook_BookViewListener_Success); } static void @@ -1371,7 +1371,7 @@ modify_card_modify_handler (LDAPOp *op, LDAPMessage *res) pas_book_view_notify_add_1 (view->book_view, modify_op->vcard); else /* if (old_match) */ pas_book_view_notify_remove (view->book_view, e_card_simple_get_id (modify_op->card)); - pas_book_view_notify_complete (view->book_view); + pas_book_view_notify_complete (view->book_view, GNOME_Evolution_Addressbook_BookViewListener_Success); bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev); } @@ -2771,14 +2771,23 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res) /* the entry that marks the end of our search */ if (search_op->num_pending_adds) send_pending_adds (search_op); - pas_book_view_notify_complete (search_op->op.view); + + if (ldap_error == LDAP_TIMELIMIT_EXCEEDED) + pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_BookViewListener_SearchTimeLimitExceeded); + else if (ldap_error == LDAP_SIZELIMIT_EXCEEDED) + pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_BookViewListener_SearchSizeLimitExceeded); + else if (ldap_error == LDAP_SUCCESS) + pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_BookViewListener_Success); + else + pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_BookViewListener_OtherError); + ldap_op_finished (op); } else { g_warning ("unhandled search result type %d returned", msg_type); if (search_op->num_pending_adds) send_pending_adds (search_op); - pas_book_view_notify_complete (search_op->op.view); + pas_book_view_notify_complete (search_op->op.view, GNOME_Evolution_Addressbook_BookViewListener_OtherError); ldap_op_finished (op); } } diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c index b5266a6b35..27d0f3ae06 100644 --- a/addressbook/backend/pas/pas-book-view.c +++ b/addressbook/backend/pas/pas-book-view.c @@ -126,14 +126,15 @@ pas_book_view_notify_add_1 (PASBookView *book_view, } void -pas_book_view_notify_complete (PASBookView *book_view) +pas_book_view_notify_complete (PASBookView *book_view, + GNOME_Evolution_Addressbook_BookViewListener_CallStatus status) { CORBA_Environment ev; CORBA_exception_init (&ev); GNOME_Evolution_Addressbook_BookViewListener_notifySequenceComplete ( - book_view->priv->listener, &ev); + book_view->priv->listener, status, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("pas_book_view_notify_complete: Exception signaling BookViewListener!\n"); diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h index 26bf360f17..712f3c3b96 100644 --- a/addressbook/backend/pas/pas-book-view.h +++ b/addressbook/backend/pas/pas-book-view.h @@ -40,7 +40,8 @@ void pas_book_view_notify_add (PASBookView *b const GList *cards); void pas_book_view_notify_add_1 (PASBookView *book_view, const char *card); -void pas_book_view_notify_complete (PASBookView *book_view); +void pas_book_view_notify_complete (PASBookView *book_view, + GNOME_Evolution_Addressbook_BookViewListener_CallStatus); void pas_book_view_notify_status_message (PASBookView *book_view, const char *message); -- cgit v1.2.3