Commit 061f2528 authored by Christian Persch's avatar Christian Persch Committed by Christian Persch

Use a priv variable when accessing priv multiple times in the same

2006-05-02  Christian Persch  <chpe@cvs.gnome.org>

	* gtk/gtkpagesetupunixdialog.c:
	* gtk/gtkprintcontext.c:
	* gtk/gtkprinter.c:
	* gtk/gtkprinteroptionwidget.c:
	* gtk/gtkprintjob.c:
	* gtk/gtkprintoperation-unix.c:
	* gtk/gtkprintoperation.c:
	* gtk/gtkprintunixdialog.c: Use a priv variable when accessing priv
	  multiple times in the same function. Bug #340288.
parent 5d6f77b4
2006-05-02 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkpagesetupunixdialog.c:
* gtk/gtkprintcontext.c:
* gtk/gtkprinter.c:
* gtk/gtkprinteroptionwidget.c:
* gtk/gtkprintjob.c:
* gtk/gtkprintoperation-unix.c:
* gtk/gtkprintoperation.c:
* gtk/gtkprintunixdialog.c: Use a priv variable when accessing priv
multiple times in the same function. Bug #340288.
2006-05-02 Michael Natterer <mitch@imendio.com> 2006-05-02 Michael Natterer <mitch@imendio.com>
* gtk/gtklabel.c (gtk_label_set_line_wrap): added note about the * gtk/gtklabel.c (gtk_label_set_line_wrap): added note about the
......
2006-05-02 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkpagesetupunixdialog.c:
* gtk/gtkprintcontext.c:
* gtk/gtkprinter.c:
* gtk/gtkprinteroptionwidget.c:
* gtk/gtkprintjob.c:
* gtk/gtkprintoperation-unix.c:
* gtk/gtkprintoperation.c:
* gtk/gtkprintunixdialog.c: Use a priv variable when accessing priv
multiple times in the same function. Bug #340288.
2006-05-02 Michael Natterer <mitch@imendio.com> 2006-05-02 Michael Natterer <mitch@imendio.com>
* gtk/gtklabel.c (gtk_label_set_line_wrap): added note about the * gtk/gtklabel.c (gtk_label_set_line_wrap): added note about the
......
This diff is collapsed.
...@@ -83,14 +83,15 @@ gtk_print_context_class_init (GtkPrintContextClass *class) ...@@ -83,14 +83,15 @@ gtk_print_context_class_init (GtkPrintContextClass *class)
GtkPrintContext * GtkPrintContext *
_gtk_print_context_new (GtkPrintOperation *op) _gtk_print_context_new (GtkPrintOperation *op)
{ {
GtkPrintOperationPrivate *priv = op->priv;
GtkPrintContext *context; GtkPrintContext *context;
context = g_object_new (GTK_TYPE_PRINT_CONTEXT, NULL); context = g_object_new (GTK_TYPE_PRINT_CONTEXT, NULL);
context->op = op; context->op = op;
context->cr = cairo_create (op->priv->surface); context->cr = cairo_create (priv->surface);
switch (op->priv->unit) switch (priv->unit)
{ {
default: default:
case GTK_UNIT_PIXEL: case GTK_UNIT_PIXEL:
...@@ -99,16 +100,16 @@ _gtk_print_context_new (GtkPrintOperation *op) ...@@ -99,16 +100,16 @@ _gtk_print_context_new (GtkPrintOperation *op)
context->pixels_per_unit_y = 1.0; context->pixels_per_unit_y = 1.0;
break; break;
case GTK_UNIT_POINTS: case GTK_UNIT_POINTS:
context->pixels_per_unit_x = op->priv->dpi_x / POINTS_PER_INCH; context->pixels_per_unit_x = priv->dpi_x / POINTS_PER_INCH;
context->pixels_per_unit_y = op->priv->dpi_y / POINTS_PER_INCH; context->pixels_per_unit_y = priv->dpi_y / POINTS_PER_INCH;
break; break;
case GTK_UNIT_INCH: case GTK_UNIT_INCH:
context->pixels_per_unit_x = op->priv->dpi_x; context->pixels_per_unit_x = priv->dpi_x;
context->pixels_per_unit_y = op->priv->dpi_y; context->pixels_per_unit_y = priv->dpi_y;
break; break;
case GTK_UNIT_MM: case GTK_UNIT_MM:
context->pixels_per_unit_x = op->priv->dpi_x / MM_PER_INCH; context->pixels_per_unit_x = priv->dpi_x / MM_PER_INCH;
context->pixels_per_unit_y = op->priv->dpi_y / MM_PER_INCH; context->pixels_per_unit_y = priv->dpi_y / MM_PER_INCH;
break; break;
} }
cairo_scale (context->cr, cairo_scale (context->cr,
...@@ -118,7 +119,7 @@ _gtk_print_context_new (GtkPrintOperation *op) ...@@ -118,7 +119,7 @@ _gtk_print_context_new (GtkPrintOperation *op)
context->fontmap = pango_cairo_font_map_new (); context->fontmap = pango_cairo_font_map_new ();
/* We use the unit-scaled resolution, as we still want fonts given in points to work */ /* We use the unit-scaled resolution, as we still want fonts given in points to work */
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (context->fontmap), pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (context->fontmap),
op->priv->dpi_y / context->pixels_per_unit_y); priv->dpi_y / context->pixels_per_unit_y);
return context; return context;
} }
...@@ -126,6 +127,7 @@ _gtk_print_context_new (GtkPrintOperation *op) ...@@ -126,6 +127,7 @@ _gtk_print_context_new (GtkPrintOperation *op)
void void
_gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context) _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
{ {
GtkPrintOperationPrivate *priv = context->op->priv;
cairo_t *cr = context->cr; cairo_t *cr = context->cr;
cairo_matrix_t matrix; cairo_matrix_t matrix;
GtkPaperSize *paper_size; GtkPaperSize *paper_size;
...@@ -134,9 +136,9 @@ _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context) ...@@ -134,9 +136,9 @@ _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
paper_size = gtk_page_setup_get_paper_size (context->page_setup); paper_size = gtk_page_setup_get_paper_size (context->page_setup);
width = gtk_paper_size_get_width (paper_size, GTK_UNIT_INCH); width = gtk_paper_size_get_width (paper_size, GTK_UNIT_INCH);
width = width * context->op->priv->dpi_x / context->pixels_per_unit_x; width = width * priv->dpi_x / context->pixels_per_unit_x;
height = gtk_paper_size_get_height (paper_size, GTK_UNIT_INCH); height = gtk_paper_size_get_height (paper_size, GTK_UNIT_INCH);
height = height * context->op->priv->dpi_y / context->pixels_per_unit_y; height = height * priv->dpi_y / context->pixels_per_unit_y;
switch (gtk_page_setup_get_orientation (context->page_setup)) switch (gtk_page_setup_get_orientation (context->page_setup))
{ {
...@@ -173,18 +175,21 @@ _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context) ...@@ -173,18 +175,21 @@ _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
void void
_gtk_print_context_translate_into_margin (GtkPrintContext *context) _gtk_print_context_translate_into_margin (GtkPrintContext *context)
{ {
GtkPrintOperationPrivate *priv;
gdouble left, top; gdouble left, top;
g_return_if_fail (GTK_IS_PRINT_CONTEXT (context)); g_return_if_fail (GTK_IS_PRINT_CONTEXT (context));
priv = context->op->priv;
/* We do it this way to also handle GTK_UNIT_PIXELS */ /* We do it this way to also handle GTK_UNIT_PIXELS */
left = gtk_page_setup_get_left_margin (context->page_setup, GTK_UNIT_INCH); left = gtk_page_setup_get_left_margin (context->page_setup, GTK_UNIT_INCH);
top = gtk_page_setup_get_top_margin (context->page_setup, GTK_UNIT_INCH); top = gtk_page_setup_get_top_margin (context->page_setup, GTK_UNIT_INCH);
cairo_translate (context->cr, cairo_translate (context->cr,
left * context->op->priv->dpi_x / context->pixels_per_unit_x, left * priv->dpi_x / context->pixels_per_unit_x,
top * context->op->priv->dpi_y / context->pixels_per_unit_y); top * priv->dpi_y / context->pixels_per_unit_y);
} }
void void
...@@ -254,17 +259,20 @@ gtk_print_context_get_page_setup (GtkPrintContext *context) ...@@ -254,17 +259,20 @@ gtk_print_context_get_page_setup (GtkPrintContext *context)
gdouble gdouble
gtk_print_context_get_width (GtkPrintContext *context) gtk_print_context_get_width (GtkPrintContext *context)
{ {
GtkPrintOperationPrivate *priv;
gdouble width; gdouble width;
g_return_val_if_fail (GTK_IS_PRINT_CONTEXT (context), 0); g_return_val_if_fail (GTK_IS_PRINT_CONTEXT (context), 0);
if (context->op->priv->use_full_page) priv = context->op->priv;
if (priv->use_full_page)
width = gtk_page_setup_get_paper_width (context->page_setup, GTK_UNIT_INCH); width = gtk_page_setup_get_paper_width (context->page_setup, GTK_UNIT_INCH);
else else
width = gtk_page_setup_get_page_width (context->page_setup, GTK_UNIT_INCH); width = gtk_page_setup_get_page_width (context->page_setup, GTK_UNIT_INCH);
/* Really dpi_x? What about landscape? what does dpi_x mean in that case? */ /* Really dpi_x? What about landscape? what does dpi_x mean in that case? */
return width * context->op->priv->dpi_x / context->pixels_per_unit_x; return width * priv->dpi_x / context->pixels_per_unit_x;
} }
/** /**
...@@ -280,17 +288,20 @@ gtk_print_context_get_width (GtkPrintContext *context) ...@@ -280,17 +288,20 @@ gtk_print_context_get_width (GtkPrintContext *context)
gdouble gdouble
gtk_print_context_get_height (GtkPrintContext *context) gtk_print_context_get_height (GtkPrintContext *context)
{ {
GtkPrintOperationPrivate *priv;
gdouble height; gdouble height;
g_return_val_if_fail (GTK_IS_PRINT_CONTEXT (context), 0); g_return_val_if_fail (GTK_IS_PRINT_CONTEXT (context), 0);
if (context->op->priv->use_full_page) priv = context->op->priv;
if (priv->use_full_page)
height = gtk_page_setup_get_paper_height (context->page_setup, GTK_UNIT_INCH); height = gtk_page_setup_get_paper_height (context->page_setup, GTK_UNIT_INCH);
else else
height = gtk_page_setup_get_page_height (context->page_setup, GTK_UNIT_INCH); height = gtk_page_setup_get_page_height (context->page_setup, GTK_UNIT_INCH);
/* Really dpi_x? What about landscape? what does dpi_x mean in that case? */ /* Really dpi_x? What about landscape? what does dpi_x mean in that case? */
return height * context->op->priv->dpi_y / context->pixels_per_unit_y; return height * priv->dpi_y / context->pixels_per_unit_y;
} }
/** /**
......
...@@ -186,36 +186,36 @@ gtk_printer_class_init (GtkPrinterClass *class) ...@@ -186,36 +186,36 @@ gtk_printer_class_init (GtkPrinterClass *class)
static void static void
gtk_printer_init (GtkPrinter *printer) gtk_printer_init (GtkPrinter *printer)
{ {
printer->priv = GTK_PRINTER_GET_PRIVATE (printer); GtkPrinterPrivate *priv;
printer->priv->name = NULL; priv = printer->priv = GTK_PRINTER_GET_PRIVATE (printer);
printer->priv->location = NULL;
printer->priv->description = NULL;
printer->priv->icon_name = NULL;
printer->priv->is_active = TRUE; priv->name = NULL;
printer->priv->is_new = TRUE; priv->location = NULL;
printer->priv->has_details = FALSE; priv->description = NULL;
priv->icon_name = NULL;
printer->priv->state_message = NULL; priv->is_active = TRUE;
printer->priv->job_count = 0; priv->is_new = TRUE;
priv->has_details = FALSE;
priv->state_message = NULL;
priv->job_count = 0;
} }
static void static void
gtk_printer_finalize (GObject *object) gtk_printer_finalize (GObject *object)
{ {
g_return_if_fail (object != NULL);
GtkPrinter *printer = GTK_PRINTER (object); GtkPrinter *printer = GTK_PRINTER (object);
GtkPrinterPrivate *priv = printer->priv;
g_free (printer->priv->name); g_free (priv->name);
g_free (printer->priv->location); g_free (priv->location);
g_free (printer->priv->description); g_free (priv->description);
g_free (printer->priv->state_message); g_free (priv->state_message);
g_free (printer->priv->icon_name); g_free (priv->icon_name);
if (G_OBJECT_CLASS (gtk_printer_parent_class)->finalize) G_OBJECT_CLASS (gtk_printer_parent_class)->finalize (object);
G_OBJECT_CLASS (gtk_printer_parent_class)->finalize (object);
} }
static void static void
...@@ -225,19 +225,20 @@ gtk_printer_set_property (GObject *object, ...@@ -225,19 +225,20 @@ gtk_printer_set_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GtkPrinter *printer = GTK_PRINTER (object); GtkPrinter *printer = GTK_PRINTER (object);
GtkPrinterPrivate *priv = printer->priv;
switch (prop_id) switch (prop_id)
{ {
case PROP_NAME: case PROP_NAME:
printer->priv->name = g_value_dup_string (value); priv->name = g_value_dup_string (value);
break; break;
case PROP_BACKEND: case PROP_BACKEND:
printer->priv->backend = GTK_PRINT_BACKEND (g_value_get_object (value)); priv->backend = GTK_PRINT_BACKEND (g_value_get_object (value));
break; break;
case PROP_IS_VIRTUAL: case PROP_IS_VIRTUAL:
printer->priv->is_virtual = g_value_get_boolean (value); priv->is_virtual = g_value_get_boolean (value);
break; break;
default: default:
...@@ -253,38 +254,39 @@ gtk_printer_get_property (GObject *object, ...@@ -253,38 +254,39 @@ gtk_printer_get_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GtkPrinter *printer = GTK_PRINTER (object); GtkPrinter *printer = GTK_PRINTER (object);
GtkPrinterPrivate *priv = printer->priv;
switch (prop_id) switch (prop_id)
{ {
case PROP_NAME: case PROP_NAME:
if (printer->priv->name) if (priv->name)
g_value_set_string (value, printer->priv->name); g_value_set_string (value, priv->name);
else else
g_value_set_string (value, ""); g_value_set_string (value, "");
break; break;
case PROP_BACKEND: case PROP_BACKEND:
g_value_set_object (value, printer->priv->backend); g_value_set_object (value, priv->backend);
break; break;
case PROP_STATE_MESSAGE: case PROP_STATE_MESSAGE:
if (printer->priv->state_message) if (priv->state_message)
g_value_set_string (value, printer->priv->state_message); g_value_set_string (value, priv->state_message);
else else
g_value_set_string (value, ""); g_value_set_string (value, "");
break; break;
case PROP_LOCATION: case PROP_LOCATION:
if (printer->priv->location) if (priv->location)
g_value_set_string (value, printer->priv->location); g_value_set_string (value, priv->location);
else else
g_value_set_string (value, ""); g_value_set_string (value, "");
break; break;
case PROP_ICON_NAME: case PROP_ICON_NAME:
if (printer->priv->icon_name) if (priv->icon_name)
g_value_set_string (value, printer->priv->icon_name); g_value_set_string (value, priv->icon_name);
else else
g_value_set_string (value, ""); g_value_set_string (value, "");
break; break;
case PROP_JOB_COUNT: case PROP_JOB_COUNT:
g_value_set_int (value, printer->priv->job_count); g_value_set_int (value, priv->job_count);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
...@@ -388,13 +390,17 @@ gboolean ...@@ -388,13 +390,17 @@ gboolean
gtk_printer_set_description (GtkPrinter *printer, gtk_printer_set_description (GtkPrinter *printer,
const gchar *description) const gchar *description)
{ {
GtkPrinterPrivate *priv;
g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE);
if (safe_strcmp (printer->priv->description, description) == 0) priv = printer->priv;
if (safe_strcmp (priv->description, description) == 0)
return FALSE; return FALSE;
g_free (printer->priv->description); g_free (priv->description);
printer->priv->description = g_strdup (description); priv->description = g_strdup (description);
return TRUE; return TRUE;
} }
...@@ -422,13 +428,17 @@ gboolean ...@@ -422,13 +428,17 @@ gboolean
gtk_printer_set_state_message (GtkPrinter *printer, gtk_printer_set_state_message (GtkPrinter *printer,
const gchar *message) const gchar *message)
{ {
GtkPrinterPrivate *priv;
g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE);
if (safe_strcmp (printer->priv->state_message, message) == 0) priv = printer->priv;
if (safe_strcmp (priv->state_message, message) == 0)
return FALSE; return FALSE;
g_free (printer->priv->state_message); g_free (priv->state_message);
printer->priv->state_message = g_strdup (message); priv->state_message = g_strdup (message);
g_object_notify (G_OBJECT (printer), "state-message"); g_object_notify (G_OBJECT (printer), "state-message");
return TRUE; return TRUE;
...@@ -456,13 +466,17 @@ gboolean ...@@ -456,13 +466,17 @@ gboolean
gtk_printer_set_location (GtkPrinter *printer, gtk_printer_set_location (GtkPrinter *printer,
const gchar *location) const gchar *location)
{ {
GtkPrinterPrivate *priv;
g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE);
if (safe_strcmp (printer->priv->location, location) == 0) priv = printer->priv;
if (safe_strcmp (priv->location, location) == 0)
return FALSE; return FALSE;
g_free (printer->priv->location); g_free (priv->location);
printer->priv->location = g_strdup (location); priv->location = g_strdup (location);
g_object_notify (G_OBJECT (printer), "location"); g_object_notify (G_OBJECT (printer), "location");
return TRUE; return TRUE;
...@@ -490,10 +504,14 @@ void ...@@ -490,10 +504,14 @@ void
gtk_printer_set_icon_name (GtkPrinter *printer, gtk_printer_set_icon_name (GtkPrinter *printer,
const gchar *icon) const gchar *icon)
{ {
GtkPrinterPrivate *priv;
g_return_if_fail (GTK_IS_PRINTER (printer)); g_return_if_fail (GTK_IS_PRINTER (printer));
g_free (printer->priv->icon_name); priv = printer->priv;
printer->priv->icon_name = g_strdup (icon);
g_free (priv->icon_name);
priv->icon_name = g_strdup (icon);
g_object_notify (G_OBJECT (printer), "icon-name"); g_object_notify (G_OBJECT (printer), "icon-name");
} }
...@@ -519,12 +537,16 @@ gboolean ...@@ -519,12 +537,16 @@ gboolean
gtk_printer_set_job_count (GtkPrinter *printer, gtk_printer_set_job_count (GtkPrinter *printer,
gint count) gint count)
{ {
GtkPrinterPrivate *priv;
g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE);
if (printer->priv->job_count == count) priv = printer->priv;
if (priv->job_count == count)
return FALSE; return FALSE;
printer->priv->job_count = count; priv->job_count = count;
g_object_notify (G_OBJECT (printer), "job-count"); g_object_notify (G_OBJECT (printer), "job-count");
......
This diff is collapsed.
...@@ -165,18 +165,21 @@ gtk_print_job_class_init (GtkPrintJobClass *class) ...@@ -165,18 +165,21 @@ gtk_print_job_class_init (GtkPrintJobClass *class)
static void static void
gtk_print_job_init (GtkPrintJob *job) gtk_print_job_init (GtkPrintJob *job)
{ {
job->priv = GTK_PRINT_JOB_GET_PRIVATE (job); GtkPrintJobPrivate *priv;
job->priv->spool_file_fd = -1;
job->priv->title = g_strdup (""); priv = job->priv = GTK_PRINT_JOB_GET_PRIVATE (job);
job->priv->surface = NULL;
job->priv->backend = NULL;
job->priv->printer = NULL;
job->priv->printer_set = FALSE; priv->spool_file_fd = -1;
job->priv->settings_set = FALSE;
job->priv->page_setup_set = FALSE; priv->title = g_strdup ("");
job->priv->status = GTK_PRINT_STATUS_INITIAL; priv->surface = NULL;
priv->backend = NULL;
priv->printer = NULL;
priv->printer_set = FALSE;
priv->settings_set = FALSE;
priv->page_setup_set = FALSE;
priv->status = GTK_PRINT_STATUS_INITIAL;
job->print_pages = GTK_PRINT_PAGES_ALL; job->print_pages = GTK_PRINT_PAGES_ALL;
job->page_ranges = NULL; job->page_ranges = NULL;
...@@ -196,6 +199,7 @@ gtk_print_job_constructor (GType type, ...@@ -196,6 +199,7 @@ gtk_print_job_constructor (GType type,
GObjectConstructParam *construct_params) GObjectConstructParam *construct_params)
{ {
GtkPrintJob *job; GtkPrintJob *job;
GtkPrintJobPrivate *priv;
GObject *object; GObject *object;
object = object =
...@@ -204,15 +208,16 @@ gtk_print_job_constructor (GType type, ...@@ -204,15 +208,16 @@ gtk_print_job_constructor (GType type,
construct_params); construct_params);
job = GTK_PRINT_JOB (object); job = GTK_PRINT_JOB (object);
priv = job->priv;
g_assert (priv->printer_set &&
priv->settings_set &&
priv->page_setup_set);
g_assert (job->priv->printer_set && _gtk_printer_prepare_for_print (priv->printer,
job->priv->settings_set &&
job->priv->page_setup_set);
_gtk_printer_prepare_for_print (job->priv->printer,
job, job,
job->priv->settings, priv->settings,
job->priv->page_setup); priv->page_setup);
return object; return object;
} }
...@@ -221,41 +226,37 @@ gtk_print_job_constructor (GType type, ...@@ -221,41 +226,37 @@ gtk_print_job_constructor (GType type,
static void static void
gtk_print_job_finalize (GObject *object) gtk_print_job_finalize (GObject *object)
{ {
GtkPrintJob *job; GtkPrintJob *job = GTK_PRINT_JOB (object);
GtkPrintJobPrivate *priv = job->priv;
g_return_if_fail (object != NULL);
job = GTK_PRINT_JOB (object);
if (job->priv->spool_file_fd > 0) if (priv->spool_file_fd >= 0)
{ {
close (job->priv->spool_file_fd); close (priv->spool_file_fd);
job->priv->spool_file_fd = -1; priv->spool_file_fd = -1;
} }
if (job->priv->backend) if (priv->backend)
g_object_unref (G_OBJECT (job->priv->backend)); g_object_unref (priv->backend);
if (job->priv->printer) if (priv->printer)
g_object_unref (G_OBJECT (job->priv->printer)); g_object_unref (priv->printer);
if (job->priv->surface) if (priv->surface)
cairo_surface_destroy (job->priv->surface); cairo_surface_destroy (priv->surface);
if (job->priv->settings) if (priv->settings)
g_object_unref (job->priv->settings); g_object_unref (priv->settings);
if (job->priv->page_setup) if (priv->page_setup)
g_object_unref (job->priv->page_setup); g_object_unref (priv->page_setup);
g_free (job->page_ranges); g_free (job->page_ranges);
job->page_ranges = NULL; job->page_ranges = NULL;
g_free (job->priv->title); g_free (priv->title);
job->priv->title = NULL; priv->title = NULL;
if (G_OBJECT_CLASS (gtk_print_job_parent_class)->finalize) G_OBJECT_CLASS (gtk_print_job_parent_class)->finalize (object);
G_OBJECT_CLASS (gtk_print_job_parent_class)->finalize (object);
} }
/** /**
...@@ -363,12 +364,16 @@ void ...@@ -363,12 +364,16 @@ void
gtk_print_job_set_status (GtkPrintJob *job, gtk_print_job_set_status (GtkPrintJob *job,
GtkPrintStatus status) GtkPrintStatus status)
{ {
GtkPrintJobPrivate *priv;
g_return_if_fail (GTK_IS_PRINT_JOB (job)); g_return_if_fail (GTK_IS_PRINT_JOB (job));
if (job->priv->status == status) priv = job->priv;
if (priv->status == status)
return; return;
job->priv->status = status; priv->status = status;
g_signal_emit (job, signals[STATUS_CHANGED], 0); g_signal_emit (job, signals[STATUS_CHANGED], 0);
} }
...@@ -392,10 +397,14 @@ gtk_print_job_set_source_file (GtkPrintJob *job, ...@@ -392,10 +397,14 @@ gtk_print_job_set_source_file (GtkPrintJob *job,
const gchar *filename, const gchar *filename,
GError **error) GError **error)
{ {
GtkPrintJobPrivate *priv;
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), FALSE); g_return_val_if_fail (GTK_IS_PRINT_JOB (job), FALSE);
job->priv->spool_file_fd = g_open (filename, O_RDONLY|O_BINARY); priv = job->priv;
if (job->priv->spool_file_fd < 0)
priv->spool_file_fd = g_open (filename, O_RDONLY|O_BINARY);
if (priv->spool_file_fd < 0)
{ {
gchar *display_filename = g_filename_display_name (filename); gchar *display_filename = g_filename_display_name (filename);
int save_errno = errno; int save_errno = errno;
...@@ -430,33 +439,38 @@ cairo_surface_t * ...@@ -430,33 +439,38 @@ cairo_surface_t *