Commit 67dc5155 authored by Matthias Clasen's avatar Matthias Clasen

Add a GtkPrintOperation::show-preview property

parent ab882a28
2006-06-02 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperation-private.h:
* gtk/gtkprintoperation.h:
* gtk/gtkprintoperation.c: Add a show-preview property.
* gtk/gtkprintoperation-unix.c: Implement it here.
* gtk/gtkprintoperation-unix.c: Cleanups
......
2006-06-02 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperation-private.h:
* gtk/gtkprintoperation.h:
* gtk/gtkprintoperation.c: Add a show-preview property.
* gtk/gtkprintoperation-unix.c: Implement it here.
* gtk/gtkprintoperation-unix.c: Cleanups
......
......@@ -38,6 +38,7 @@ struct _GtkPrintOperationPrivate
gchar *pdf_target;
guint use_full_page : 1;
guint show_dialog : 1;
guint show_preview : 1;
guint track_print_status : 1;
guint show_progress : 1;
guint cancelled : 1;
......
......@@ -504,7 +504,10 @@ found_printer (GtkPrinter *printer,
if (printer != NULL)
{
rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY;
if (priv->show_preview)
rdata->result = GTK_PRINT_OPERATION_RESULT_PREVIEW;
else
rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY;
rdata->do_print = TRUE;
......@@ -835,8 +838,11 @@ printer_added_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
PrinterFinder *finder)
{
if (gtk_printer_is_virtual (printer) ||
finder->found_printer)
if (finder->found_printer)
return;
/* FIXME this skips "Print to PDF" - is this intentional ? */
if (gtk_printer_is_virtual (printer))
return;
if (finder->printer_name != NULL &&
......
......@@ -60,6 +60,7 @@ enum {
PROP_TRACK_PRINT_STATUS,
PROP_UNIT,
PROP_SHOW_DIALOG,
PROP_SHOW_PREVIEW,
PROP_SHOW_PROGRESS,
PROP_PDF_TARGET,
PROP_STATUS,
......@@ -146,6 +147,7 @@ gtk_print_operation_init (GtkPrintOperation *operation)
priv->current_page = -1;
priv->use_full_page = FALSE;
priv->show_dialog = TRUE;
priv->show_preview = FALSE;
priv->show_progress = FALSE;
priv->pdf_target = NULL;
priv->track_print_status = FALSE;
......@@ -283,6 +285,9 @@ gtk_print_operation_set_property (GObject *object,
case PROP_SHOW_DIALOG:
gtk_print_operation_set_show_dialog (op, g_value_get_boolean (value));
break;
case PROP_SHOW_PREVIEW:
gtk_print_operation_set_show_preview (op, g_value_get_boolean (value));
break;
case PROP_SHOW_PROGRESS:
gtk_print_operation_set_show_progress (op, g_value_get_boolean (value));
break;
......@@ -336,6 +341,9 @@ gtk_print_operation_get_property (GObject *object,
case PROP_SHOW_DIALOG:
g_value_set_boolean (value, priv->show_dialog);
break;
case PROP_SHOW_PREVIEW:
g_value_set_boolean (value, priv->show_preview);
break;
case PROP_SHOW_PROGRESS:
g_value_set_boolean (value, priv->show_progress);
break;
......@@ -988,8 +996,23 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
P_("TRUE if gtk_print_operation_run() should show the print dialog."),
TRUE,
GTK_PARAM_READWRITE));
/**
* GtkPrintOperation:show-preview:
*
* Determines whether calling gtk_print_operation_run() will present
* the print preview to the user.
*
* Since: 2.10
*/
g_object_class_install_property (gobject_class,
PROP_SHOW_PREVIEW,
g_param_spec_boolean ("show-preview",
P_("Show Preview"),
P_("TRUE if gtk_print_operation_run() should show the print preview."),
TRUE,
GTK_PARAM_READWRITE));
/**
* GtkPrintOperation:show-progress:
*
......@@ -1573,6 +1596,35 @@ gtk_print_operation_set_show_dialog (GtkPrintOperation *op,
}
}
/**
* gtk_print_operation_set_show_preview:
* @op: a #GtkPrintOperation
* @show_preview: %TRUE to show the print preview
*
* Sets whether calling gtk_print_operation_run() will present
* the print preview to the user.
*
* Since: 2.10
*/
void
gtk_print_operation_set_show_preview (GtkPrintOperation *op,
gboolean show_preview)
{
GtkPrintOperationPrivate *priv;
g_return_if_fail (GTK_IS_PRINT_OPERATION (op));
priv = op->priv;
show_preview = show_preview != FALSE;
if (priv->show_preview != show_preview)
{
priv->show_preview = show_preview;
g_object_notify (G_OBJECT (op), "show-preview");
}
}
/**
* gtk_print_operation_set_show_progress:
......
......@@ -140,6 +140,8 @@ void gtk_print_operation_set_unit (GtkPrintOper
GtkUnit unit);
void gtk_print_operation_set_show_dialog (GtkPrintOperation *op,
gboolean show_dialog);
void gtk_print_operation_set_show_preview (GtkPrintOperation *op,
gboolean show_preview);
void gtk_print_operation_set_pdf_target (GtkPrintOperation *op,
const gchar *filename);
void gtk_print_operation_set_track_print_status (GtkPrintOperation *op,
......@@ -151,6 +153,8 @@ void gtk_print_operation_set_custom_tab_label (GtkPrintOper
GtkPrintOperationResult gtk_print_operation_run (GtkPrintOperation *op,
GtkWindow *parent,
GError **error);
void gtk_print_operation_run_preview (GtkPrintOperation *op,
GtkWindow *parent);
GtkPrintStatus gtk_print_operation_get_status (GtkPrintOperation *op);
G_CONST_RETURN gchar * gtk_print_operation_get_status_string (GtkPrintOperation *op);
gboolean gtk_print_operation_is_finished (GtkPrintOperation *op);
......
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