[gnome-control-center] printers: Control acceptance of jobs with enable switch
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Control acceptance of jobs with enable switch
- Date: Wed, 9 Jan 2013 13:25:59 +0000 (UTC)
commit 3482dd19c93592d90d136eb2894cfbf482bef671
Author: Marek Kasik <mkasik redhat com>
Date: Fri Aug 10 14:47:30 2012 +0200
printers: Control acceptance of jobs with enable switch
Control acceptance of jobs by selected printer together
with switch which controls whether printer is enabled/disabled.
Use word "Stopped" instead of "Paused" for disabled printers.
Show state "Does not accept jobs" if printer is enabled but doesn't
accept jobs.
https://bugzilla.gnome.org/show_bug.cgi?id=678668
egg-list-box | 2 +-
panels/printers/cc-printers-panel.c | 54 ++++++++++++++++++++++++++++++----
2 files changed, 48 insertions(+), 8 deletions(-)
---
diff --git a/egg-list-box b/egg-list-box
index 706210c..b32d127 160000
--- a/egg-list-box
+++ b/egg-list-box
@@ -1 +1 @@
-Subproject commit 706210c4e16f94d1cf20dd230894cc8051492dad
+Subproject commit b32d1270655f7c6c83550ae1adc0934105c0cc00
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 1167b49..d3df6c5 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -547,6 +547,7 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
GtkWidget *widget;
GtkWidget *model_button;
GtkWidget *model_label;
+ gboolean is_accepting_jobs = TRUE;
GValue value = G_VALUE_INIT;
gchar *printer_make_and_model = NULL;
gchar *printer_model = NULL;
@@ -610,8 +611,8 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
N_("Out of paper"),
/* Translators: The printer is offline */
NC_("printer state", "Offline"),
- /* Translators: Someone has paused the Printer */
- NC_("printer state", "Paused"),
+ /* Translators: Someone has stopped the Printer */
+ NC_("printer state", "Stopped"),
/* Translators: The printer marker supply waste receptacle is almost full */
N_("Waste receptacle almost full"),
/* Translators: The printer marker supply waste receptacle is full */
@@ -666,6 +667,13 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
printer_type = priv->dests[priv->current_dest].options[i].value;
else if (g_strcmp0 (priv->dests[priv->current_dest].options[i].name, "device-uri") == 0)
device_uri = priv->dests[priv->current_dest].options[i].value;
+ else if (g_strcmp0 (priv->dests[priv->current_dest].options[i].name, "printer-is-accepting-jobs") == 0)
+ {
+ if (g_strcmp0 (priv->dests[priv->current_dest].options[i].value, "true") == 0)
+ is_accepting_jobs = TRUE;
+ else
+ is_accepting_jobs = FALSE;
+ }
}
if (priv->ppd_file_names[priv->current_dest] == NULL)
@@ -778,8 +786,16 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
switch (printer_state)
{
case 3:
- /* Translators: Printer's state (can start new job without waiting) */
- status = g_strdup ( C_("printer state", "Ready"));
+ if (is_accepting_jobs)
+ {
+ /* Translators: Printer's state (can start new job without waiting) */
+ status = g_strdup ( C_("printer state", "Ready"));
+ }
+ else
+ {
+ /* Translators: Printer's state (printer is ready but doesn't accept new jobs) */
+ status = g_strdup ( C_("printer state", "Does not accept jobs"));
+ }
break;
case 4:
/* Translators: Printer's state (jobs are processing) */
@@ -881,7 +897,7 @@ printer_selection_changed_cb (GtkTreeSelection *selection,
gtk_builder_get_object (priv->builder, "printer-disable-switch");
g_signal_handlers_block_by_func (G_OBJECT (widget), printer_disable_cb, self);
- gtk_switch_set_active (GTK_SWITCH (widget), printer_state != 5);
+ gtk_switch_set_active (GTK_SWITCH (widget), printer_state != 5 && is_accepting_jobs);
g_signal_handlers_unblock_by_func (G_OBJECT (widget), printer_disable_cb, self);
@@ -1437,6 +1453,7 @@ printer_disable_cb (GObject *gobject,
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
gboolean paused = FALSE;
+ gboolean is_accepting_jobs = TRUE;
char *name = NULL;
int i;
@@ -1452,11 +1469,34 @@ printer_disable_cb (GObject *gobject,
{
if (g_strcmp0 (priv->dests[priv->current_dest].options[i].name, "printer-state") == 0)
paused = (g_strcmp0 (priv->dests[priv->current_dest].options[i].value, "5") == 0);
+ else if (g_strcmp0 (priv->dests[priv->current_dest].options[i].name, "printer-is-accepting-jobs") == 0)
+ {
+ if (g_strcmp0 (priv->dests[priv->current_dest].options[i].value, "true") == 0)
+ is_accepting_jobs = TRUE;
+ else
+ is_accepting_jobs = FALSE;
+ }
}
}
- if (name && printer_set_enabled (name, paused))
- actualize_printers_list (self);
+ if (name)
+ {
+ if (!paused && is_accepting_jobs)
+ {
+ printer_set_enabled (name, FALSE);
+ printer_set_accepting_jobs (name, FALSE, NULL);
+ }
+ else
+ {
+ if (paused)
+ printer_set_enabled (name, TRUE);
+
+ if (!is_accepting_jobs)
+ printer_set_accepting_jobs (name, TRUE, NULL);
+ }
+
+ actualize_printers_list (self);
+ }
}
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]