diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-30 21:41:12 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-30 21:41:12 +0800 |
commit | 886713b8b1393dca9f9c9abe87ccb928eca8c0ef (patch) | |
tree | 5840a802acf3f9b04c20060f8697ab31bb9bc479 | |
parent | 0ae2ea2e320b1f1e1aaa640316908378e0a064dc (diff) | |
download | gsoc2013-evolution-886713b8b1393dca9f9c9abe87ccb928eca8c0ef.tar.gz gsoc2013-evolution-886713b8b1393dca9f9c9abe87ccb928eca8c0ef.tar.zst gsoc2013-evolution-886713b8b1393dca9f9c9abe87ccb928eca8c0ef.zip |
Added "sequence_complete" signal.
2000-05-30 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/e-book-view-listener.c,
backend/ebook/e-book-view-listener.h, backend/ebook/e-book-view.c,
backend/ebook/e-book-view.h, backend/idl/addressbook.idl,
backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c,
backend/pas/pas-book-factory.c, backend/pas/pas-book-view.c,
backend/pas/pas-book-view.h: Added "sequence_complete" signal.
* printing/e-contact-print.c: Made printing wait for
"sequence_complete" signal and made it sort.
svn path=/trunk/; revision=3279
-rw-r--r-- | addressbook/ChangeLog | 12 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.c | 28 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.h | 3 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view.c | 19 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view.h | 7 | ||||
-rw-r--r-- | addressbook/backend/idl/addressbook.idl | 1 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-file.c | 10 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-ldap.c | 1 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-factory.c | 2 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-view.c | 17 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-view.h | 1 | ||||
-rw-r--r-- | addressbook/printing/e-contact-print.c | 46 |
12 files changed, 138 insertions, 9 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 3b0e4e5576..6aef5a787e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2000-05-30 Christopher James Lahey <clahey@helixcode.com> + + * backend/ebook/e-book-view-listener.c, + backend/ebook/e-book-view-listener.h, backend/ebook/e-book-view.c, + backend/ebook/e-book-view.h, backend/idl/addressbook.idl, + backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c, + backend/pas/pas-book-factory.c, backend/pas/pas-book-view.c, + backend/pas/pas-book-view.h: Added "sequence_complete" signal. + + * printing/e-contact-print.c: Made printing wait for + "sequence_complete" signal and made it sort. + 2000-05-25 Christopher James Lahey <clahey@helixcode.com> * gui/component/addressbook.c, diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c index c84bf160c5..71f942798a 100644 --- a/addressbook/backend/ebook/e-book-view-listener.c +++ b/addressbook/backend/ebook/e-book-view-listener.c @@ -48,7 +48,7 @@ e_book_view_listener_check_queue (EBookViewListener *listener) static void e_book_view_listener_queue_response (EBookViewListener *listener, - EBookViewListenerResponse *response) + EBookViewListenerResponse *response) { listener->priv->response_queue = g_list_append (listener->priv->response_queue, @@ -62,6 +62,22 @@ e_book_view_listener_queue_response (EBookViewListener *listener, /* Add, Remove, Modify */ static void +e_book_view_listener_queue_empty_event (EBookViewListener *listener, + EBookViewListenerOperation op) +{ + EBookViewListenerResponse *resp; + + resp = g_new0 (EBookViewListenerResponse, 1); + + resp->op = op; + resp->id = NULL; + resp->cards = NULL; + + e_book_view_listener_queue_response (listener, resp); +} + +/* Add, Remove, Modify */ +static void e_book_view_listener_queue_id_event (EBookViewListener *listener, EBookViewListenerOperation op, const char *id) @@ -132,6 +148,15 @@ impl_BookViewListener_signal_card_changed (PortableServer_Servant servant, listener, CardModifiedEvent, cards); } +static void +impl_BookViewListener_signal_sequence_complete (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); + + e_book_view_listener_queue_empty_event (listener, SequenceCompleteEvent); +} + /** * e_book_view_listener_check_pending: * @listener: the #EBookViewListener @@ -285,6 +310,7 @@ e_book_view_listener_get_epv (void) epv->signal_card_changed = impl_BookViewListener_signal_card_changed; epv->signal_card_removed = impl_BookViewListener_signal_card_removed; epv->signal_card_added = impl_BookViewListener_signal_card_added; + epv->signal_sequence_complete = impl_BookViewListener_signal_sequence_complete; return epv; } diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h index e479ffd99b..65e5f8eb5b 100644 --- a/addressbook/backend/ebook/e-book-view-listener.h +++ b/addressbook/backend/ebook/e-book-view-listener.h @@ -40,7 +40,8 @@ typedef enum { /* Async events */ CardAddedEvent, CardRemovedEvent, - CardModifiedEvent + CardModifiedEvent, + SequenceCompleteEvent, } EBookViewListenerOperation; typedef struct { diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c index 65a90b8ede..f00a2efb08 100644 --- a/addressbook/backend/ebook/e-book-view.c +++ b/addressbook/backend/ebook/e-book-view.c @@ -31,6 +31,7 @@ enum { CARD_CHANGED, CARD_REMOVED, CARD_ADDED, + SEQUENCE_COMPLETE, LAST_SIGNAL }; @@ -68,6 +69,13 @@ e_book_view_do_removed_event (EBookView *book_view, g_free(resp->id); } +static void +e_book_view_do_complete_event (EBookView *book_view, + EBookViewListenerResponse *resp) +{ + gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [SEQUENCE_COMPLETE]); +} + /* * Reading notices out of the EBookViewListener's queue. @@ -92,6 +100,9 @@ e_book_view_check_listener_queue (EBookViewListener *listener, EBookView *book_v case CardRemovedEvent: e_book_view_do_removed_event (book_view, resp); break; + case SequenceCompleteEvent: + e_book_view_do_complete_event (book_view, resp); + break; default: g_error ("EBookView: Unknown operation %d in listener queue!\n", resp->op); @@ -248,6 +259,14 @@ e_book_view_class_init (EBookViewClass *klass) GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); + e_book_view_signals [SEQUENCE_COMPLETE] = + gtk_signal_new ("sequence_complete", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EBookViewClass, sequence_complete), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, e_book_view_signals, LAST_SIGNAL); diff --git a/addressbook/backend/ebook/e-book-view.h b/addressbook/backend/ebook/e-book-view.h index 92fde1e37f..b8edc68018 100644 --- a/addressbook/backend/ebook/e-book-view.h +++ b/addressbook/backend/ebook/e-book-view.h @@ -33,9 +33,10 @@ struct _EBookViewClass { /* * Signals. */ - void (* card_changed) (EBookView *book_view, const GList *cards); - void (* card_removed) (EBookView *book_view, const char *id); - void (* card_added) (EBookView *book_view, const GList *cards); + void (* card_changed) (EBookView *book_view, const GList *cards); + void (* card_removed) (EBookView *book_view, const char *id); + void (* card_added) (EBookView *book_view, const GList *cards); + void (* sequence_complete) (EBookView *book_view); }; /* Creating a new addressbook. */ diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl index 9a7743f974..b8cf15c4ff 100644 --- a/addressbook/backend/idl/addressbook.idl +++ b/addressbook/backend/idl/addressbook.idl @@ -32,6 +32,7 @@ module Evolution { void signal_card_added (in VCardList cards); void signal_card_removed (in CardId id); void signal_card_changed (in VCardList cards); + void signal_sequence_complete (); }; interface BookView : Bonobo::Unknown { diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index 56a0fd4652..f76a92c38c 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -458,6 +458,7 @@ pas_backend_file_search (PASBackendFile *bf, } else { pas_book_view_notify_add (view->book_view, cards); + pas_book_view_notify_complete (view->book_view); } /* @@ -529,8 +530,10 @@ pas_backend_file_process_create_card (PASBackend *backend, if (id) { for (list = bf->priv->book_views; list; list = g_list_next(list)) { PASBackendFileBookView *view = list->data; - if (vcard_matches_search (view, vcard)) + if (vcard_matches_search (view, vcard)) { pas_book_view_notify_add_1 (view->book_view, vcard); + pas_book_view_notify_complete (view->book_view); + } } pas_book_respond_create ( @@ -592,8 +595,10 @@ pas_backend_file_process_remove_card (PASBackend *backend, vcard_string = vcard_dbt.data; for (list = bf->priv->book_views; list; list = g_list_next(list)) { PASBackendFileBookView *view = list->data; - if (vcard_matches_search (view, vcard_string)) + if (vcard_matches_search (view, vcard_string)) { pas_book_view_notify_remove (view->book_view, req->id); + pas_book_view_notify_complete (view->book_view); + } } pas_book_respond_remove ( @@ -655,6 +660,7 @@ pas_backend_file_process_modify_card (PASBackend *backend, pas_book_view_notify_add_1 (view->book_view, req->vcard); else /* if (old_match) */ pas_book_view_notify_remove (view->book_view, id); + pas_book_view_notify_complete (view->book_view); } pas_book_respond_modify ( diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 2298693f94..02719657c3 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -623,6 +623,7 @@ poll_ldap (PASBackendLDAPBookView *view) if ((rc = ldap_result (ldap, view->search_msgid, 0, NULL, &res)) != LDAP_RES_SEARCH_ENTRY) { view->search_idle = 0; + pas_book_view_notify_complete (view->book_view); return FALSE; } diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c index f4012b2adf..626c7420e2 100644 --- a/addressbook/backend/pas/pas-book-factory.c +++ b/addressbook/backend/pas/pas-book-factory.c @@ -359,7 +359,7 @@ impl_Evolution_BookFactory_open_book (PortableServer_Servant servant, listener, Evolution_BookListener_ProtocolNotSupported, CORBA_OBJECT_NIL, - &ev); + ev); return; } diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c index d218112555..4e1c8697aa 100644 --- a/addressbook/backend/pas/pas-book-view.c +++ b/addressbook/backend/pas/pas-book-view.c @@ -125,6 +125,23 @@ pas_book_view_notify_add_1 (PASBookView *book_view, g_list_free(list); } +void +pas_book_view_notify_complete (PASBookView *book_view) +{ + CORBA_Environment ev; + + CORBA_exception_init (&ev); + + Evolution_BookViewListener_signal_sequence_complete ( + book_view->priv->listener, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("pas_book_view_notify_complete: Exception signaling BookViewListener!\n"); + } + + CORBA_exception_free (&ev); +} + static gboolean pas_book_view_construct (PASBookView *book_view, Evolution_BookViewListener listener) diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h index 55023b48ed..b9cdbee876 100644 --- a/addressbook/backend/pas/pas-book-view.h +++ b/addressbook/backend/pas/pas-book-view.h @@ -41,6 +41,7 @@ void pas_book_view_notify_add (PASBookView 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); GtkType pas_book_view_get_type (void); diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index 98c4d96a47..f03f1389b4 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -60,6 +60,8 @@ struct _EContactPrintContext int type; EBook *book; gchar *query; + + GList *cards; }; static gint @@ -496,8 +498,9 @@ e_contact_start_new_column (EContactPrintContext *ctxt) } static void -create_card(EBookView *book_view, const GList *cards, EContactPrintContext *ctxt) +complete_sequence(EBookView *book_view, EContactPrintContext *ctxt) { + GList *cards = ctxt->cards; for(; cards; cards = cards->next) { ECard *card = cards->data; ECardSimple *simple = e_card_simple_new(card); @@ -549,6 +552,8 @@ create_card(EBookView *book_view, const GList *cards, EContactPrintContext *ctxt gtk_object_unref(GTK_OBJECT(ctxt->master)); gtk_object_unref(GTK_OBJECT(ctxt->book)); g_free(ctxt->query); + g_list_foreach(ctxt->cards, (GFunc) gtk_object_unref, NULL); + g_list_free(ctxt->cards); gtk_object_unref(GTK_OBJECT(ctxt->style->headings_font)); gtk_object_unref(GTK_OBJECT(ctxt->style->body_font)); gtk_object_unref(GTK_OBJECT(ctxt->style->header_font)); @@ -559,6 +564,38 @@ create_card(EBookView *book_view, const GList *cards, EContactPrintContext *ctxt g_free(ctxt); } +static int +card_compare (ECard *card1, ECard *card2) { + if (card1 && card2) { + char *file_as1, *file_as2; + gtk_object_get(GTK_OBJECT(card1), + "file_as", &file_as1, + NULL); + gtk_object_get(GTK_OBJECT(card2), + "file_as", &file_as2, + NULL); + if (file_as1 && file_as2) + return strcmp(file_as1, file_as2); + if (file_as1) + return -1; + if (file_as2) + return 1; + return strcmp(e_card_get_id(card1), e_card_get_id(card2)); + } else { + return 0; + } +} + +static void +create_card(EBookView *book_view, const GList *cards, EContactPrintContext *ctxt) +{ + for(; cards; cards = cards->next) { + ECard *card = cards->data; + gtk_object_ref(GTK_OBJECT(card)); + ctxt->cards = g_list_insert_sorted(ctxt->cards, card, (GCompareFunc) card_compare); + } +} + static void book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, EContactPrintContext *ctxt) { @@ -568,6 +605,11 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, EContac "card_added", GTK_SIGNAL_FUNC(create_card), ctxt); + + gtk_signal_connect(GTK_OBJECT(book_view), + "sequence_complete", + GTK_SIGNAL_FUNC(complete_sequence), + ctxt); } static void @@ -960,6 +1002,7 @@ e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data) ctxt->book = book; ctxt->query = query; + ctxt->cards = NULL; e_contact_do_print(book, ctxt->query, ctxt); gnome_dialog_close(dialog); break; @@ -990,6 +1033,7 @@ e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data) gtk_object_ref(GTK_OBJECT(book)); ctxt->book = book; ctxt->query = g_strdup(query); + ctxt->cards = NULL; e_contact_do_print(book, ctxt->query, ctxt); break; case GNOME_PRINT_CANCEL: |