aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/folder-browser-factory.c1
-rw-r--r--mail/mail-callbacks.c113
-rw-r--r--mail/mail-format.c1
-rw-r--r--mail/mail.h67
5 files changed, 140 insertions, 51 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index f71ae71812..4efd9d252e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-09-29 Miguel de Icaza <miguel@helixcode.com>
+
+ * folder-browser-factory.c: Add print preview verb here.
+
+ * mail-callbacks.c (do_mail_print): Handle printing here, the
+ complete engine.
+ (mail_print_preview_msg): new. does print previewing.
+ (mail_print_msg): does printing of the message.
+
2000-09-29 Chris Toshok <toshok@helixcode.com>
* subscribe-control-factory.c, subscribe-control-factory.h: nuked.
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index ef62d888a5..d66bbb7aa3 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -78,6 +78,7 @@ create_ondemand_hooks (FolderBrowser *fb, BonoboUIHandler *uih)
*/
BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("PrintMessage", print_msg),
+ BONOBO_UI_VERB ("PrintPreviewMessage", print_preview_msg),
/* Edit Menu */
BONOBO_UI_VERB ("EditSelectAll", select_all),
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 118dc5d4bb..f4f1ffcb20 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -41,6 +41,7 @@
#include "filter/filter-editor.h"
#include "filter/filter-driver.h"
#include <gal/e-table/e-table.h>
+#include <gal/widgets/e-gui-utils.h>
/* FIXME: is there another way to do this? */
#include "Evolution.h"
@@ -723,43 +724,115 @@ providers_config (BonoboUIHandler *uih, void *user_data, const char *path)
mail_config ((FOLDER_BROWSER (user_data))->shell);
}
-void
-manage_subscriptions (BonoboUIHandler *uih, void *user_data, const char *path)
+/*
+ * FIXME: This routine could be made generic, by having a closure
+ * function plus data, and having the whole process be taken care
+ * of for you
+ */
+static void
+do_mail_print (MailDisplay *md, gboolean preview)
{
- /* XXX pass in the selected storage */
- GtkWidget *subscribe = subscribe_control_new ();
+ GnomePrintContext *print_context;
+ GnomePrintMaster *print_master;
+ GnomePrintDialog *gpd;
+ GnomePrinter *printer = NULL;
+ int copies = 1;
+ int collate = FALSE;
- gtk_widget_show (subscribe);
-}
+ if (!preview){
+
+ gpd = GNOME_PRINT_DIALOG (
+ gnome_print_dialog_new (_("Print Message"), GNOME_PRINT_DIALOG_COPIES));
+ gnome_dialog_set_default (GNOME_DIALOG (gpd), GNOME_PRINT_PRINT);
+
+ switch (gnome_dialog_run (GNOME_DIALOG (gpd))){
+ case GNOME_PRINT_PRINT:
+ break;
+
+ case GNOME_PRINT_PREVIEW:
+ preview = TRUE;
+ break;
+
+ case -1:
+ return;
+
+ default:
+ gnome_dialog_close (GNOME_DIALOG (gpd));
+ return;
+ }
+
+ gnome_print_dialog_get_copies (gpd, &copies, &collate);
+ printer = gnome_print_dialog_get_printer (gpd);
+ gnome_dialog_close (GNOME_DIALOG (gpd));
+ }
-void
-mail_print_msg (MailDisplay *md)
-{
- GnomePrintMaster *print_master;
- GnomePrintContext *print_context;
- GtkWidget *preview;
-
print_master = gnome_print_master_new ();
-
+
+/* FIXME: set paper size gnome_print_master_set_paper (print_master, */
+
+ if (printer)
+ gnome_print_master_set_printer (print_master, printer);
+ gnome_print_master_set_copies (print_master, copies, collate);
print_context = gnome_print_master_get_context (print_master);
gtk_html_print (md->html, print_context);
-
- preview = GTK_WIDGET (gnome_print_master_preview_new (
- print_master, "Mail Print Preview"));
- gtk_widget_show (preview);
-
+ gnome_print_master_close (print_master);
+
+ if (preview){
+ gboolean landscape = FALSE;
+ GnomePrintMasterPreview *preview;
+
+ preview = gnome_print_master_preview_new_with_orientation (
+ print_master, _("Print Preview"), landscape);
+ gtk_widget_show (GTK_WIDGET (preview));
+ } else {
+ int result = gnome_print_master_print (print_master);
+
+ if (result == -1){
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("Printing of message failed"));
+ }
+ }
gtk_object_unref (GTK_OBJECT (print_master));
}
void
+mail_print_preview_msg (MailDisplay *md)
+{
+ do_mail_print (md, TRUE);
+}
+
+void
+mail_print_msg (MailDisplay *md)
+{
+ do_mail_print (md, FALSE);
+}
+
+void
print_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = user_data;
-
+
mail_print_msg (fb->mail_display);
}
void
+print_preview_msg (GtkWidget *button, gpointer user_data)
+{
+ FolderBrowser *fb = user_data;
+
+ mail_print_preview_msg (fb->mail_display);
+}
+
+void
+manage_subscriptions (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ /* XXX pass in the selected storage */
+ GtkWidget *subscribe = subscribe_control_new ();
+
+ gtk_widget_show (subscribe);
+}
+
+void
configure_folder(BonoboUIHandler *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER(user_data);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 8232f20d9e..79a49bde74 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -27,6 +27,7 @@
#include "mail-tools.h"
#include "mail-display.h"
#include "mail.h"
+#include "shell/e-setup.h"
#include "e-util/e-html-utils.h"
#include <libgnome/libgnome.h>
#include <libgnomevfs/gnome-vfs-mime-info.h>
diff --git a/mail/mail.h b/mail/mail.h
index 679782231f..92a059d7bd 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -69,31 +69,32 @@ char *mail_get_message_body (CamelDataWrapper *data, gboolean want_plain,
char *mail_identify_mime_part (CamelMimePart *part);
/* mail-callbacks */
-void fetch_mail (GtkWidget *widget, gpointer user_data);
-void send_queued_mail (GtkWidget *widget, gpointer user_data);
+void fetch_mail (GtkWidget *widget, gpointer user_data);
+void send_queued_mail (GtkWidget *widget, gpointer user_data);
void send_receieve_mail (GtkWidget *widget, gpointer user_data);
-void compose_msg (GtkWidget *widget, gpointer user_data);
-void send_to_url (const char *url);
-void forward_msg (GtkWidget *widget, gpointer user_data);
-void reply_to_sender (GtkWidget *widget, gpointer user_data);
-void reply_to_all (GtkWidget *widget, gpointer user_data);
-void delete_msg (GtkWidget *widget, gpointer user_data);
-void move_msg (GtkWidget *widget, gpointer user_data);
-void copy_msg (GtkWidget *widget, gpointer user_data);
-void print_msg (GtkWidget *widget, gpointer user_data);
-void edit_msg (GtkWidget *widget, gpointer user_data);
-void view_msg (GtkWidget *widget, gpointer user_data);
-
-void select_all (BonoboUIHandler *uih, void *user_data, const char *path);
-void unselect_all (BonoboUIHandler *uih, void *user_data, const char *path);
-void mark_as_seen (BonoboUIHandler *uih, void *user_data, const char *path);
-void mark_as_unseen (BonoboUIHandler *uih, void *user_data, const char *path);
-
-void edit_message (BonoboUIHandler *uih, void *user_data, const char *path);
-void view_message (BonoboUIHandler *uih, void *user_data, const char *path);
-void expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path);
-void filter_edit (BonoboUIHandler *uih, void *user_data, const char *path);
+void compose_msg (GtkWidget *widget, gpointer user_data);
+void send_to_url (const char *url);
+void forward_msg (GtkWidget *widget, gpointer user_data);
+void reply_to_sender (GtkWidget *widget, gpointer user_data);
+void reply_to_all (GtkWidget *widget, gpointer user_data);
+void delete_msg (GtkWidget *widget, gpointer user_data);
+void move_msg (GtkWidget *widget, gpointer user_data);
+void copy_msg (GtkWidget *widget, gpointer user_data);
+void print_msg (GtkWidget *widget, gpointer user_data);
+void print_preview_msg (GtkWidget *widget, gpointer user_data);
+void edit_msg (GtkWidget *widget, gpointer user_data);
+void view_msg (GtkWidget *widget, gpointer user_data);
+
+void select_all (BonoboUIHandler *uih, void *user_data, const char *path);
+void unselect_all (BonoboUIHandler *uih, void *user_data, const char *path);
+void mark_as_seen (BonoboUIHandler *uih, void *user_data, const char *path);
+void mark_as_unseen (BonoboUIHandler *uih, void *user_data, const char *path);
+
+void edit_message (BonoboUIHandler *uih, void *user_data, const char *path);
+void view_message (BonoboUIHandler *uih, void *user_data, const char *path);
+void expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path);
+void filter_edit (BonoboUIHandler *uih, void *user_data, const char *path);
void vfolder_edit_vfolders (BonoboUIHandler *uih, void *user_data, const char *path);
void providers_config (BonoboUIHandler *uih, void *user_data, const char *path);
void manage_subscriptions (BonoboUIHandler *uih, void *user_data, const char *path);
@@ -103,7 +104,9 @@ void configure_folder (BonoboUIHandler *uih, void *user_data, const char *path);
void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolean to_all);
void composer_send_cb (EMsgComposer *composer, gpointer data);
void composer_postpone_cb (EMsgComposer *composer, gpointer data);
-void mail_print_msg (MailDisplay *md);
+
+void mail_print_preview_msg (MailDisplay *md);
+void mail_print_msg (MailDisplay *md);
void run_filter_ondemand (BonoboUIHandler *uih, gpointer user_data, const char *path);
@@ -124,10 +127,12 @@ void forget_passwords (BonoboUIHandler *uih, void *user_data,
extern CamelSession *session;
/* message-list */
-void vfolder_subject(GtkWidget *w, FolderBrowser *fb);
-void vfolder_sender(GtkWidget *w, FolderBrowser *fb);
-void vfolder_recipient(GtkWidget *w, FolderBrowser *fb);
-void filter_subject(GtkWidget *w, FolderBrowser *fb);
-void filter_sender(GtkWidget *w, FolderBrowser *fb);
-void filter_recipient(GtkWidget *w, FolderBrowser *fb);
-void filter_mlist(GtkWidget *w, FolderBrowser *fb);
+void vfolder_subject (GtkWidget *w, FolderBrowser *fb);
+void vfolder_sender (GtkWidget *w, FolderBrowser *fb);
+void vfolder_recipient (GtkWidget *w, FolderBrowser *fb);
+
+void filter_subject (GtkWidget *w, FolderBrowser *fb);
+void filter_sender (GtkWidget *w, FolderBrowser *fb);
+void filter_recipient (GtkWidget *w, FolderBrowser *fb);
+void filter_mlist (GtkWidget *w, FolderBrowser *fb);
+