diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-09-22 06:08:13 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-09-22 06:08:13 +0800 |
commit | 84adebbb963fc2e458018475a8e377873e254062 (patch) | |
tree | 3b8805dad352cfbdc4449096a2831b995bf86f63 /addressbook/gui/widgets | |
parent | b9e1d0f5a61a88e7cc9feaaa6bf931805ba96d63 (diff) | |
download | gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.gz gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.tar.zst gsoc2013-evolution-84adebbb963fc2e458018475a8e377873e254062.zip |
Hooked up print preview button.
2001-09-21 Christopher James Lahey <clahey@ximian.com>
* gui/component/addressbook.c (print_preview_cb): Hooked up print
preview button.
* gui/widgets/e-addressbook-view.c,
gui/widgets/e-addressbook-view.h
(e_addressbook_view_print_preview): Added this function.
* printing/e-contact-print.c, printing/e-contact-print.h
(e_contact_print_preview): Added this function.
svn path=/trunk/; revision=13071
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 51 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.h | 1 |
2 files changed, 51 insertions, 1 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 50ae8d2d0e..095f1dbf48 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1200,7 +1200,6 @@ get_selection_model (EAddressbookView *view) return E_SELECTION_MODEL(E_TABLE_SCROLLED(view->widget)->table->selection); } - void e_addressbook_view_print(EAddressbookView *view) { @@ -1241,6 +1240,56 @@ e_addressbook_view_print(EAddressbookView *view) } } +void +e_addressbook_view_print_preview(EAddressbookView *view) +{ + if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) { + char *query; + EBook *book; + + gtk_object_get (GTK_OBJECT(view->model), + "query", &query, + "book", &book, + NULL); + e_contact_print_preview(book, query); + g_free(query); + } else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) { + EPrintable *printable; + ETable *etable; + GnomePrintMaster *master; + GnomePrintContext *pc; + GtkWidget *preview; + + gtk_object_get(GTK_OBJECT(view->widget), "table", &etable, NULL); + printable = e_table_get_printable(etable); + + master = gnome_print_master_new(); + gnome_print_master_set_copies (master, 1, FALSE); + pc = gnome_print_master_get_context( master ); + e_printable_reset(printable); + while (e_printable_data_left(printable)) { + if (gnome_print_gsave(pc) == -1) + /* FIXME */; + if (gnome_print_translate(pc, 72, 72) == -1) + /* FIXME */; + e_printable_print_page(printable, + pc, + 6.5 * 72, + 9 * 72, + TRUE); + if (gnome_print_grestore(pc) == -1) + /* FIXME */; + if (gnome_print_showpage(pc) == -1) + /* FIXME */; + } + gnome_print_master_close(master); + preview = GTK_WIDGET(gnome_print_master_preview_new(master, "Print Preview")); + gtk_widget_show_all(preview); + gtk_object_unref(GTK_OBJECT(master)); + gtk_object_unref(GTK_OBJECT(printable)); + } +} + static void card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data) { diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h index 621f26bb2a..c2fe0588b4 100644 --- a/addressbook/gui/widgets/e-addressbook-view.h +++ b/addressbook/gui/widgets/e-addressbook-view.h @@ -106,6 +106,7 @@ void e_addressbook_view_save_as (EAddressbookView *view); void e_addressbook_view_send (EAddressbookView *view); void e_addressbook_view_send_to (EAddressbookView *view); void e_addressbook_view_print (EAddressbookView *view); +void e_addressbook_view_print_preview (EAddressbookView *view); void e_addressbook_view_delete_selection (EAddressbookView *view); void e_addressbook_view_cut (EAddressbookView *view); void e_addressbook_view_copy (EAddressbookView *view); |