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
This commit is contained in:
132
gtk/gtkprinter.c
132
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 };
|
||||
@ -179,6 +183,37 @@ gtk_printer_class_init (GtkPrinterClass *class)
|
||||
0,
|
||||
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
|
||||
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user