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 /addressbook/printing/e-contact-print.c | |
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
Diffstat (limited to 'addressbook/printing/e-contact-print.c')
-rw-r--r-- | addressbook/printing/e-contact-print.c | 46 |
1 files changed, 45 insertions, 1 deletions
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: |