Use gtk_printer_accepts_ps here.
2006-06-12 Matthias Clasen <mclasen@redhat.com> * gtk/gtkprintunixdialog.c (is_printer_active): Use gtk_printer_accepts_ps here. * modules/printbackends/pdf/gtkprintbackendpdf.c (gtk_print_backend_pdf_init): Mark the virtual "Print to PDF" printer as not accepting PS. * gtk/gtk.symbols: * gtk/gtkprinter.h: * gtk/gtkprinter.c: Add two new properties accepts-pdf and accepts-ps (with getters) to allow learning supported formats.
This commit is contained in:
committed by
Matthias Clasen
parent
c6d1d9dd01
commit
809c8d565f
11
ChangeLog
11
ChangeLog
@ -1,5 +1,16 @@
|
|||||||
2006-06-12 Matthias Clasen <mclasen@redhat.com>
|
2006-06-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkprintunixdialog.c (is_printer_active): Use
|
||||||
|
gtk_printer_accepts_ps here.
|
||||||
|
|
||||||
|
* modules/printbackends/pdf/gtkprintbackendpdf.c (gtk_print_backend_pdf_init):
|
||||||
|
Mark the virtual "Print to PDF" printer as not accepting PS.
|
||||||
|
|
||||||
|
* gtk/gtk.symbols:
|
||||||
|
* gtk/gtkprinter.h:
|
||||||
|
* gtk/gtkprinter.c: Add two new properties accepts-pdf and
|
||||||
|
accepts-ps (with getters) to allow learning supported formats.
|
||||||
|
|
||||||
* gtk/gtkprintjob.h: Add a GTK_PRINT_CAPABILITY_GENERATE_PDF
|
* gtk/gtkprintjob.h: Add a GTK_PRINT_CAPABILITY_GENERATE_PDF
|
||||||
capability.
|
capability.
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,16 @@
|
|||||||
2006-06-12 Matthias Clasen <mclasen@redhat.com>
|
2006-06-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkprintunixdialog.c (is_printer_active): Use
|
||||||
|
gtk_printer_accepts_ps here.
|
||||||
|
|
||||||
|
* modules/printbackends/pdf/gtkprintbackendpdf.c (gtk_print_backend_pdf_init):
|
||||||
|
Mark the virtual "Print to PDF" printer as not accepting PS.
|
||||||
|
|
||||||
|
* gtk/gtk.symbols:
|
||||||
|
* gtk/gtkprinter.h:
|
||||||
|
* gtk/gtkprinter.c: Add two new properties accepts-pdf and
|
||||||
|
accepts-ps (with getters) to allow learning supported formats.
|
||||||
|
|
||||||
* gtk/gtkprintjob.h: Add a GTK_PRINT_CAPABILITY_GENERATE_PDF
|
* gtk/gtkprintjob.h: Add a GTK_PRINT_CAPABILITY_GENERATE_PDF
|
||||||
capability.
|
capability.
|
||||||
|
|
||||||
|
|||||||
@ -2594,6 +2594,8 @@ gtk_printer_get_location
|
|||||||
gtk_printer_get_icon_name
|
gtk_printer_get_icon_name
|
||||||
gtk_printer_get_job_count
|
gtk_printer_get_job_count
|
||||||
gtk_printer_is_virtual
|
gtk_printer_is_virtual
|
||||||
|
gtk_printer_accepts_pdf
|
||||||
|
gtk_printer_accepts_ps
|
||||||
gtk_printer_compare
|
gtk_printer_compare
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -43,11 +43,13 @@ struct _GtkPrinterPrivate
|
|||||||
gchar *description;
|
gchar *description;
|
||||||
gchar *icon_name;
|
gchar *icon_name;
|
||||||
|
|
||||||
guint is_active: 1;
|
guint is_active : 1;
|
||||||
guint is_new: 1;
|
guint is_new : 1;
|
||||||
guint is_virtual : 1;
|
guint is_virtual : 1;
|
||||||
guint is_default : 1;
|
guint is_default : 1;
|
||||||
guint has_details: 1;
|
guint has_details : 1;
|
||||||
|
guint accepts_pdf : 1;
|
||||||
|
guint accepts_ps : 1;
|
||||||
|
|
||||||
gchar *state_message;
|
gchar *state_message;
|
||||||
gint job_count;
|
gint job_count;
|
||||||
@ -68,7 +70,9 @@ enum {
|
|||||||
PROP_STATE_MESSAGE,
|
PROP_STATE_MESSAGE,
|
||||||
PROP_LOCATION,
|
PROP_LOCATION,
|
||||||
PROP_ICON_NAME,
|
PROP_ICON_NAME,
|
||||||
PROP_JOB_COUNT
|
PROP_JOB_COUNT,
|
||||||
|
PROP_ACCEPTS_PDF,
|
||||||
|
PROP_ACCEPTS_PS
|
||||||
};
|
};
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
@ -130,6 +134,20 @@ gtk_printer_class_init (GtkPrinterClass *class)
|
|||||||
P_("FALSE if this represents a real hardware printer"),
|
P_("FALSE if this represents a real hardware printer"),
|
||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (class),
|
||||||
|
PROP_ACCEPTS_PDF,
|
||||||
|
g_param_spec_boolean ("accepts-pdf",
|
||||||
|
P_("Accepts PDF"),
|
||||||
|
P_("TRUE if this printer can accept PDF"),
|
||||||
|
TRUE,
|
||||||
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (class),
|
||||||
|
PROP_ACCEPTS_PS,
|
||||||
|
g_param_spec_boolean ("accepts-ps",
|
||||||
|
P_("Accepts PostScript"),
|
||||||
|
P_("TRUE if this printer can accept PostScript"),
|
||||||
|
TRUE,
|
||||||
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (class),
|
g_object_class_install_property (G_OBJECT_CLASS (class),
|
||||||
PROP_STATE_MESSAGE,
|
PROP_STATE_MESSAGE,
|
||||||
g_param_spec_string ("state-message",
|
g_param_spec_string ("state-message",
|
||||||
@ -197,6 +215,8 @@ gtk_printer_init (GtkPrinter *printer)
|
|||||||
priv->is_active = TRUE;
|
priv->is_active = TRUE;
|
||||||
priv->is_new = TRUE;
|
priv->is_new = TRUE;
|
||||||
priv->has_details = FALSE;
|
priv->has_details = FALSE;
|
||||||
|
priv->accepts_pdf = TRUE;
|
||||||
|
priv->accepts_ps = TRUE;
|
||||||
|
|
||||||
priv->state_message = NULL;
|
priv->state_message = NULL;
|
||||||
priv->job_count = 0;
|
priv->job_count = 0;
|
||||||
@ -243,6 +263,14 @@ gtk_printer_set_property (GObject *object,
|
|||||||
priv->is_virtual = g_value_get_boolean (value);
|
priv->is_virtual = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ACCEPTS_PDF:
|
||||||
|
priv->accepts_pdf = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_ACCEPTS_PS:
|
||||||
|
priv->accepts_ps = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -290,6 +318,15 @@ gtk_printer_get_property (GObject *object,
|
|||||||
case PROP_JOB_COUNT:
|
case PROP_JOB_COUNT:
|
||||||
g_value_set_int (value, priv->job_count);
|
g_value_set_int (value, priv->job_count);
|
||||||
break;
|
break;
|
||||||
|
case PROP_IS_VIRTUAL:
|
||||||
|
g_value_set_boolean (value, priv->is_virtual);
|
||||||
|
break;
|
||||||
|
case PROP_ACCEPTS_PDF:
|
||||||
|
g_value_set_boolean (value, priv->accepts_pdf);
|
||||||
|
break;
|
||||||
|
case PROP_ACCEPTS_PS:
|
||||||
|
g_value_set_boolean (value, priv->accepts_ps);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -607,6 +644,22 @@ gtk_printer_is_virtual (GtkPrinter *printer)
|
|||||||
return printer->priv->is_virtual;
|
return printer->priv->is_virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gtk_printer_accepts_pdf (GtkPrinter *printer)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_PRINTER (printer), TRUE);
|
||||||
|
|
||||||
|
return printer->priv->accepts_pdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gtk_printer_accepts_ps (GtkPrinter *printer)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_PRINTER (printer), TRUE);
|
||||||
|
|
||||||
|
return printer->priv->accepts_ps;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gtk_printer_is_new (GtkPrinter *printer)
|
gtk_printer_is_new (GtkPrinter *printer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -77,6 +77,8 @@ gint gtk_printer_get_job_count (GtkPrinter *printer
|
|||||||
gboolean gtk_printer_is_active (GtkPrinter *printer);
|
gboolean gtk_printer_is_active (GtkPrinter *printer);
|
||||||
gboolean gtk_printer_is_virtual (GtkPrinter *printer);
|
gboolean gtk_printer_is_virtual (GtkPrinter *printer);
|
||||||
gboolean gtk_printer_is_default (GtkPrinter *printer);
|
gboolean gtk_printer_is_default (GtkPrinter *printer);
|
||||||
|
gboolean gtk_printer_accepts_pdf (GtkPrinter *printer);
|
||||||
|
gboolean gtk_printer_accepts_ps (GtkPrinter *printer);
|
||||||
|
|
||||||
gint gtk_printer_compare (GtkPrinter *a,
|
gint gtk_printer_compare (GtkPrinter *a,
|
||||||
GtkPrinter *b);
|
GtkPrinter *b);
|
||||||
|
|||||||
@ -586,17 +586,12 @@ is_printer_active (GtkTreeModel *model,
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
/* FIXME needs some printer capabilities
|
if ((priv->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PDF) == 0)
|
||||||
*/
|
result = gtk_printer_accepts_ps (printer);
|
||||||
if ((priv->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PDF) == 0 &&
|
|
||||||
strcmp (gtk_printer_get_name (printer), _("Print to PDF")) == 0)
|
|
||||||
result = FALSE;
|
|
||||||
g_print ("testing printer \"%s\" result %d\n",
|
|
||||||
gtk_printer_get_name (printer), result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (printer);
|
g_object_unref (printer);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2753,3 +2748,4 @@ gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
|
|||||||
|
|
||||||
#define __GTK_PRINT_UNIX_DIALOG_C__
|
#define __GTK_PRINT_UNIX_DIALOG_C__
|
||||||
#include "gtkaliasdef.c"
|
#include "gtkaliasdef.c"
|
||||||
|
|
||||||
|
|||||||
@ -338,9 +338,12 @@ gtk_print_backend_pdf_init (GtkPrintBackendPdf *backend)
|
|||||||
{
|
{
|
||||||
GtkPrinter *printer;
|
GtkPrinter *printer;
|
||||||
|
|
||||||
printer = gtk_printer_new (_("Print to PDF"),
|
printer = g_object_new (GTK_TYPE_PRINTER,
|
||||||
GTK_PRINT_BACKEND (backend),
|
"name", _("Print to PDF"),
|
||||||
TRUE);
|
"backend", backend,
|
||||||
|
"is-virtual", TRUE,
|
||||||
|
"accepts-ps", FALSE,
|
||||||
|
NULL);
|
||||||
|
|
||||||
gtk_printer_set_has_details (printer, TRUE);
|
gtk_printer_set_has_details (printer, TRUE);
|
||||||
gtk_printer_set_icon_name (printer, "floppy");
|
gtk_printer_set_icon_name (printer, "floppy");
|
||||||
|
|||||||
Reference in New Issue
Block a user