From ff41087ad40d0527b53cd0815419978a3df5995c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 8 Aug 2001 00:22:05 +0000 Subject: Hide the app->window. (do_mail_print): Set the parent of the gnome-dialog 2001-08-07 Jeffrey Stedfast * mail-callbacks.c (manage_subscriptions): Hide the app->window. (do_mail_print): Set the parent of the gnome-dialog to be the folder-browser so that when evolution is closed, the print dialog gets destroyed. Should fix bug #4781. svn path=/trunk/; revision=11757 --- mail/ChangeLog | 3 +++ mail/mail-callbacks.c | 65 ++++++++++++++++++++------------------------------- mail/mail-callbacks.h | 3 --- 3 files changed, 28 insertions(+), 43 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 63b46541a0..3365d0bf31 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -6,6 +6,9 @@ 2001-08-07 Jeffrey Stedfast * mail-callbacks.c (manage_subscriptions): Hide the app->window. + (do_mail_print): Set the parent of the gnome-dialog to be the + folder-browser so that when evolution is closed, the print dialog + gets destroyed. Should fix bug #4781. * subscribe-dialog.c (subscribe_dialog_new): This should return a GtkWidget not a GtkObject. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index a3daf4e89e..35d59afb56 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1794,53 +1794,50 @@ providers_config (BonoboUIComponent *uih, void *user_data, const char *path) * of for you */ static void -do_mail_print (MailDisplay *md, gboolean preview) +do_mail_print (FolderBrowser *fb, gboolean preview) { GnomePrintContext *print_context; GnomePrintMaster *print_master; - GnomePrintDialog *gpd; + GnomePrintDialog *dialog; GnomePrinter *printer = NULL; int copies = 1; int collate = FALSE; - + 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))) { + dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"), + GNOME_PRINT_DIALOG_COPIES)); + gnome_dialog_set_default (GNOME_DIALOG (dialog), GNOME_PRINT_PRINT); + gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (fb)); + + switch (gnome_dialog_run (GNOME_DIALOG (dialog))) { case GNOME_PRINT_PRINT: - break; - + break; case GNOME_PRINT_PREVIEW: preview = TRUE; break; - case -1: return; - default: - gnome_dialog_close (GNOME_DIALOG (gpd)); + gnome_dialog_close (GNOME_DIALOG (dialog)); return; } - - gnome_print_dialog_get_copies (gpd, &copies, &collate); - printer = gnome_print_dialog_get_printer (gpd); - gnome_dialog_close (GNOME_DIALOG (gpd)); + + gnome_print_dialog_get_copies (dialog, &copies, &collate); + printer = gnome_print_dialog_get_printer (dialog); + gnome_dialog_close (GNOME_DIALOG (dialog)); } - + 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); + gtk_html_print (fb->mail_display->html, print_context); gnome_print_master_close (print_master); - + if (preview){ gboolean landscape = FALSE; GnomePrintMasterPreview *preview; @@ -1850,7 +1847,7 @@ do_mail_print (MailDisplay *md, gboolean preview) 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")); @@ -1859,32 +1856,20 @@ do_mail_print (MailDisplay *md, gboolean preview) 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); + + do_mail_print (fb, FALSE); } void print_preview_msg (GtkWidget *button, gpointer user_data) { FolderBrowser *fb = user_data; - - mail_print_preview_msg (fb->mail_display); + + do_mail_print (fb, TRUE); } /******************** Begin Subscription Dialog ***************************/ diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h index e37813b03e..42d3004c38 100644 --- a/mail/mail-callbacks.h +++ b/mail/mail-callbacks.h @@ -112,9 +112,6 @@ void composer_postpone_cb (EMsgComposer *composer, gpointer data); void forward_messages (CamelFolder *folder, GPtrArray *uids, gboolean inline); -void mail_print_preview_msg (MailDisplay *md); -void mail_print_msg (MailDisplay *md); - /* CamelStore callbacks */ void folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *fi); void folder_deleted (CamelStore *store, CamelFolderInfo *fi); -- cgit v1.2.3