From 8a2058e527f0d8311c05cec4f4487468cd167d14 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 30 Jun 2000 21:33:54 +0000 Subject: Use gnome-print to do a print preview. * mail-ops.c (print_msg): Use gnome-print to do a print preview. * folder-browser-factory.c: Hook up "Print" button. svn path=/trunk/; revision=3835 --- mail/ChangeLog | 4 ++++ mail/folder-browser-factory.c | 2 +- mail/mail-ops.c | 21 +++++++++++++++++++++ mail/mail.h | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 1313c25481..7da0ca383d 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,9 @@ 2000-06-30 Dan Winship + * mail-ops.c (print_msg): Use gnome-print to do a print preview. + + * folder-browser-factory.c: Hook up "Print" button. + * message-list.c (message_list_foreach): New function, a wrapper around e_table_selected_row_foreach, which calls the callback function with UIDs rather than row numbers. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 4ffabc6e75..74c50ca52f 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -46,7 +46,7 @@ static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("Refile"), N_("Move message to a new folder"), refile_msg, GNOME_STOCK_PIXMAP_MAIL_SND), - GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), random_cb, GNOME_STOCK_PIXMAP_PRINT), + GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), print_msg, GNOME_STOCK_PIXMAP_PRINT), GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), delete_msg, GNOME_STOCK_PIXMAP_TRASH), diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 169566cd99..27ad27a51c 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "mail.h" #include "mail-threads.h" #include "folder-browser.h" @@ -884,3 +886,22 @@ providers_config (BonoboUIHandler *uih, void *user_data, const char *path) gtk_widget_show (pc); } +void +print_msg (GtkWidget *button, gpointer user_data) +{ + FolderBrowser *fb = user_data; + GnomePrintMaster *print_master; + GnomePrintContext *print_context; + GtkWidget *preview; + + print_master = gnome_print_master_new (); + + print_context = gnome_print_master_get_context (print_master); + gtk_html_print (fb->mail_display->html, print_context); + + preview = GTK_WIDGET (gnome_print_master_preview_new ( + print_master, "Mail Print Preview")); + gtk_widget_show (preview); + + gtk_object_unref (GTK_OBJECT (print_master)); +} diff --git a/mail/mail.h b/mail/mail.h index 4f006776ee..38412d972b 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -58,6 +58,7 @@ void reply_to_sender (GtkWidget *button, gpointer user_data); void reply_to_all (GtkWidget *button, gpointer user_data); void delete_msg (GtkWidget *button, gpointer user_data); void refile_msg (GtkWidget *button, gpointer user_data); +void print_msg (GtkWidget *button, gpointer user_data); void expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path); void filter_edit (BonoboUIHandler *uih, void *user_data, const char *path); -- cgit v1.2.3