Commit bc1dbd58 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Add an GError parameter.

2006-06-21  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkprintbackend.h:
	* gtk/gtkprintbackend.c (gtk_print_backend_print_stream): Add an
	GError parameter.

	* modules/printbackends/file/gtkprintbackendfile.c
	(gtk_print_backend_file_print_stream):
	* modules/printbackends/lpr/gtkprintbackendlpr.c
	(gtk_print_backend_lpr_print_stream):
	* modules/printbackends/cups/gtkprintbackendcups.c
	(gtk_print_backend_cups_print_stream):
	* gtk/gtkprintjob.c (gtk_print_job_send): Update all callers and
	implementations.
parent 2c91a655
2006-06-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintbackend.h:
* gtk/gtkprintbackend.c (gtk_print_backend_print_stream): Add an
GError parameter.
* modules/printbackends/file/gtkprintbackendfile.c
(gtk_print_backend_file_print_stream):
* modules/printbackends/lpr/gtkprintbackendlpr.c
(gtk_print_backend_lpr_print_stream):
* modules/printbackends/cups/gtkprintbackendcups.c
(gtk_print_backend_cups_print_stream):
* gtk/gtkprintjob.c (gtk_print_job_send): Update all callers and
implementations.
* modules/printbackends/cups/gtkprintbackendcups.c: Remove the
GError parameter from cups_request_execute(), and various other
cleanups.
......
2006-06-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintbackend.h:
* gtk/gtkprintbackend.c (gtk_print_backend_print_stream): Add an
GError parameter.
* modules/printbackends/file/gtkprintbackendfile.c
(gtk_print_backend_file_print_stream):
* modules/printbackends/lpr/gtkprintbackendlpr.c
(gtk_print_backend_lpr_print_stream):
* modules/printbackends/cups/gtkprintbackendcups.c
(gtk_print_backend_cups_print_stream):
* gtk/gtkprintjob.c (gtk_print_job_send): Update all callers and
implementations.
* modules/printbackends/cups/gtkprintbackendcups.c: Remove the
GError parameter from cups_request_execute(), and various other
cleanups.
......
......@@ -579,7 +579,8 @@ gtk_print_backend_print_stream (GtkPrintBackend *backend,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify)
GDestroyNotify dnotify,
GError **error)
{
g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
......@@ -588,7 +589,8 @@ gtk_print_backend_print_stream (GtkPrintBackend *backend,
data_fd,
callback,
user_data,
dnotify);
dnotify,
error);
}
void
......
......@@ -76,7 +76,8 @@ struct _GtkPrintBackendClass
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GDestroyNotify dnotify,
GError **error);
/* Printer methods: */
void (*printer_request_details) (GtkPrinter *printer);
......@@ -137,7 +138,8 @@ void gtk_print_backend_print_stream (GtkPrintBackend *pri
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GDestroyNotify dnotify,
GError **error);
GList * gtk_print_backend_load_modules (void);
void gtk_print_backend_destroy (GtkPrintBackend *print_backend);
......
......@@ -648,6 +648,7 @@ gtk_print_job_send (GtkPrintJob *job,
GError **error)
{
GtkPrintJobPrivate *priv;
GError *print_error = NULL;
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), FALSE);
......@@ -656,12 +657,16 @@ gtk_print_job_send (GtkPrintJob *job,
gtk_print_job_set_status (job, GTK_PRINT_STATUS_SENDING_DATA);
lseek (priv->spool_file_fd, 0, SEEK_SET);
gtk_print_backend_print_stream (priv->backend,
job,
gtk_print_backend_print_stream (priv->backend, job,
priv->spool_file_fd,
callback,
user_data,
dnotify);
callback, user_data, dnotify,
&print_error);
if (print_error)
{
g_propagate_error (error, print_error);
return FALSE;
}
return TRUE;
}
......
......@@ -123,7 +123,8 @@ static gboolean cups_printer_mark_conflicts (GtkPrinter
GtkPrinterOptionSet *options);
static GtkPrinterOptionSet *cups_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup);
GtkPageSetup *page_setup,
GtkPrintCapabilities capabilities);
static void cups_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintJob *print_job,
GtkPrintSettings *settings,
......@@ -149,7 +150,8 @@ static void gtk_print_backend_cups_print_stream (GtkPrintBack
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GDestroyNotify dnotify,
GError **error);
static cairo_surface_t * cups_printer_create_cairo_surface (GtkPrinter *printer,
GtkPrintSettings *settings,
gdouble width,
......@@ -374,7 +376,8 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify)
GDestroyNotify dnotify,
GError **error)
{
GtkPrinterCups *cups_printer;
CupsPrintStreamData *ps;
......@@ -1919,9 +1922,10 @@ handle_group (GtkPrinterOptionSet *set,
}
static GtkPrinterOptionSet *
cups_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup)
cups_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup,
GtkPrintCapabilities capabilities)
{
GtkPrinterOptionSet *set;
GtkPrinterOption *option;
......@@ -2088,8 +2092,8 @@ set_conflicts_from_group (GtkPrinterOptionSet *set,
}
static gboolean
cups_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options)
cups_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options)
{
ppd_file_t *ppd_file;
int num_conflicts;
......
......@@ -77,12 +77,13 @@ static void file_printer_prepare_for_print (GtkPrinter
GtkPrintJob *print_job,
GtkPrintSettings *settings,
GtkPageSetup *page_setup);
static void gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
static void gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GDestroyNotify dnotify,
GError **error);
static cairo_surface_t * file_printer_create_cairo_surface (GtkPrinter *printer,
GtkPrintSettings *settings,
gdouble width,
......@@ -293,19 +294,20 @@ file_write (GIOChannel *source,
static void
gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify)
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify,
GError **error)
{
GError *error;
GError *internal_error = NULL;
GtkPrinter *printer;
_PrintStreamData *ps;
GtkPrintSettings *settings;
GIOChannel *save_channel;
const gchar *uri;
gchar *filename = NULL; /* quit gcc */
gchar *filename = NULL;
printer = gtk_print_job_get_printer (job);
settings = gtk_print_job_get_settings (job);
......@@ -333,12 +335,13 @@ gtk_print_backend_file_print_stream (GtkPrintBackend *print_backend,
if (ps->target_fd == -1)
{
error = g_error_new (GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
g_strerror (errno));
file_print_cb (GTK_PRINT_BACKEND_FILE (print_backend), error, ps);
internal_error = g_error_new (GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
g_strerror (errno));
file_print_cb (GTK_PRINT_BACKEND_FILE (print_backend),
internal_error, ps);
g_propagate_error (error, internal_error);
return;
}
......
......@@ -83,7 +83,8 @@ static void gtk_print_backend_lpr_print_stream (GtkPrintBacke
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GDestroyNotify dnotify,
GError **error);
static void
gtk_print_backend_lpr_register_type (GTypeModule *module)
......@@ -243,8 +244,9 @@ lpr_print_cb (GtkPrintBackendLpr *print_backend,
if (ps->dnotify)
ps->dnotify (ps->user_data);
gtk_print_job_set_status (ps->job,
(error != NULL)?GTK_PRINT_STATUS_FINISHED_ABORTED:GTK_PRINT_STATUS_FINISHED);
gtk_print_job_set_status (ps->job,
error ? GTK_PRINT_STATUS_FINISHED_ABORTED
: GTK_PRINT_STATUS_FINISHED);
if (ps->job)
g_object_unref (ps->job);
......@@ -289,7 +291,11 @@ lpr_write (GIOChannel *source,
if (bytes_read == 0 || error != NULL)
{
lpr_print_cb (GTK_PRINT_BACKEND_LPR (ps->backend), error, user_data);
lpr_print_cb (GTK_PRINT_BACKEND_LPR (ps->backend),
error, user_data);
if (error)
g_error_free (error);
return FALSE;
}
......@@ -305,22 +311,21 @@ gtk_print_backend_lpr_print_stream (GtkPrintBackend *print_backend,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify)
GDestroyNotify dnotify,
GError **error)
{
GError *error;
GError *print_error = NULL;
GtkPrinter *printer;
_PrintStreamData *ps;
GtkPrintSettings *settings;
GIOChannel *send_channel;
gint argc;
gchar **argv;
const char *cmd_line;
const gchar *cmd_line;
printer = gtk_print_job_get_printer (job);
settings = gtk_print_job_get_settings (job);
error = NULL;
cmd_line = gtk_print_settings_get (settings, "lpr-commandline");
if (cmd_line == NULL)
cmd_line = LPR_COMMAND;
......@@ -335,13 +340,11 @@ gtk_print_backend_lpr_print_stream (GtkPrintBackend *print_backend,
ps->err = 0;
/* spawn lpr with pipes and pipe ps file to lpr */
if (!g_shell_parse_argv (cmd_line,
&argc,
&argv,
&error))
if (!g_shell_parse_argv (cmd_line, &argc, &argv, &print_error))
{
lpr_print_cb (GTK_PRINT_BACKEND_LPR (print_backend),
error, ps);
lpr_print_cb (GTK_PRINT_BACKEND_LPR (print_backend),
print_error, ps);
g_propagate_error (error, print_error);
return;
}
......@@ -355,11 +358,11 @@ gtk_print_backend_lpr_print_stream (GtkPrintBackend *print_backend,
&ps->in,
&ps->out,
&ps->err,
&error))
&print_error))
{
lpr_print_cb (GTK_PRINT_BACKEND_LPR (print_backend),
error, ps);
lpr_print_cb (GTK_PRINT_BACKEND_LPR (print_backend),
print_error, ps);
g_propagate_error (error, print_error);
goto out;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment