gnome-scan r793 - in trunk: . modules/gsane
- From: bersace svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-scan r793 - in trunk: . modules/gsane
- Date: Thu, 15 Jan 2009 19:25:16 +0000 (UTC)
Author: bersace
Date: Thu Jan 15 19:25:16 2009
New Revision: 793
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=793&view=rev
Log:
Improved GSANE debugging output.
Modified:
trunk/ChangeLog
trunk/modules/gsane/gsane-option-area.c
trunk/modules/gsane/gsane-option-handler-generic.c
trunk/modules/gsane/gsane-option-handler.c
trunk/modules/gsane/gsane-option-source.c
trunk/modules/gsane/gsane-scanner.c
Modified: trunk/modules/gsane/gsane-option-area.c
==============================================================================
--- trunk/modules/gsane/gsane-option-area.c (original)
+++ trunk/modules/gsane/gsane-option-area.c Thu Jan 15 19:25:16 2009
@@ -136,7 +136,7 @@
GtkPaperSize* ps;
GnomeScanEnumValue evalue;
GValue* value;
- GSList* values = NULL;
+ GSList *values = NULL, *it;
gdouble width, height;
GnomeScanUnit unit = gsane_option_unit(self->priv->tl_x_desc);
@@ -178,6 +178,19 @@
values = gsane_option_area_add_paper_size(self, values, GTK_PAPER_NAME_LEGAL, width, height, unit);
values = gsane_option_area_add_paper_size(self, values, GTK_PAPER_NAME_EXECUTIVE, width, height, unit);
+ gchar *papersizes = NULL, *old;
+ const gchar* label;
+ for(it = values; it; it = it->next) {
+ label = ((GnomeScanEnumValue*)(it->data))->label;
+ if (papersizes) {
+ old = papersizes;
+ papersizes = g_strdup_printf("%s, \"%s\"", papersizes, label);
+ g_free(old);
+ }
+ else
+ papersizes = g_strdup_printf("\"%s\"", label);
+ }
+
g_value_reset(value);
g_free(value);
@@ -185,6 +198,9 @@
values->data, values, GNOME_SCAN_OPTION_HINT_PRIMARY));
gnome_scan_node_install_option(GNOME_SCAN_NODE(handler->scanner), self->priv->paper_size);
g_signal_connect_swapped(self->priv->paper_size, "notify::value", G_CALLBACK(gsane_option_area_option_changed), self);
+
+ g_debug("\toption : paper-size = \"%s\", enum = {%s}", ((GnomeScanEnumValue*)(values->data))->label, papersizes);
+ g_free(papersizes);
}
Modified: trunk/modules/gsane/gsane-option-handler-generic.c
==============================================================================
--- trunk/modules/gsane/gsane-option-handler-generic.c (original)
+++ trunk/modules/gsane/gsane-option-handler-generic.c Thu Jan 15 19:25:16 2009
@@ -149,7 +149,7 @@
GSANE_OPTION_HANDLER_GENERIC_GET_CLASS(handler)->option_hint));
self->priv->get_value = gsane_option_handler_generic_bool_get_value;
g_signal_connect_swapped(self->priv->option, "notify::value", G_CALLBACK(gsane_option_handler_generic_bool_option_value_changed), self);
- g_debug("\toption %d : boolean %s = %s", n, desc->name, GSANE_BOOLEAN_TO_STRING(value));
+ g_debug("\toption %02d : boolean %s = %s", n, desc->name, GSANE_BOOLEAN_TO_STRING(value));
}
static void
@@ -157,17 +157,22 @@
{
GSaneOptionHandlerGeneric* self = GSANE_OPTION_HANDLER_GENERIC(handler);
gint value, min, step, max;
+ gchar *smin, *smax;
value = gsane_option_handler_get_int(handler, desc, n, NULL);
if (desc->constraint_type == SANE_CONSTRAINT_RANGE) {
min = desc->constraint.range->min;
+ smin = g_strdup_printf("%d", min);
step = MAX(1, desc->constraint.range->quant);
max = desc->constraint.range->max;
+ smax = g_strdup_printf("%d", max);
}
else {
min = G_MININT;
+ smin = g_strdup("G_MININT");
step = 1;
max = G_MAXINT;
+ smax = g_strdup("G_MAXINT");
}
self->priv->option = GNOME_SCAN_OPTION(gnome_scan_option_int_new(desc->name, S_(desc->title), S_(desc->desc),
gsane_option_handler_generic_get_group(self, desc, n, group),
@@ -177,7 +182,9 @@
GSANE_OPTION_HANDLER_GENERIC_GET_CLASS(handler)->option_hint));
self->priv->get_value = gsane_option_handler_generic_int_get_value;
g_signal_connect_swapped(self->priv->option, "notify::value", G_CALLBACK(gsane_option_handler_generic_int_option_value_changed), self);
- g_debug("\toption %d : int %s = %d, range = [%d;%d;%d]", n, desc->name, value, min, step, max);
+ g_debug("\toption %02d : int %s = %d, range = [%s;%d;%s]", n, desc->name, value, smin, step, smax);
+ g_free(smin);
+ g_free(smax);
}
static void
@@ -185,17 +192,22 @@
{
GSaneOptionHandlerGeneric* self = GSANE_OPTION_HANDLER_GENERIC(handler);
gdouble value, min, step, max;
+ gchar* smin, *smax;
value = gsane_option_handler_get_double(handler, desc, n, NULL);
if (desc->constraint_type == SANE_CONSTRAINT_RANGE) {
min = SANE_UNFIX(desc->constraint.range->min);
+ smin = g_strdup_printf("%.2f", min);
step = MAX(1., SANE_UNFIX(desc->constraint.range->quant));
max = SANE_UNFIX(desc->constraint.range->max);
+ smax = g_strdup_printf("%.2f", max);
}
else {
min = G_MINDOUBLE;
- step = 1.;
+ smin = g_strdup("G_MINDOUBLE");
+ step = .1;
max = G_MAXDOUBLE;
+ smax = g_strdup("G_MAXDOUBLE");
}
self->priv->option = GNOME_SCAN_OPTION(gnome_scan_option_double_new(desc->name, S_(desc->title), S_(desc->desc),
gsane_option_handler_generic_get_group(self, desc, n, group),
@@ -205,7 +217,9 @@
GSANE_OPTION_HANDLER_GENERIC_GET_CLASS(handler)->option_hint));
self->priv->get_value = gsane_option_handler_generic_double_get_value;
g_signal_connect_swapped(self->priv->option, "notify::value", G_CALLBACK(gsane_option_handler_generic_double_option_value_changed), self);
- g_debug("\toption %d : double %s = %.2g, range = [%.2e;%.2e;%.2e]", n, desc->name, value, min, step, max);
+ g_debug("\toption %02d : double %s = %.2g, range = [%s;%.2f;%s]", n, desc->name, value, smin, step, smax);
+ g_free(smin);
+ g_free(smax);
}
static void
@@ -220,7 +234,7 @@
GSANE_OPTION_HANDLER_GENERIC_GET_CLASS(handler)->option_hint));
self->priv->get_value = gsane_option_handler_generic_string_get_value;
g_signal_connect_swapped(self->priv->option, "notify::value", G_CALLBACK(gsane_option_handler_generic_string_option_value_changed), self);
- g_debug("\toption %d : string %s = \"%s\"", n, desc->name, value);
+ g_debug("\toption %02d : string %s = \"%s\"", n, desc->name, value);
g_free(value);
}
@@ -237,14 +251,14 @@
case SANE_TYPE_INT:
array_length = desc->size / sizeof(SANE_Word);
if (array_length > 1)
- g_debug("Ignoring int array option %s", desc->name);
+ g_debug("\toption %02d : Ignoring int array option %s", n, desc->name);
else
gsane_option_handler_generic_handle_int_option(handler, desc, n, group);
break;
case SANE_TYPE_FIXED:
array_length = desc->size / sizeof(SANE_Word);
if (array_length > 1)
- g_debug("Ignoring double array option %s", desc->name);
+ g_debug("\toption %02d : Ignoring double array option %s", n, desc->name);
else
gsane_option_handler_generic_handle_double_option(handler, desc, n, group);
break;
@@ -252,7 +266,7 @@
gsane_option_handler_generic_handle_string_option(handler, desc, n, group);
break;
default:
- g_debug("\toption %d : <unhandled> %s", n, desc->name);
+ g_debug("\toption %02d : <unhandled> %s", n, desc->name);
break;
}
}
@@ -270,14 +284,14 @@
case SANE_TYPE_INT:
array_length = desc->size/sizeof(SANE_Int);
if (array_length > 1)
- g_debug("Ignoring int enum array option %s", desc->name);
+ g_debug("\toption %02d : Ignoring int enum array option %s", n, desc->name);
else
values = gsane_option_handler_enum_list_int_values(handler, desc, n);
break;
case SANE_TYPE_FIXED:
array_length = desc->size/sizeof(SANE_Fixed);
if (array_length > 1)
- g_debug("Ignoring double enum array option %s", desc->name);
+ g_debug("\toption %02d : Ignoring double enum array option %s", desc->name);
else
values = gsane_option_handler_enum_list_double_values(handler, desc, n);
break;
@@ -285,7 +299,7 @@
values = gsane_option_handler_enum_list_string_values(handler, desc, n);
break;
default:
- g_debug("\toption %d : <unhandled> %s", n, desc->name);
+ g_debug("\toption %02d : <unhandled> %s", n, desc->name);
break;
}
Modified: trunk/modules/gsane/gsane-option-handler.c
==============================================================================
--- trunk/modules/gsane/gsane-option-handler.c (original)
+++ trunk/modules/gsane/gsane-option-handler.c Thu Jan 15 19:25:16 2009
@@ -213,8 +213,6 @@
g_debug("Setting %s : value inexact", desc->name);
inexact = TRUE;
}
- else
- gs_debug("%s(%s) successful", GSANE_ACTION_TO_STRING(action), desc->name);
if (flags & SANE_INFO_RELOAD_OPTIONS)
g_signal_emit_by_name(self->scanner, "reload-options");
if (flags & SANE_INFO_RELOAD_PARAMS)
Modified: trunk/modules/gsane/gsane-option-source.c
==============================================================================
--- trunk/modules/gsane/gsane-option-source.c (original)
+++ trunk/modules/gsane/gsane-option-source.c Thu Jan 15 19:25:16 2009
@@ -117,9 +117,11 @@
GSList *iter, *values = gsane_option_handler_enum_list_string_values(handler, desc, n);
GnomeScanEnumValue *value, *default_value;
const gchar* src;
+ gchar *sources, *old;
/* override label to make source consistent accross backends,
this also allow to know whether ADF is selected. */
+ sources = NULL;
for(iter = values; iter; iter = iter->next) {
value = iter->data;
src = g_value_get_string(&value->value);
@@ -131,6 +133,15 @@
value->label = GSANE_SOURCE_TMA;
else if (gsane_string_in_array(src, negative_src))
value->label = GSANE_SOURCE_NEGATIVE;
+
+ if (sources) {
+ old = sources;
+ sources = g_strdup_printf("%s, \"%s\"", sources, value->label);
+ g_free(old);
+ }
+ else
+ sources = g_strdup_printf("\"%s\"", value->label);
+
}
default_value = gsane_option_handler_get_enum(handler, desc, n, values, NULL);
@@ -138,6 +149,9 @@
default_value, values, GNOME_SCAN_OPTION_HINT_PRIMARY));
g_signal_connect_swapped(self->priv->option, "notify::value", G_CALLBACK(gsane_option_source_option_changed), self);
gnome_scan_node_install_option(GNOME_SCAN_NODE(handler->scanner), self->priv->option);
+
+ g_debug("\toption %02d : source = \"%s\", enum = {%s}", n, default_value->label, sources);
+ g_free(sources);
}
void
Modified: trunk/modules/gsane/gsane-scanner.c
==============================================================================
--- trunk/modules/gsane/gsane-scanner.c (original)
+++ trunk/modules/gsane/gsane-scanner.c Thu Jan 15 19:25:16 2009
@@ -99,7 +99,7 @@
if (status != SANE_STATUS_GOOD) {
const SANE_String_Const message = sane_strstatus(status);
g_warning("SANE operation : %s failed with %s", operation, message);
- gnome_scan_node_update_status(GNOME_SCAN_NODE(self), GNOME_SCAN_STATUS_FAILED, message);
+ gnome_scan_node_update_status(GNOME_SCAN_NODE(self), gsane_status_to_error_code(status), message);
}
return status == SANE_STATUS_GOOD;
}
@@ -173,10 +173,8 @@
const SANE_Option_Descriptor* desc;
SANE_Int count;
const gchar* group = NULL;
- gchar* devname;
gint n;
- g_object_get(self, "name", &devname, NULL);
status = sane_open(self->priv->sane_id, &self->priv->handle);
gchar *operation = g_strdup_printf("sane_open(%s)", self->priv->sane_id);
if (!gsane_scanner_check_sane_status(self, operation, status)) {
@@ -185,7 +183,7 @@
}
sane_control_option(self->priv->handle, 0, SANE_ACTION_GET_VALUE, &count, NULL);
- g_debug("Device %s : %d options", self->priv->sane_id, count);
+ g_debug("Device %s (%s) : %d options", gnome_scan_scanner_get_name(self), self->priv->sane_id, count);
/* loop all SANE options */
for (n = 1; n < count; n++) {
@@ -196,13 +194,13 @@
group = desc->title;
break;
case SANE_TYPE_BUTTON:
- g_debug("Ignoring button %s.", desc->name);
+ g_debug("\toption %02d : Ignoring button %s.", n, desc->name);
break;
default:
if (SANE_OPTION_IS_SETTABLE(desc->cap))
gsane_scanner_handle_sane_option(self, n, desc, group);
else
- g_debug("Ignoring sensor : %s", desc->name);
+ g_debug("\toption %02d : Ignoring sensor %s", n, desc->name);
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]