2
* (GBONDS) GNOME based Savings Bond Inventory Program
4
* print-dialog.c: Print dialog module
6
* Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
#include <libgnomeprint/gnome-print-paper.h>
29
#include <libgnomeprintui/gnome-print-dialog.h>
30
#include <libgnomeprint/gnome-print-job.h>
31
#include <libgnomeprintui/gnome-print-job-preview.h>
33
#include "print-dialog.h"
40
/*===========================================*/
42
/*===========================================*/
44
/*===========================================*/
45
/* Private globals. */
46
/*===========================================*/
48
/*===========================================*/
49
/* Private function prototypes. */
50
/*===========================================*/
51
static void print_response (GtkDialog *dlg,
56
/*****************************************************************************/
58
/*****************************************************************************/
60
gb_print_dialog (gbView *view, BonoboWindow *win)
64
g_return_if_fail (view && GB_IS_VIEW(view));
65
g_return_if_fail (win && BONOBO_IS_WINDOW(win));
67
dlg = gnome_print_dialog_new (NULL, _("Print inventory"), 0);
69
gtk_window_set_transient_for (GTK_WINDOW(dlg), GTK_WINDOW(win));
71
g_signal_connect (G_OBJECT(dlg), "response",
72
G_CALLBACK (print_response), view);
74
gtk_widget_show (dlg);
77
/*---------------------------------------------------------------------------*/
78
/* PRIVATE. Print "response" callback. */
79
/*---------------------------------------------------------------------------*/
81
print_response (GtkDialog *dlg,
85
GnomePrintConfig *config;
91
case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
92
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG(dlg));
93
job = gnome_print_job_new (config);
95
gnome_print_job_close (job);
96
gnome_print_job_print (job);
97
g_object_unref (G_OBJECT(job));
100
case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
101
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG(dlg));
102
job = gnome_print_job_new (config);
103
gb_print (job, view);
104
gnome_print_job_close (job);
105
preview = gnome_print_job_preview_new (job, _("Print preview"));
106
gtk_widget_show (preview);
107
g_object_unref (G_OBJECT(job));
115
gtk_widget_destroy (GTK_WIDGET (dlg));