(do_summary_print): Remove preview arg. Also, make

it destroy the dialog after a button has been clicked.
(e_summary_set_control): Add casts to avoid compiler warnings.

svn path=/trunk/; revision=21199
This commit is contained in:
Ettore Perazzoli
2003-05-15 21:58:07 +00:00
parent 7e7b7f49e8
commit 522e7942df
2 changed files with 33 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2003-05-15 Ettore Perazzoli <ettore@ximian.com>
* e-summary.c (do_summary_print): Remove preview arg. Also, make
it destroy the dialog after a button has been clicked.
(e_summary_set_control): Add casts to avoid compiler warnings.
2003-05-14 JP Rosevear <jpr@ximian.com>
* e-summary.h: fix up protos

View File

@ -593,60 +593,60 @@ e_summary_set_control (ESummary *summary, BonoboControl *control)
g_return_if_fail (IS_E_SUMMARY (summary));
if (summary->priv->control)
g_object_remove_weak_pointer (G_OBJECT (summary->priv->control), &summary->priv->control);
g_object_remove_weak_pointer (G_OBJECT (summary->priv->control), (void **) &summary->priv->control);
summary->priv->control = control;
if (summary->priv->control)
g_object_add_weak_pointer (G_OBJECT (summary->priv->control), &summary->priv->control);
g_object_add_weak_pointer (G_OBJECT (summary->priv->control), (void **) &summary->priv->control);
}
static void
do_summary_print (ESummary *summary,
gboolean preview)
do_summary_print (ESummary *summary)
{
GnomePrintContext *print_context;
GnomePrintJob *print_master;
GtkWidget *gpd;
GnomePrintConfig *config = NULL;
GtkWidget *preview_widget;
gboolean preview = FALSE;
if (! preview) {
gpd = gnome_print_dialog_new (NULL, _("Print Summary"), GNOME_PRINT_DIALOG_COPIES);
gpd = gnome_print_dialog_new (NULL, _("Print Summary"), GNOME_PRINT_DIALOG_COPIES);
switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
break;
switch (gtk_dialog_run (GTK_DIALOG (gpd))) {
case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
preview = FALSE;
break;
case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
preview = TRUE;
break;
case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
preview = TRUE;
break;
default:
gtk_widget_destroy (gpd);
return;
}
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (gpd));
default:
if (preview_widget != NULL)
gtk_widget_destroy (preview_widget);
gtk_widget_destroy (gpd);
return;
}
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (gpd));
print_master = gnome_print_job_new (config);
print_context = gnome_print_job_get_context (print_master);
gtk_html_print (GTK_HTML (summary->priv->html), print_context);
gnome_print_job_close (print_master);
if (preview) {
GtkWidget *preview;
gtk_widget_destroy (gpd);
preview = gnome_print_job_preview_new (print_master, _("Print Preview"));
gtk_widget_show (preview);
if (preview) {
preview_widget = gnome_print_job_preview_new (print_master, _("Print Preview"));
gtk_widget_show (preview_widget);
} else {
int result = gnome_print_job_print (print_master);
if (result == -1) {
e_notice (summary, GTK_MESSAGE_ERROR,
_("Printing of Summary failed"));
}
if (result == -1)
e_notice (gpd, GTK_MESSAGE_ERROR, _("Printing of Summary failed"));
}
g_object_unref (print_master);
@ -659,7 +659,7 @@ e_summary_print (BonoboUIComponent *component,
{
ESummary *summary = userdata;
do_summary_print (summary, FALSE);
do_summary_print (summary);
}
void