diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2008-07-15 17:34:34 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-07-15 17:34:34 +0000 |
commit | 1eb96eadfc3349534617082f3bb5dd8be2f3a99a (patch) | |
tree | 403051291907f22e24287d20189bd7ed8eb68002 /gtk/gtkprinter.c | |
parent | 1ea43444be78b1c281dd888ff86eca838ec3c7c2 (diff) | |
download | gtk+-1eb96eadfc3349534617082f3bb5dd8be2f3a99a.tar.gz |
Bug 384940 – handle rejecting jobs and authentication meaningfully
Patch by Marek Kasik, icons by Mike Langlie:
* gtk/gtk.symbols:
* gtk/gtkprintbackend.h:
* gtk/gtkprinter.[hc]: Add new paused and accepting-jobs properties
and getters/setters.
* gtk/gtkstock.h:
* gtk/gtkiconfactory.c:
* gtk/Makefile.am:
* gtk/stock-icons/{16,24}/gtk-print-paused.{png,svg}: New icon.
* modules/printbackends/cups/gtkprintbackendcups.c:
* gtk/gtkprintunixdialog.c: Handle paused and job-rejecting
printers.
svn path=/trunk/; revision=20838
Diffstat (limited to 'gtk/gtkprinter.c')
-rw-r--r-- | gtk/gtkprinter.c | 132 |
1 files changed, 124 insertions, 8 deletions
diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c index 1ce3ed55b1..96c0ec7815 100644 --- a/gtk/gtkprinter.c +++ b/gtk/gtkprinter.c @@ -43,13 +43,15 @@ struct _GtkPrinterPrivate gchar *description; gchar *icon_name; - guint is_active : 1; - guint is_new : 1; - guint is_virtual : 1; - guint is_default : 1; - guint has_details : 1; - guint accepts_pdf : 1; - guint accepts_ps : 1; + guint is_active : 1; + guint is_paused : 1; + guint is_accepting_jobs : 1; + guint is_new : 1; + guint is_virtual : 1; + guint is_default : 1; + guint has_details : 1; + guint accepts_pdf : 1; + guint accepts_ps : 1; gchar *state_message; gint job_count; @@ -72,7 +74,9 @@ enum { PROP_ICON_NAME, PROP_JOB_COUNT, PROP_ACCEPTS_PDF, - PROP_ACCEPTS_PS + PROP_ACCEPTS_PS, + PROP_PAUSED, + PROP_ACCEPTING_JOBS }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -180,6 +184,37 @@ gtk_printer_class_init (GtkPrinterClass *class) GTK_PARAM_READABLE)); /** + * GtkPrinter:paused: + * + * This property is %TRUE if this printer is paused. + * A paused printer still accepts jobs, but it does + * not print them. + * + * Since: 2.14 + */ + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_PAUSED, + g_param_spec_boolean ("paused", + P_("Paused Printer"), + P_("TRUE if this printer is paused"), + FALSE, + GTK_PARAM_READABLE)); + /** + * GtkPrinter:accepting-jobs: + * + * This property is %TRUE if the printer is accepting jobs. + * + * Since: 2.14 + */ + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_ACCEPTING_JOBS, + g_param_spec_boolean ("accepting-jobs", + P_("Accepting Jobs"), + P_("TRUE if this printer is accepting new jobs"), + TRUE, + GTK_PARAM_READABLE)); + + /** * GtkPrinter::details-acquired: * @printer: the #GtkPrinter on which the signal is emitted * @success: %TRUE if the details were successfully acquired @@ -213,6 +248,8 @@ gtk_printer_init (GtkPrinter *printer) priv->icon_name = NULL; priv->is_active = TRUE; + priv->is_paused = FALSE; + priv->is_accepting_jobs = TRUE; priv->is_new = TRUE; priv->has_details = FALSE; priv->accepts_pdf = TRUE; @@ -327,6 +364,12 @@ gtk_printer_get_property (GObject *object, case PROP_ACCEPTS_PS: g_value_set_boolean (value, priv->accepts_ps); break; + case PROP_PAUSED: + g_value_set_boolean (value, priv->is_paused); + break; + case PROP_ACCEPTING_JOBS: + g_value_set_boolean (value, priv->is_accepting_jobs); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -635,6 +678,79 @@ gtk_printer_set_is_active (GtkPrinter *printer, printer->priv->is_active = val; } +/** + * gtk_printer_is_paused: + * @printer: a #GtkPrinter + * + * Returns whether the printer is currently paused. + * A paused printer still accepts jobs, but it is not + * printing them. + * + * Return value: %TRUE if @printer is paused + * + * Since: 2.14 + */ +gboolean +gtk_printer_is_paused (GtkPrinter *printer) +{ + g_return_val_if_fail (GTK_IS_PRINTER (printer), TRUE); + + return printer->priv->is_paused; +} + +gboolean +gtk_printer_set_is_paused (GtkPrinter *printer, + gboolean val) +{ + GtkPrinterPrivate *priv; + + g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); + + priv = printer->priv; + + if (val == priv->is_paused) + return FALSE; + + priv->is_paused = val; + + return TRUE; +} + +/** + * gtk_printer_is_accepting_jobs: + * @printer: a #GtkPrinter + * + * Returns whether the printer is accepting jobs + * + * Return value: %TRUE if @printer is accepting jobs + * + * Since: 2.14 + */ +gboolean +gtk_printer_is_accepting_jobs (GtkPrinter *printer) +{ + g_return_val_if_fail (GTK_IS_PRINTER (printer), TRUE); + + return printer->priv->is_accepting_jobs; +} + +gboolean +gtk_printer_set_is_accepting_jobs (GtkPrinter *printer, + gboolean val) +{ + GtkPrinterPrivate *priv; + + g_return_val_if_fail (GTK_IS_PRINTER (printer), FALSE); + + priv = printer->priv; + + if (val == priv->is_accepting_jobs) + return FALSE; + + priv->is_accepting_jobs = val; + + return TRUE; +} /** * gtk_printer_is_virtual: |