gnome-scan r472 - in trunk: . lib modules po



Author: bersace
Date: Tue Jan 15 17:21:22 2008
New Revision: 472
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=472&view=rev

Log:
Follow GEGL API changes.
Added preview rotation button.


Added:
   trunk/lib/gnome-scan-preview-plugin-rotation.c
   trunk/lib/gnome-scan-preview-plugin-rotation.h
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/lib/Makefile.am
   trunk/lib/gnome-scan-dialog.c
   trunk/lib/gnome-scan-job.c
   trunk/lib/gnome-scan-param-specs.h
   trunk/lib/gnome-scan-preview-area.c
   trunk/lib/gnome-scan-preview-plugin-area.c
   trunk/lib/gnome-scan-preview-plugin.c
   trunk/lib/gnome-scan-preview-plugin.h
   trunk/lib/gnome-scan-processor-common.c
   trunk/lib/gnome-scan-settings.c
   trunk/lib/gnome-scan-string-widget.c
   trunk/modules/gsane-scanner.c
   trunk/po/ChangeLog
   trunk/po/POTFILES.in

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Tue Jan 15 17:21:22 2008
@@ -60,7 +60,7 @@
 AC_SUBST(API_VERSION)
 
 
-PKG_CHECK_MODULES(GNOME_SCAN, [gmodule-2.0 gthread-2.0 glib-2.0 gdk-2.0 >= 2.11 gdk-pixbuf-2.0 gtk+-2.0 gegl >= 0.0.14])
+PKG_CHECK_MODULES(GNOME_SCAN, [gmodule-2.0 gthread-2.0 glib-2.0 gdk-2.0 >= 2.11 gdk-pixbuf-2.0 gtk+-2.0 gegl >= 0.0.15])
 AC_SUBST(GNOME_SCAN_CFLAGS)
 AC_SUBST(GNOME_SCAN_LIBS)
 

Modified: trunk/lib/Makefile.am
==============================================================================
--- trunk/lib/Makefile.am	(original)
+++ trunk/lib/Makefile.am	Tue Jan 15 17:21:22 2008
@@ -78,7 +78,9 @@
 	gnome-scan-preview-plugin-area.h          \
 	gnome-scan-preview-plugin-area.c          \
 	gnome-scan-processor-common.h          \
-	gnome-scan-processor-common.c
+	gnome-scan-processor-common.c          \
+	gnome-scan-preview-plugin-rotation.h          \
+	gnome-scan-preview-plugin-rotation.c
 
 
 gnome-scan-types.%: $(types_deps) Makefile gnome-scan-types.%.tpl

Modified: trunk/lib/gnome-scan-dialog.c
==============================================================================
--- trunk/lib/gnome-scan-dialog.c	(original)
+++ trunk/lib/gnome-scan-dialog.c	Tue Jan 15 17:21:22 2008
@@ -331,12 +331,13 @@
     gsd_build_processing_ui (dialog);
   gsd_build_sink_ui (dialog);
 	
+    /* configure preview job */
   priv->preview_job = gnome_scan_job_new ();
   gnome_scan_job_set_settings (priv->preview_job,
                                gnome_scan_job_get_settings (priv->job));
-  for (node = gnome_scan_job_get_processors (priv->job); node; node = node->next) {
+  for (node = gnome_scan_job_get_processors (priv->job)->next; node; node = node->next)
       gnome_scan_job_add_processor (priv->preview_job, node->data);
-  }
+
   GnomeScanSink*sink = gnome_scan_preview_sink_new ();
   gnome_scan_job_set_sink (priv->preview_job, sink);
 
@@ -1009,18 +1010,18 @@
   GSList *node, *groups = NULL;
 	
   gsd_build_group_box (gsd, priv->general_page,
-		       GTK_BOX (priv->front_sink_box),
-		       GNOME_SCAN_PLUGIN (sink),
-		       GS_PARAM_GROUP_SINK_FRONT);
+                       GTK_BOX (priv->front_sink_box),
+                       GNOME_SCAN_PLUGIN (sink),
+                       GS_PARAM_GROUP_SINK_FRONT);
 	
   groups = gnome_scan_plugin_params_get_other_groups (GNOME_SCAN_PLUGIN (sink),
 						      GS_PARAM_GROUP_SINK_FRONT,
 						      0);
   for (node = groups; node ; node = node->next) {
-    gsd_build_group_box (gsd, priv->sink_page,
-			 GTK_BOX (priv->sink_box),
-			 GNOME_SCAN_PLUGIN (sink),
-			 (GQuark) node->data);
+      gsd_build_group_box (gsd, priv->sink_page,
+                           GTK_BOX (priv->sink_box),
+                           GNOME_SCAN_PLUGIN (sink),
+                           (GQuark) node->data);
   }
 	
   gnome_scan_plugin_params_foreach (GNOME_SCAN_PLUGIN (sink),
@@ -1143,7 +1144,8 @@
     
     /* loop each processor and add options */
     for (; proc; proc = proc->next) {
-        groups = gnome_scan_plugin_params_get_groups (GNOME_SCAN_PLUGIN (proc->data));
+        groups = gnome_scan_plugin_params_get_other_groups (GNOME_SCAN_PLUGIN (proc->data),
+                                                            GS_PARAM_GROUP_PREVIEW, -1);
         for (node = groups; node ; node = node->next) {
             gsd_build_group_box (gsd, priv->processing_page,
                                  GTK_BOX (priv->processing_box),
@@ -1164,60 +1166,67 @@
 static void
 gsd_preview_scanner_selected (GnomeScanDialog *gsd)
 {
-  GnomeScanDialogPrivate *priv = GET_PRIVATE (gsd);
-  GtkWidget*widget = GTK_WIDGET (gsd);
-  GParamSpec *pspec;
-  GSParamSpecPaperSize *psps;
-  GtkPaperSize *ps;
-  GnomeScanner *scanner;
-  GdkPixbuf *pixbuf;
-  GnomeScanPreviewPlugin *plugin;
-  GSList *node = NULL;
-  GType type;
-  gboolean first =  TRUE;
-  
-  /* add buttons */
-  scanner = gnome_scan_job_get_scanner (priv->job);
-  node = gnome_scan_plugin_get_param_group (GNOME_SCAN_PLUGIN (scanner),
-					    GS_PARAM_GROUP_PREVIEW);
-	
-  for (; node ; node = node->next) {
-    pspec = node->data;
-    type = gs_param_spec_get_widget_type (pspec);
-    plugin = gnome_scan_preview_plugin (type,
-					GNOME_SCAN_PLUGIN (scanner),
-					pspec,
-					priv->preview_area,
-					gnome_scan_job_get_settings (priv->job),
-					GTK_BOX (priv->preview_bbox));
-    g_param_spec_set_qdata (pspec, GSD_PLUGIN_QUARK, plugin);
-
-    if (first)
-      gnome_scan_preview_area_select_plugin (GNOME_SCAN_PREVIEW_AREA (priv->preview_area),
-					     plugin);
-    first = FALSE;
-  }
-	
-  /* create empty preview */
-  pspec = gnome_scan_plugin_params_lookup (GNOME_SCAN_PLUGIN (scanner),
-					   "paper-size");
-  psps = GS_PARAM_SPEC_PAPER_SIZE (pspec);
-  ps = psps->enumeration->next->data;
-  gint width = (gint) gs_convert (gtk_paper_size_get_width (ps, GTK_UNIT_MM), GS_UNIT_MM, GS_UNIT_PIXEL, PREVIEW_RES);
-  gint height = (gint) gs_convert (gtk_paper_size_get_height (ps, GTK_UNIT_MM), GS_UNIT_MM, GS_UNIT_PIXEL, PREVIEW_RES);
-	
-  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
-			   FALSE, 8,
-			   width,
-			   height);
-  /* transform a 24bit RGB pixel to 32bit RGBApixel */
-  guint32 pixel = (widget->style->bg[GTK_WIDGET_STATE (widget)].pixel << 8) | 0x000000FF;
-  gdk_pixbuf_fill (pixbuf, pixel);
-  /* TODO: put a nice icon, back in gnome-scan 0.4 ;) */
-  gnome_scan_preview_area_set_pixbuf (GNOME_SCAN_PREVIEW_AREA (priv->preview_area),
-				      pixbuf,
-				      PREVIEW_RES);
-  g_object_unref (G_OBJECT (pixbuf));
+    GnomeScanDialogPrivate *priv = GET_PRIVATE (gsd);
+    GtkWidget*widget = GTK_WIDGET (gsd);
+    GParamSpec *pspec;
+    GSParamSpecPaperSize *psps;
+    GtkPaperSize *ps;
+    GnomeScanner *scanner;
+    GdkPixbuf *pixbuf;
+    GnomeScanPreviewPlugin *plugin;
+    GSList *node = NULL, *node0 = NULL;
+    GType type;
+    gboolean first =  TRUE;
+    
+    /* add buttons */
+    scanner = gnome_scan_job_get_scanner (priv->job);
+    node0 = gnome_scan_plugin_get_param_group (GNOME_SCAN_PLUGIN (scanner),
+                                               GS_PARAM_GROUP_PREVIEW);
+    
+    for (node = gnome_scan_job_get_processors (priv->job); node; node = node->next) {
+        node0 = g_slist_concat(node0,
+                               gnome_scan_plugin_get_param_group (GNOME_SCAN_PLUGIN(node->data),
+                                                                  GS_PARAM_GROUP_PREVIEW));
+    }
+    
+    for (node = node0; node ; node = node->next) {
+        pspec = node->data;
+        type = gs_param_spec_get_widget_type (pspec);
+        g_debug("new preview plugin : %s", g_type_name(type));
+        plugin = gnome_scan_preview_plugin (type,
+                                            GNOME_SCAN_PLUGIN (scanner),
+                                            pspec,
+                                            priv->preview_area,
+                                            gnome_scan_job_get_settings (priv->job),
+                                            GTK_BOX (priv->preview_bbox));
+        g_param_spec_set_qdata (pspec, GSD_PLUGIN_QUARK, plugin);
+        
+        if (first)
+            gnome_scan_preview_area_select_plugin (GNOME_SCAN_PREVIEW_AREA (priv->preview_area),
+                                                   plugin);
+        first = FALSE;
+    }
+    
+    /* create empty preview */
+    pspec = gnome_scan_plugin_params_lookup (GNOME_SCAN_PLUGIN (scanner),
+                                             "paper-size");
+    psps = GS_PARAM_SPEC_PAPER_SIZE (pspec);
+    ps = psps->enumeration->next->data;
+    gint width = (gint) gs_convert (gtk_paper_size_get_width (ps, GTK_UNIT_MM), GS_UNIT_MM, GS_UNIT_PIXEL, PREVIEW_RES);
+    gint height = (gint) gs_convert (gtk_paper_size_get_height (ps, GTK_UNIT_MM), GS_UNIT_MM, GS_UNIT_PIXEL, PREVIEW_RES);
+    
+    pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+                             FALSE, 8,
+                             width,
+                             height);
+    /* transform a 24bit RGB pixel to 32bit RGBApixel */
+    guint32 pixel = (widget->style->bg[GTK_WIDGET_STATE (widget)].pixel << 8) | 0x000000FF;
+    gdk_pixbuf_fill (pixbuf, pixel);
+    /* TODO: put a nice icon, back in gnome-scan 0.4 ;) */
+    gnome_scan_preview_area_set_pixbuf (GNOME_SCAN_PREVIEW_AREA (priv->preview_area),
+                                        pixbuf,
+                                        PREVIEW_RES);
+    g_object_unref (G_OBJECT (pixbuf));
 }
 
 static gboolean
@@ -1254,13 +1263,12 @@
 {
   GnomeScanDialogPrivate *priv = GET_PRIVATE (gsd);
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->preview_progress),
-				 priv->preview_job->progress);
+                                 priv->preview_job->progress);
   gtk_label_set_markup (GTK_LABEL (priv->preview_stage),
-			g_strdup_printf ("<i>%s</i>", priv->preview_job->stage));
+                        g_strdup_printf ("<i>%s</i>", priv->preview_job->stage));
 	
-  if (priv->preview_job->progress == 1.) {
-    g_idle_add ((GSourceFunc) gsd_preview_end_refresh, gsd);
-  }
+  if (priv->preview_job->progress == 1.)
+        g_idle_add ((GSourceFunc) gsd_preview_end_refresh, gsd);
 	
   return (priv->preview_job->progress < 1.);
 }

Modified: trunk/lib/gnome-scan-job.c
==============================================================================
--- trunk/lib/gnome-scan-job.c	(original)
+++ trunk/lib/gnome-scan-job.c	Tue Jan 15 17:21:22 2008
@@ -59,11 +59,11 @@
 };
 
 enum
-	{
-		PROP_0,
-		PROP_SETTINGS,
-		PROP_SCANNER,
-		PROP_SINK
+{
+	PROP_0,
+	PROP_SETTINGS,
+	PROP_SCANNER,
+	PROP_SINK
 	};
 
 
@@ -319,7 +319,7 @@
 }
 
 void
-gnome_scan_job_configure	(GnomeScanJob *job)
+gnome_scan_job_configure (GnomeScanJob *job)
 {
 	GnomeScanJobPrivate *priv = GET_PRIVATE (job);
 	
@@ -342,6 +342,7 @@
 													  priv->gegl_root);
 	/* processing */
 	for (snode = priv->processors; snode; snode = snode->next) {
+		gnome_scan_plugin_configure(GNOME_SCAN_PLUGIN(snode->data), priv->settings);
 		node = g_list_concat (node,
 							  gnome_scan_plugin_get_child_nodes (GNOME_SCAN_PLUGIN (snode->data),
 																 priv->gegl_root));

Modified: trunk/lib/gnome-scan-param-specs.h
==============================================================================
--- trunk/lib/gnome-scan-param-specs.h	(original)
+++ trunk/lib/gnome-scan-param-specs.h	Tue Jan 15 17:21:22 2008
@@ -115,40 +115,40 @@
 
 GnomeScanFormat*
 gnome_scan_format_new				(gchar *name,
-						 gchar *domain,
-						 gchar *description,
-						 gchar **mime_types,
-						 gchar **extensions);
+                                      gchar *domain,
+                                      gchar *description,
+                                      gchar **mime_types,
+                                      gchar **extensions);
 GQuark		gs_param_spec_get_group			(GParamSpec *spec);
 const gchar*	gs_param_spec_get_group_string		(GParamSpec *spec);
 void		gs_param_spec_set_group			(GParamSpec *spec, GQuark group);
 void		gs_param_spec_set_group_from_string	(GParamSpec *spec,
-							 const gchar *group);
+                                                    const gchar *group);
 
 void		gs_param_spec_set_domain 		(GParamSpec *spec,
-							 const gchar *domain);
+                                              const gchar *domain);
 const gchar*	gs_param_spec_get_domain		(GParamSpec *spec);
 
 void		gs_param_spec_set_unit 			(GParamSpec *spec,
-							 GnomeScanUnit unit);
+                                                GnomeScanUnit unit);
 GnomeScanUnit	gs_param_spec_get_unit			(GParamSpec *spec);
 
 void    	gs_param_spec_set_index			(GParamSpec *spec,
-							 guint index);
+                                                guint index);
 guint   	gs_param_spec_get_index			(GParamSpec *spec);
 
 void    	gs_param_spec_set_widget_type		(GParamSpec *spec,
-							 GType type);
+                                                  GType type);
 GType   	gs_param_spec_get_widget_type		(GParamSpec *spec);
 
 gint		gs_param_spec_cmp_index			(GParamSpec*a,
-							 GParamSpec *b);
+                                                GParamSpec *b);
 gint		gs_param_spec_cmp_name			(GParamSpec*a,
-							 GParamSpec *b);
+                                               GParamSpec *b);
 
 gint		gs_param_values_cmp			(GParamSpec *pspec,
-							 GValue *a,
-							 GValue *b);
+                                            GValue *a,
+                                            GValue *b);
 
 
 GParamSpec*	gs_param_spec_boolean (const gchar *name,

Modified: trunk/lib/gnome-scan-preview-area.c
==============================================================================
--- trunk/lib/gnome-scan-preview-area.c	(original)
+++ trunk/lib/gnome-scan-preview-area.c	Tue Jan 15 17:21:22 2008
@@ -33,28 +33,28 @@
 typedef struct _GnomeScanPreviewAreaPrivate GnomeScanPreviewAreaPrivate;
 struct _GnomeScanPreviewAreaPrivate
 {
-  GSList			*plugins;
-  GnomeScanPreviewPlugin	*plugin;
-
-  gdouble			resolution;
-  GdkPixbuf			*image;
-  cairo_t			*cairo_context;
-  cairo_surface_t		*buffer;
-  gboolean			buffer_deprecated;
+    GSList			*plugins;
+    GnomeScanPreviewPlugin	*plugin;
+    
+    gdouble			resolution;
+    GdkPixbuf			*image;
+    cairo_t			*cairo_context;
+    cairo_surface_t		*buffer;
+    gboolean			buffer_deprecated;
 };
 
 enum
-  {
+{
     PROP_0,
     PROP_PIXBUF,
     PROP_RESOLUTION
-  };
+};
 
 enum
-  {
+{
     PREVIEW_RECEIVED,
     LAST_SIGNAL
-  };
+};
 
 
 static GtkDrawingAreaClass* parent_class = NULL;
@@ -62,9 +62,9 @@
 
 /* INTERNALS */
 static gboolean	gspa_expose (GnomeScanPreviewArea *gspa,
-			     GdkEventExpose *event);
+                                GdkEventExpose *event);
 static void     gspa_draw (GnomeScanPreviewArea *gspa,
-			   GdkRegion *region);
+                           GdkRegion *region);
 
 
 
@@ -74,19 +74,19 @@
 static GObject*
 gnome_scan_preview_area_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
 {
-  GObject *object = 
-    G_OBJECT_CLASS (gnome_scan_preview_area_parent_class)->constructor (type,
-									n_construct_properties,
-									construct_properties);
-  GtkWidget *widget = GTK_WIDGET (object);
-  GnomeScanPreviewArea *gspa = GNOME_SCAN_PREVIEW_AREA (widget);
-  gtk_widget_set_size_request (widget, 100, 100);
-  gtk_widget_set_sensitive (widget, FALSE);
-	
-  g_signal_connect (object, "expose-event",
-		    G_CALLBACK (gspa_expose), gspa);
-	
-  return object;
+    GObject *object = 
+        G_OBJECT_CLASS (gnome_scan_preview_area_parent_class)->constructor (type,
+                                                                            n_construct_properties,
+                                                                            construct_properties);
+    GtkWidget *widget = GTK_WIDGET (object);
+    GnomeScanPreviewArea *gspa = GNOME_SCAN_PREVIEW_AREA (widget);
+    gtk_widget_set_size_request (widget, 100, 100);
+    gtk_widget_set_sensitive (widget, FALSE);
+    
+    g_signal_connect (object, "expose-event",
+                      G_CALLBACK (gspa_expose), gspa);
+    
+    return object;
 }
 
 static void
@@ -97,247 +97,247 @@
 static void
 gnome_scan_preview_area_finalize (GObject *object)
 {
-  /* TODO: Add deinitalization code here */
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+    /* TODO: Add deinitalization code here */
+    
+    G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
 gnome_scan_preview_area_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
-  g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (object));
-
-  switch (prop_id)
+    g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (object));
+    
+    switch (prop_id)
     {
-    case PROP_PIXBUF:
-      /* TODO: Add setter for "pixbuf" property here */
-      break;
-    case PROP_RESOLUTION:
-      /* TODO: Add setter for "resolution" property here */
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
+        case PROP_PIXBUF:
+            /* TODO: Add setter for "pixbuf" property here */
+            break;
+        case PROP_RESOLUTION:
+            /* TODO: Add setter for "resolution" property here */
+            break;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnome_scan_preview_area_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 {
-  g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (object));
-
-  switch (prop_id)
+    g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (object));
+    
+    switch (prop_id)
     {
-    case PROP_PIXBUF:
-      /* TODO: Add getter for "pixbuf" property here */
-      break;
-    case PROP_RESOLUTION:
-      /* TODO: Add getter for "resolution" property here */
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
+        case PROP_PIXBUF:
+            /* TODO: Add getter for "pixbuf" property here */
+            break;
+        case PROP_RESOLUTION:
+            /* TODO: Add getter for "resolution" property here */
+            break;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnome_scan_preview_area_area_selected (GnomeScanPreviewArea *preview_area, GdkRectangle *area)
 {
-  /* TODO: Add default signal handler implementation here */
+    /* TODO: Add default signal handler implementation here */
 }
 
 static void
 gnome_scan_preview_area_class_init (GnomeScanPreviewAreaClass *klass)
 {
-  GObjectClass* object_class = G_OBJECT_CLASS (klass);
-  parent_class = GTK_DRAWING_AREA_CLASS (g_type_class_peek_parent (klass));
-
-  g_type_class_add_private (klass, sizeof (GnomeScanPreviewAreaPrivate));
-	
-  object_class->finalize		= gnome_scan_preview_area_finalize;
-  object_class->constructor	= gnome_scan_preview_area_constructor;
-  object_class->set_property	= gnome_scan_preview_area_set_property;
-  object_class->get_property	= gnome_scan_preview_area_get_property;
-
-
-  g_object_class_install_property (object_class,
-				   PROP_PIXBUF,
-				   g_param_spec_object ("pixbuf",
-							"Pixbuf",
-							"The image buffer where to select an area",
-							GDK_TYPE_PIXBUF,
-							G_PARAM_READABLE | G_PARAM_WRITABLE));
-
-  g_object_class_install_property (object_class,
-				   PROP_RESOLUTION,
-				   g_param_spec_double ("resolution",
-							"Resolution",
-							"Image resolution for translation of pixel area into GtkUnit.",
-							1.0,
-							4800.0,
-							50.0,
-							G_PARAM_READABLE | G_PARAM_WRITABLE));
-
-  /* SIGNALS */
-  scan_preview_area_signals[PREVIEW_RECEIVED] =
-    g_signal_new ("preview-received",
-		  G_OBJECT_CLASS_TYPE (klass),
-		  G_SIGNAL_RUN_FIRST,
-		  G_STRUCT_OFFSET (GnomeScanPreviewAreaClass, preview_received),
-		  NULL, NULL,
-		  g_cclosure_marshal_VOID__OBJECT,
-		  G_TYPE_NONE, 1, GDK_TYPE_PIXBUF);
+    GObjectClass* object_class = G_OBJECT_CLASS (klass);
+    parent_class = GTK_DRAWING_AREA_CLASS (g_type_class_peek_parent (klass));
+    
+    g_type_class_add_private (klass, sizeof (GnomeScanPreviewAreaPrivate));
+    
+    object_class->finalize		= gnome_scan_preview_area_finalize;
+    object_class->constructor	= gnome_scan_preview_area_constructor;
+    object_class->set_property	= gnome_scan_preview_area_set_property;
+    object_class->get_property	= gnome_scan_preview_area_get_property;
+    
+    
+    g_object_class_install_property (object_class,
+                                     PROP_PIXBUF,
+                                     g_param_spec_object ("pixbuf",
+                                                          "Pixbuf",
+                                                          "The image buffer where to select an area",
+                                                          GDK_TYPE_PIXBUF,
+                                                          G_PARAM_READABLE | G_PARAM_WRITABLE));
+    
+    g_object_class_install_property (object_class,
+                                     PROP_RESOLUTION,
+                                     g_param_spec_double ("resolution",
+                                                          "Resolution",
+                                                          "Image resolution for translation of pixel area into GtkUnit.",
+                                                          1.0,
+                                                          4800.0,
+                                                          50.0,
+                                                          G_PARAM_READABLE | G_PARAM_WRITABLE));
+    
+    /* SIGNALS */
+    scan_preview_area_signals[PREVIEW_RECEIVED] =
+        g_signal_new ("preview-received",
+                      G_OBJECT_CLASS_TYPE (klass),
+                      G_SIGNAL_RUN_FIRST,
+                      G_STRUCT_OFFSET (GnomeScanPreviewAreaClass, preview_received),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__OBJECT,
+                      G_TYPE_NONE, 1, GDK_TYPE_PIXBUF);
 }
 
 
 GtkWidget*
 gnome_scan_preview_area_new	(void)
 {
-  return GTK_WIDGET (g_object_new (GNOME_TYPE_SCAN_PREVIEW_AREA,
-				   NULL));
+    return GTK_WIDGET (g_object_new (GNOME_TYPE_SCAN_PREVIEW_AREA,
+                                     NULL));
 }
 
 void
 gnome_scan_preview_area_set_pixbuf (GnomeScanPreviewArea *gspa, GdkPixbuf *pixbuf, gdouble resolution)
 {
-  GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (gspa);
-  gint width, height;
-	
-  if (priv->image)
-    g_object_unref (priv->image);
-	
-  priv->image = g_object_ref (pixbuf);
-	
-  priv->resolution = resolution;
-  width = gdk_pixbuf_get_width (pixbuf);
-  height = gdk_pixbuf_get_height (pixbuf);
-  gtk_widget_set_size_request (GTK_WIDGET (gspa),
-			       width, height);
-
-  gtk_widget_set_sensitive (GTK_WIDGET (gspa), TRUE);
-
-  gtk_widget_realize (GTK_WIDGET (gspa));
-  while (gtk_events_pending ()) gtk_main_iteration();
-
-  /* create buffer */
-  cairo_t *cr;
-
-  if (priv->buffer) {
-    cairo_surface_destroy (priv->buffer);
-    priv->buffer = NULL;
-  }
-
-  GdkPixmap *pixmap = gdk_pixmap_new (NULL, width, height, 24);
-  cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
-  priv->buffer = cairo_surface_create_similar (cairo_get_target (cr),
-					       CAIRO_CONTENT_COLOR,
-					       width, height);
-  cairo_destroy (cr);
-  g_object_unref (pixmap);
-
-  gnome_scan_preview_plugin_changed (priv->plugin);
-  gnome_scan_preview_area_update (gspa, NULL);
+    GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (gspa);
+    gint width, height;
+    
+    if (priv->image)
+        g_object_unref (priv->image);
+    
+    priv->image = g_object_ref (pixbuf);
+    
+    priv->resolution = resolution;
+    width = gdk_pixbuf_get_width (pixbuf);
+    height = gdk_pixbuf_get_height (pixbuf);
+    gtk_widget_set_size_request (GTK_WIDGET (gspa),
+                                 width, height);
+    
+    gtk_widget_set_sensitive (GTK_WIDGET (gspa), TRUE);
+    
+    gtk_widget_realize (GTK_WIDGET (gspa));
+    while (gtk_events_pending ()) gtk_main_iteration();
+    
+    /* create buffer */
+    cairo_t *cr;
+    
+    if (priv->buffer) {
+        cairo_surface_destroy (priv->buffer);
+        priv->buffer = NULL;
+    }
+    
+    GdkPixmap *pixmap = gdk_pixmap_new (NULL, width, height, 24);
+    cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
+    priv->buffer = cairo_surface_create_similar (cairo_get_target (cr),
+                                                 CAIRO_CONTENT_COLOR,
+                                                 width, height);
+    cairo_destroy (cr);
+    g_object_unref (pixmap);
+    
+    gnome_scan_preview_plugin_changed (priv->plugin);
+    gnome_scan_preview_area_update (gspa, NULL);
 }
 
 
 gdouble
 gnome_scan_preview_area_get_resolution (GnomeScanPreviewArea *preview_area)
 {
-  g_return_val_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (preview_area), 72.);
-  return GET_PRIVATE (preview_area)->resolution;
+    g_return_val_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (preview_area), 72.);
+    return GET_PRIVATE (preview_area)->resolution;
 }
 
 void
 gnome_scan_preview_area_get_size (GnomeScanPreviewArea *preview_area,
-				  gint *width,
-				  gint*height)
+                                  gint *width,
+                                  gint*height)
 {
-  g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (preview_area));
-  GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (preview_area);
-  *width = gdk_pixbuf_get_width (priv->image);
-  *height = gdk_pixbuf_get_height (priv->image);
+    g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (preview_area));
+    GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (preview_area);
+    *width = gdk_pixbuf_get_width (priv->image);
+    *height = gdk_pixbuf_get_height (priv->image);
 }
 
 
 void
 gnome_scan_preview_area_update (GnomeScanPreviewArea *preview_area,
-				GdkRectangle *r)
+                                GdkRectangle *r)
 {
-  g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (preview_area));
-  GET_PRIVATE (preview_area)->buffer_deprecated = TRUE;
-
-  if (r) {
-    gtk_widget_queue_draw_area (GTK_WIDGET (preview_area),
-				r->x, r->y,
-				r->width, r->height);
-  }
-  else {
-    gtk_widget_queue_draw (GTK_WIDGET (preview_area));
-  }
-
-  return;
+    g_return_if_fail (GNOME_IS_SCAN_PREVIEW_AREA (preview_area));
+    GET_PRIVATE (preview_area)->buffer_deprecated = TRUE;
+    
+    if (r) {
+        gtk_widget_queue_draw_area (GTK_WIDGET (preview_area),
+                                    r->x, r->y,
+                                    r->width, r->height);
+    }
+    else {
+        gtk_widget_queue_draw (GTK_WIDGET (preview_area));
+    }
+    
+    return;
 }
 
 
 void
 gnome_scan_preview_area_select_plugin (GnomeScanPreviewArea *pa,
-				       GnomeScanPreviewPlugin *plugin)
+                                       GnomeScanPreviewPlugin *plugin)
 {
-  GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE(pa);
-  priv->plugin = plugin;
+    GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE(pa);
+    priv->plugin = plugin;
 }
 
 /* INTERNALS */
 static void
 gspa_draw (GnomeScanPreviewArea *gspa,
-	   GdkRegion *region)
+           GdkRegion *region)
 {
-  GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (gspa);
-  GtkWidget *widget = GTK_WIDGET (gspa);
-  cairo_t *cr;
-
-  /* draw to buffer */
-  cr = cairo_create (priv->buffer);
-
-  /* clip to region */
-  gdk_cairo_region (cr, region);
-  cairo_clip (cr);
+    GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (gspa);
+    GtkWidget *widget = GTK_WIDGET (gspa);
+    cairo_t *cr;
     
-  /* draw image */
-  gdk_cairo_set_source_pixbuf (cr, priv->image, 0, 0);
-  cairo_paint (cr);
+    /* draw to buffer */
+    cr = cairo_create (priv->buffer);
     
-  /* delegate to current plugin */
-  gnome_scan_preview_plugin_draw_buffer (priv->plugin, GTK_WIDGET (gspa), cr);
-
-  cairo_destroy (cr);
+    /* clip to region */
+        gdk_cairo_region (cr, region);
+    cairo_clip (cr);
+    
+    /* draw image */
+        gdk_cairo_set_source_pixbuf (cr, priv->image, 0, 0);
+    cairo_paint (cr);
+    
+    /* delegate to current plugin */
+        gnome_scan_preview_plugin_draw_buffer (priv->plugin, GTK_WIDGET (gspa), cr);
+    
+    cairo_destroy (cr);
     
-  priv->buffer_deprecated = FALSE;
+    priv->buffer_deprecated = FALSE;
 }
 
 static gboolean
 gspa_expose (GnomeScanPreviewArea *gspa,
-	     GdkEventExpose *event)
+             GdkEventExpose *event)
 {
-  GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (gspa);
-  GtkWidget *widget = GTK_WIDGET (gspa);
-
-  /* update buffer */
-  /* TODO: draw optionnaly */
-  gspa_draw (gspa, event->region);
-  
-  cairo_t *cr = gdk_cairo_create (GDK_DRAWABLE (widget->window));
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-  cairo_set_source_surface (cr, priv->buffer, 0, 0);
-  cairo_paint (cr);
-
-  if (!GTK_WIDGET_IS_SENSITIVE (widget)) {
-    gdk_cairo_set_source_color (cr, &widget->style->bg[GTK_WIDGET_STATE (widget)]);
-    cairo_paint_with_alpha (cr, .5);
-  }
-
-  cairo_destroy (cr);
-
-  return FALSE;
+    GnomeScanPreviewAreaPrivate *priv = GET_PRIVATE (gspa);
+    GtkWidget *widget = GTK_WIDGET (gspa);
+    
+    /* update buffer */
+        /* TODO: draw optionnaly */
+        gspa_draw (gspa, event->region);
+    
+    cairo_t *cr = gdk_cairo_create (GDK_DRAWABLE (widget->window));
+    gdk_cairo_region (cr, event->region);
+    cairo_clip (cr);
+    cairo_set_source_surface (cr, priv->buffer, 0, 0);
+    cairo_paint (cr);
+    
+    if (!GTK_WIDGET_IS_SENSITIVE (widget)) {
+        gdk_cairo_set_source_color (cr, &widget->style->bg[GTK_WIDGET_STATE (widget)]);
+        cairo_paint_with_alpha (cr, .5);
+    }
+    
+    cairo_destroy (cr);
+    
+    return FALSE;
 }

Modified: trunk/lib/gnome-scan-preview-plugin-area.c
==============================================================================
--- trunk/lib/gnome-scan-preview-plugin-area.c	(original)
+++ trunk/lib/gnome-scan-preview-plugin-area.c	Tue Jan 15 17:21:22 2008
@@ -578,9 +578,7 @@
 gnome_scan_preview_plugin_area_finalize	(GnomeScanPreviewPlugin *gspp)
 {
     GnomeScanPreviewPluginArea *gsppa = GNOME_SCAN_PREVIEW_PLUGIN_AREA (gspp);
-#ifndef	NO_BUTTON
     gtk_widget_destroy (gsppa->button);
-#endif
     disconnect(button_press_event);
     disconnect(button_release_event);
     disconnect(motion_notify_event);
@@ -611,13 +609,11 @@
 gnome_scan_preview_plugin_area_build_ui	(GnomeScanPreviewPlugin *gspp, GtkBox *box)
 {
     GnomeScanPreviewPluginArea *gsppa = GNOME_SCAN_PREVIEW_PLUGIN_AREA (gspp);
-#ifndef	NO_BUTTON
     gsppa->button = gtk_button_new_with_mnemonic (_("Select _All"));
     g_signal_connect (gsppa->button, "clicked",
                       G_CALLBACK (gsppa_select_all_clicked),
                       gsppa);
     gtk_container_add (GTK_CONTAINER (box), gsppa->button);
-#endif
 }
 
 static void

Added: trunk/lib/gnome-scan-preview-plugin-rotation.c
==============================================================================
--- (empty file)
+++ trunk/lib/gnome-scan-preview-plugin-rotation.c	Tue Jan 15 17:21:22 2008
@@ -0,0 +1,92 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * gnome-scan
+ * Copyright (C) Ãtienne Bersac 2007 <bersace03 laposte net>
+ * 
+ * gnome-scan is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * gnome-scan is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with gnome-scan.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include "gnome-scan-preview-plugin-rotation.h"
+
+GS_DEFINE_PREVIEW_PLUGIN (GnomeScanPreviewPluginRotation, gnome_scan_preview_plugin_rotation, "");
+
+static void
+gnome_scan_preview_plugin_rotation_init (GnomeScanPreviewPlugin *object)
+{
+	/* TODO: Add initialization code here */
+}
+
+static void
+gnome_scan_preview_plugin_rotation_finalize (GnomeScanPreviewPlugin *object)
+{
+	/* TODO: Add deinitalization code here */
+
+}
+
+static void
+gsppr_button_clicked(GtkWidget *button, GnomeScanPreviewPluginRotation *gsppr)
+{	
+	GnomeScanPreviewPlugin *gspp = GNOME_SCAN_PREVIEW_PLUGIN(gsppr);
+	gdouble degrees;
+	degrees = gnome_scan_settings_get_double(gspp->settings, "rotation");
+	degrees += button == gsppr->rotate_left ? -90. : 90.;
+	degrees = (gdouble) ((360 + (gint) degrees) % 360);
+	g_debug("Rotation = %f", degrees);
+	gnome_scan_preview_plugin_freeze(gspp);
+	gnome_scan_settings_set_double(gspp->settings, "rotation", degrees);
+	gnome_scan_preview_plugin_thaw(gspp);
+}
+
+static void
+gnome_scan_preview_plugin_rotation_build_ui	(GnomeScanPreviewPlugin *gspp, GtkBox *box)
+{
+    GnomeScanPreviewPluginRotation *gsppr = GNOME_SCAN_PREVIEW_PLUGIN_ROTATION(gspp);
+	GtkWidget *image;
+	
+    gsppr->rotate_left = gtk_button_new();
+	image = gtk_image_new_from_icon_name ("object-rotate-left", GTK_ICON_SIZE_BUTTON);
+	gtk_button_set_image(GTK_BUTTON(gsppr->rotate_left), image);
+	gtk_button_set_label(GTK_BUTTON(gsppr->rotate_left), _("Rotate left"));
+    gtk_container_add (GTK_CONTAINER (box), gsppr->rotate_left);
+	g_signal_connect(gsppr->rotate_left, "clicked",
+					 G_CALLBACK(gsppr_button_clicked),
+					 gsppr);
+	
+    gsppr->rotate_right = gtk_button_new();
+	image = gtk_image_new_from_icon_name ("object-rotate-right", GTK_ICON_SIZE_BUTTON);
+	gtk_button_set_image(GTK_BUTTON(gsppr->rotate_right), image);
+	gtk_button_set_label(GTK_BUTTON(gsppr->rotate_right), _("Rotate right"));
+    gtk_container_add (GTK_CONTAINER (box), gsppr->rotate_right);
+	g_signal_connect(gsppr->rotate_right, "clicked",
+					 G_CALLBACK(gsppr_button_clicked),
+					 gsppr);
+}
+
+static void
+gnome_scan_preview_plugin_rotation_draw_buffer (GnomeScanPreviewPlugin *gspp,
+												GtkWidget *gspa,
+												cairo_t *cr)
+{
+}
+
+static void
+gnome_scan_preview_plugin_rotation_changed (GnomeScanPreviewPlugin *gspp)
+{
+	g_debug(__FUNCTION__);
+}

Added: trunk/lib/gnome-scan-preview-plugin-rotation.h
==============================================================================
--- (empty file)
+++ trunk/lib/gnome-scan-preview-plugin-rotation.h	Tue Jan 15 17:21:22 2008
@@ -0,0 +1,57 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * gnome-scan
+ * Copyright (C) Ãtienne Bersac 2007 <bersace03 laposte net>
+ * 
+ * gnome-scan is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * gnome-scan is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with gnome-scan.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _GNOME_SCAN_PREVIEW_PLUGIN_ROTATION_H_
+#define _GNOME_SCAN_PREVIEW_PLUGIN_ROTATION_H_
+
+#include <glib-object.h>
+#include "gnome-scan-preview-plugin.h"
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION             (gnome_scan_preview_plugin_rotation_get_type ())
+#define GNOME_SCAN_PREVIEW_PLUGIN_ROTATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION, GnomeScanPreviewPluginRotation))
+#define GNOME_SCAN_PREVIEW_PLUGIN_ROTATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION, GnomeScanPreviewPluginRotationClass))
+#define GNOME_IS_SCAN_PREVIEW_PLUGIN_ROTATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION))
+#define GNOME_IS_SCAN_PREVIEW_PLUGIN_ROTATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION))
+#define GNOME_SCAN_PREVIEW_PLUGIN_ROTATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION, GnomeScanPreviewPluginRotationClass))
+
+typedef struct _GnomeScanPreviewPluginRotationClass GnomeScanPreviewPluginRotationClass;
+typedef struct _GnomeScanPreviewPluginRotation GnomeScanPreviewPluginRotation;
+
+struct _GnomeScanPreviewPluginRotationClass
+{
+	GnomeScanPreviewPluginClass parent_class;
+};
+
+struct _GnomeScanPreviewPluginRotation
+{
+	GnomeScanPreviewPlugin parent_instance;
+	GtkWidget	*rotate_left;
+	GtkWidget	*rotate_right;
+};
+
+GType gnome_scan_preview_plugin_rotation_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* _GNOME_SCAN_PREVIEW_PLUGIN_ROTATION_H_ */

Modified: trunk/lib/gnome-scan-preview-plugin.c
==============================================================================
--- trunk/lib/gnome-scan-preview-plugin.c	(original)
+++ trunk/lib/gnome-scan-preview-plugin.c	Tue Jan 15 17:21:22 2008
@@ -149,10 +149,24 @@
 
 
 void
+gnome_scan_preview_plugin_freeze(GnomeScanPreviewPlugin *gspp)
+{
+	gspp->frozen = TRUE;
+}
+
+void
+gnome_scan_preview_plugin_thaw(GnomeScanPreviewPlugin *gspp)
+{
+	gspp->frozen  = FALSE;
+}
+
+void
 gnome_scan_preview_plugin_changed (GnomeScanPreviewPlugin *gspp)
 {
-	GnomeScanPreviewPluginClass *klass = GNOME_SCAN_PREVIEW_PLUGIN_GET_CLASS (gspp);
-	klass->changed(gspp);
+	if (!gspp->frozen) {
+		GnomeScanPreviewPluginClass *klass = GNOME_SCAN_PREVIEW_PLUGIN_GET_CLASS (gspp);
+		klass->changed(gspp);
+	}
 }
 
 void

Modified: trunk/lib/gnome-scan-preview-plugin.h
==============================================================================
--- trunk/lib/gnome-scan-preview-plugin.h	(original)
+++ trunk/lib/gnome-scan-preview-plugin.h	Tue Jan 15 17:21:22 2008
@@ -115,6 +115,7 @@
 	GParamSpec*			pspec;
 	gulong				settings_changed;
 	gulong				preview_changed;
+	gboolean			frozen;
 };
 
 GType gnome_scan_preview_plugin_get_type (void) G_GNUC_CONST;
@@ -126,6 +127,8 @@
 														 GtkWidget *gspa,
 														 GnomeScanSettings *settings,
 														 GtkBox *bbox);
+void	gnome_scan_preview_plugin_freeze				(GnomeScanPreviewPlugin *gspp);
+void	gnome_scan_preview_plugin_thaw					(GnomeScanPreviewPlugin *gspp);
 void	gnome_scan_preview_plugin_changed				(GnomeScanPreviewPlugin *gspp);
 void	gnome_scan_preview_plugin_draw_buffer			(GnomeScanPreviewPlugin *gspp,
 														 GtkWidget *gspa,

Modified: trunk/lib/gnome-scan-processor-common.c
==============================================================================
--- trunk/lib/gnome-scan-processor-common.c	(original)
+++ trunk/lib/gnome-scan-processor-common.c	Tue Jan 15 17:21:22 2008
@@ -24,6 +24,7 @@
 #include "gnome-scan-param-specs.h"
 #include "gnome-scan-utils.h"
 #include "gnome-scan-processor-common.h"
+#include "gnome-scan-preview-plugin-rotation.h"
 
 typedef struct _GnomeScanProcessorCommonPrivate GnomeScanProcessorCommonPrivate;
 struct _GnomeScanProcessorCommonPrivate
@@ -55,9 +56,10 @@
 #undef gs_g_value_new_int
 
 	pspec = gs_param_spec_range("rotation", "Rotation", "Rotation",
-								GS_PARAM_GROUP_PROCESSING_COMMON,
+								GS_PARAM_GROUP_PREVIEW,
 								min, max, step, val,
 								G_PARAM_WRITABLE);
+	gs_param_spec_set_widget_type(pspec, GNOME_TYPE_SCAN_PREVIEW_PLUGIN_ROTATION);
 	gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (object), pspec);
 }
 
@@ -80,7 +82,6 @@
 {
 	GnomeScanProcessorCommonPrivate *priv = GET_PRIVATE (plugin);
 	priv->degrees = gnome_scan_settings_get_double (settings, "rotation");
-	g_debug ("Rotation set to %2.2f", priv->degrees);
 }
 
 GList*

Modified: trunk/lib/gnome-scan-settings.c
==============================================================================
--- trunk/lib/gnome-scan-settings.c	(original)
+++ trunk/lib/gnome-scan-settings.c	Tue Jan 15 17:21:22 2008
@@ -141,12 +141,12 @@
  **/
 void
 gnome_scan_settings_set (GnomeScanSettings *settings,
-			 const gchar *name,
-			 const GValue *value)
+                         const gchar *name,
+                         const GValue *value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings) && G_IS_VALUE (value));
   g_hash_table_insert (GET_PRIVATE (settings)->values, g_strdup (name),
-		       g_boxed_copy (G_TYPE_VALUE, value));
+                       g_boxed_copy (G_TYPE_VALUE, value));
   g_signal_emit (settings, signals[CHANGED], 0, name);
 }
 
@@ -192,8 +192,8 @@
  **/
 void
 gnome_scan_settings_set_double (GnomeScanSettings *settings,
-				const gchar *name,
-				gdouble value)
+                                const gchar *name,
+                                gdouble value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
   GValue *v = g_new0 (GValue, 1);
@@ -213,8 +213,8 @@
  **/
 void
 gnome_scan_settings_set_int (GnomeScanSettings *settings,
-			     const gchar *name,
-			     gint value)
+                             const gchar *name,
+                             gint value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
   GValue *v = g_new0 (GValue, 1);
@@ -234,9 +234,9 @@
  **/
 void
 gnome_scan_settings_set_enum (GnomeScanSettings *settings,
-			      const gchar *name,
-			      GType type,
-			      gint value)
+                              const gchar *name,
+                              GType type,
+                              gint value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
   GValue *v = g_new0 (GValue, 1);
@@ -256,9 +256,9 @@
  **/
 void
 gnome_scan_settings_set_boxed (GnomeScanSettings *settings,
-			       const gchar *name,
-			       GType type,
-			       gpointer value)
+                               const gchar *name,
+                               GType type,
+                               gpointer value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
   GValue *v = g_new0 (GValue, 1);
@@ -278,8 +278,8 @@
  **/
 void
 gnome_scan_settings_set_object (GnomeScanSettings *settings,
-				const gchar *name,
-				GObject* value)
+                                const gchar *name,
+                                GObject* value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
   GValue *v = g_new0 (GValue, 1);
@@ -299,8 +299,8 @@
  **/
 void
 gnome_scan_settings_set_pointer (GnomeScanSettings *settings,
-				 const gchar *name,
-				 gpointer value)
+                                 const gchar *name,
+                                 gpointer value)
 {
   g_return_if_fail (GNOME_IS_SCAN_SETTINGS (settings));
   GValue *v = g_new0 (GValue, 1);
@@ -321,7 +321,7 @@
  **/
 GValue*
 gnome_scan_settings_get (GnomeScanSettings *settings,
-			 const gchar *name)
+                         const gchar *name)
 {
   g_return_val_if_fail (GNOME_IS_SCAN_SETTINGS (settings), NULL);
   GValue *v = g_hash_table_lookup (GET_PRIVATE (settings)->values, name);
@@ -344,8 +344,8 @@
  **/
 GValue*
 gnome_scan_settings_get_transformed	(GnomeScanSettings *settings,
-					 const gchar *name,
-					 GType type)
+                                        const gchar *name,
+                                        GType type)
 {
   g_return_val_if_fail (GNOME_IS_SCAN_SETTINGS (settings), NULL);
   GValue *v = gnome_scan_settings_get (settings, name);
@@ -374,13 +374,15 @@
  * See: gnome_scan_settings_get()
  **/
 gchar*
-gnome_scan_settings_get_string (GnomeScanSettings *settings, const gchar *name)
+gnome_scan_settings_get_string (GnomeScanSettings *settings,
+                                const gchar *name)
 {
   g_return_val_if_fail (GNOME_IS_SCAN_SETTINGS (settings), NULL);
   GValue *v = gnome_scan_settings_get_transformed (settings,
 						   name,
 						   G_TYPE_STRING);
   gchar* val = g_value_dup_string (v);
+    g_value_unset(v);
   g_free (v);
   return val;
 }
@@ -397,7 +399,7 @@
  **/
 gdouble
 gnome_scan_settings_get_double (GnomeScanSettings *settings,
-				const gchar *name)
+                                const gchar *name)
 {
   g_return_val_if_fail (GNOME_IS_SCAN_SETTINGS (settings), 0.);
   GValue *v = gnome_scan_settings_get_transformed (settings,
@@ -420,7 +422,7 @@
  **/
 gint
 gnome_scan_settings_get_int (GnomeScanSettings *settings,
-			     const gchar *name)
+                             const gchar *name)
 {
   g_return_val_if_fail (GNOME_IS_SCAN_SETTINGS (settings), 0);
   GValue *v = gnome_scan_settings_get_transformed (settings,

Modified: trunk/lib/gnome-scan-string-widget.c
==============================================================================
--- trunk/lib/gnome-scan-string-widget.c	(original)
+++ trunk/lib/gnome-scan-string-widget.c	Tue Jan 15 17:21:22 2008
@@ -72,6 +72,6 @@
 gssw_activate (GtkEntry *entry, GnomeScanParamWidget *gspw)
 {
 	g_value_set_string (gspw->value,
-						gtk_entry_get_text (entry));
+						g_strdup(gtk_entry_get_text (entry)));
 	gnome_scan_param_widget_changed (gspw);
 }

Modified: trunk/modules/gsane-scanner.c
==============================================================================
--- trunk/modules/gsane-scanner.c	(original)
+++ trunk/modules/gsane-scanner.c	Tue Jan 15 17:21:22 2008
@@ -3,7 +3,7 @@
  *
  * Gnome Scan is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
+ * License as published by the Free Software Foundation; either 
  * version 2.1 of the License, or (at your option) any later version.
  * 
  * gnome-scan is distributed in the hope that it will be useful,
@@ -34,56 +34,56 @@
 
 typedef struct _GSaneScannerPrivate GSaneScannerPrivate;
 typedef	void		(* GSSDataFunc)		(GSaneScanner *sane,
-						 GeglRectangle *rect,
-						 Babl *format,
-						 guchar *buf,
-						 gint len);
+											   GeglRectangle *rect,
+											   Babl *format,
+											   guchar *buf,
+											   gint len);
 struct _GSaneScannerPrivate
 {
-  /* INTERNALS */
-  GThread*		init_thread;
+	/* INTERNALS */
+		GThread*		init_thread;
 	
-  /* SANE */
-  gchar*			sane_id;
-  SANE_Handle		handle;
-	
-  /* Aquisition */
-  SANE_Parameters	params;
-  SANE_Int		data_len;
-  SANE_Int		chunk_len;
-  guint			bytes_read;
-  gchar*		format;
-  GeglBuffer		*buffer;
-  GeglNode		*load;
-  guint			n_frames;
-  guint			frame_no;
-	
-  /* NULL terminated list of MetaParams */
-  GHashTable*	meta_params;
-	
-  /* temp */
-  gboolean reload;
-  gboolean changed;
-  gboolean first;
-  GnomeScanSettings	*settings;
+	/* SANE */
+		gchar*			sane_id;
+	SANE_Handle		handle;
+	
+	/* Aquisition */
+		SANE_Parameters	params;
+	SANE_Int		data_len;
+	SANE_Int		chunk_len;
+	guint			bytes_read;
+	gchar*		format;
+	GeglBuffer		*buffer;
+	GeglNode		*load;
+	guint			n_frames;
+	guint			frame_no;
+	
+	/* NULL terminated list of MetaParams */
+		GHashTable*	meta_params;
+	
+	/* temp */
+		gboolean reload;
+	gboolean changed;
+	gboolean first;
+	GnomeScanSettings	*settings;
 };
 
 enum
-  {
-    PROP_0,
-    PROP_SANE_ID
-  };
+{
+	PROP_0,
+	PROP_SANE_ID
+};
 
 static GnomeScannerClass* parent_class = NULL;
 
 /* PLUGIN API */
 static void		gss_configure		(GnomeScanPlugin *plugin,
-						 GnomeScanSettings *settings);
+										 GnomeScanSettings *settings);
 static GList*		gss_get_child_nodes	(GnomeScanPlugin *plugin,
-						 GeglNode *root);
+											 GeglNode *root);
 static gboolean		gss_start_frame		(GnomeScanPlugin *plugin);
 static gboolean		gss_work		(GnomeScanPlugin *plugin,
-						 gdouble *progress);
+										gdouble *progress);
 static void		gss_end_frame 		(GnomeScanPlugin *plugin);
 
 /* SCANNER API */
@@ -96,24 +96,24 @@
 /* OPTIONS */
 static void		gss_probe_options	(GSaneScanner *sane);
 static void		gss_mp_foreach_option_matches (const gchar *key,
-						       MetaParam *mp,
-						       GPtrArray* arg);
+												  MetaParam *mp,
+												  GPtrArray* arg);
 static void		gss_mp_foreach_add_param (const gchar* key,
-						  MetaParam *mp,
-						  GSaneScanner *sane);
+											 MetaParam *mp,
+											 GSaneScanner *sane);
 
 static void		gss_params_foreach_set_param	(GParamSpec *spec,
-							 GSaneScanner *gss);
+													GSaneScanner *gss);
 static GParamSpec*	gss_option_get_param_spec	(GSaneScanner *sane,
-							 SANE_Int n);
+													SANE_Int n);
 static void		gss_params_foreach_update_param (GParamSpec *pspec,
-							 GSaneScanner *gss);
+													GSaneScanner *gss);
 static void		gss_option_set_default_value_by_index (GSaneScanner *gss,
-							       SANE_Int n,
-							       GType type);
+														  SANE_Int n,
+														  GType type);
 static GValue*		gss_option_get_value_by_index	(GSaneScanner *sane,
-							 SANE_Int n,
-							 GType type);
+														SANE_Int n,
+														GType type);
 
 /* utils */
 #define	gss_option_name_matches_array(spec,names)	gsane_str_matches_strv(g_param_spec_get_name(spec),names)
@@ -127,240 +127,240 @@
 static GObject*
 gsane_scanner_constructor(GType type, guint n, GObjectConstructParam *params)
 {
-  GObject *object =
-    G_OBJECT_CLASS(parent_class)->constructor(type, n, params);
-  GError *error = NULL;
-
-  GSaneScannerPrivate *priv = GET_PRIVATE(object);
-  SANE_Status status;
-	
-  status = sane_open (priv->sane_id, &(priv->handle));
-
-  if (status != SANE_STATUS_GOOD) {
-    g_warning ("Unable to open device %s (%s) : %s",
-	       gnome_scan_plugin_get_name (GNOME_SCAN_PLUGIN (object)),
-	       priv->sane_id, sane_strstatus (status));
-    return NULL;
-  }
-
-  /* Since the use needs to select the scanner before showing options, we can
-     do the probe in a seperate thread, this will quicken the probe, while the user
-     choose the device. */
-  priv->init_thread =  g_thread_create((GThreadFunc) gss_init,
-				       GSANE_SCANNER(object),
-				       TRUE, &error);
+	GObject *object =
+		G_OBJECT_CLASS(parent_class)->constructor(type, n, params);
+	GError *error = NULL;
+	
+	GSaneScannerPrivate *priv = GET_PRIVATE(object);
+	SANE_Status status;
+	
+	status = sane_open (priv->sane_id, &(priv->handle));
+	
+	if (status != SANE_STATUS_GOOD) {
+		g_warning ("Unable to open device %s (%s) : %s",
+				   gnome_scan_plugin_get_name (GNOME_SCAN_PLUGIN (object)),
+				   priv->sane_id, sane_strstatus (status));
+		return NULL;
+	}
+	
+	/* Since the use needs to select the scanner before showing options, we can
+		do the probe in a seperate thread, this will quicken the probe, while the user
+		choose the device. */
+		priv->init_thread =  g_thread_create((GThreadFunc) gss_init,
+											 GSANE_SCANNER(object),
+											 TRUE, &error);
 	
-  return object;
+	return object;
 }
 
 static void
 gsane_scanner_init (GSaneScanner *object)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (object);
-  priv->meta_params = g_hash_table_new (g_str_hash,
-					g_str_equal);
+	GSaneScannerPrivate *priv = GET_PRIVATE (object);
+	priv->meta_params = g_hash_table_new (g_str_hash,
+										  g_str_equal);
 }
 
 static void
 gsane_scanner_finalize (GObject *object)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (object);
+	GSaneScannerPrivate *priv = GET_PRIVATE (object);
 	
-  if (priv->init_thread) {
-    g_thread_join (priv->init_thread);
-  }
+	if (priv->init_thread) {
+		g_thread_join (priv->init_thread);
+	}
 	
-  g_hash_table_destroy (priv->meta_params);
-  sane_close(priv->handle);
+	g_hash_table_destroy (priv->meta_params);
+	sane_close(priv->handle);
 	
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
 gsane_scanner_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
-  g_return_if_fail (GNOME_IS_SCANNER_SANE (object));
-
-  switch (prop_id)
-    {
-    case PROP_SANE_ID:
-      GET_PRIVATE (object)->sane_id = g_value_dup_string(value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-    }
+	g_return_if_fail (GNOME_IS_SCANNER_SANE (object));
+	
+	switch (prop_id)
+	{
+		case PROP_SANE_ID:
+			GET_PRIVATE (object)->sane_id = g_value_dup_string(value);
+		break;
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
 }
 
 #if 0
 static void
 gsane_scanner_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 {
-  g_return_if_fail (GNOME_IS_SCANNER_SANE (object));
-
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-    }
+	g_return_if_fail (GNOME_IS_SCANNER_SANE (object));
+	
+	switch (prop_id)
+	{
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
 }
 #endif
 
 static void
 gsane_scanner_class_init (GSaneScannerClass *klass)
 {
-  GObjectClass* object_class = G_OBJECT_CLASS (klass);
-  parent_class = GNOME_SCANNER_CLASS (g_type_class_peek_parent (klass));
-  GnomeScanPluginClass* plugin_class = GNOME_SCAN_PLUGIN_CLASS (klass);
-  GnomeScannerClass* scanner_class = GNOME_SCANNER_CLASS (klass);
-	
-  g_type_class_add_private(object_class, sizeof(GSaneScannerPrivate));
-	
-  object_class->constructor	= gsane_scanner_constructor;
-  object_class->set_property	= gsane_scanner_set_property;
-	
-  plugin_class->configure 	= gss_configure;
-  plugin_class->get_child_nodes	= gss_get_child_nodes;
-  plugin_class->start_frame	= gss_start_frame;
-  plugin_class->work			= gss_work;
-  plugin_class->end_frame	= gss_end_frame;
-	
-  scanner_class->get_output_format	= gss_get_output_format;
-  object_class->finalize = gsane_scanner_finalize;
-	
-  g_object_class_install_property (object_class,
-				   PROP_SANE_ID,
-				   g_param_spec_string ("sane-id",
-							"SANE id",
-							"SANE device identifier",
-							"",
-							G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+	GObjectClass* object_class = G_OBJECT_CLASS (klass);
+	parent_class = GNOME_SCANNER_CLASS (g_type_class_peek_parent (klass));
+	GnomeScanPluginClass* plugin_class = GNOME_SCAN_PLUGIN_CLASS (klass);
+	GnomeScannerClass* scanner_class = GNOME_SCANNER_CLASS (klass);
+	
+	g_type_class_add_private(object_class, sizeof(GSaneScannerPrivate));
+	
+	object_class->constructor	= gsane_scanner_constructor;
+	object_class->set_property	= gsane_scanner_set_property;
+	
+	plugin_class->configure 	= gss_configure;
+	plugin_class->get_child_nodes	= gss_get_child_nodes;
+	plugin_class->start_frame	= gss_start_frame;
+	plugin_class->work			= gss_work;
+	plugin_class->end_frame	= gss_end_frame;
+	
+	scanner_class->get_output_format	= gss_get_output_format;
+	object_class->finalize = gsane_scanner_finalize;
+	
+	g_object_class_install_property (object_class,
+									 PROP_SANE_ID,
+									 g_param_spec_string ("sane-id",
+														  "SANE id",
+														  "SANE device identifier",
+														  "",
+														  G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 }
 
 
 GnomeScanner*
 gsane_scanner_new (const SANE_Device *device)
 {
-  GObject *object =
-    g_object_new (GSANE_TYPE_SCANNER,
-		  "name", g_strconcat(device->vendor, " ", device->model, NULL),
-		  "blurb", "",
-		  "icon-name", "scanner",
-		  "sane-id", device->name,
-		  NULL);
-  return GNOME_SCANNER (object);
+	GObject *object =
+		g_object_new (GSANE_TYPE_SCANNER,
+					  "name", g_strconcat(device->vendor, " ", device->model, NULL),
+					  "blurb", "",
+					  "icon-name", "scanner",
+					  "sane-id", device->name,
+					  NULL);
+	return GNOME_SCANNER (object);
 }
 
 /* PLUGIN API */
 
 static void
 gss_configure	(GnomeScanPlugin *plugin,
-		 GnomeScanSettings *settings)
+				  GnomeScanSettings *settings)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (plugin);
+	GSaneScannerPrivate *priv = GET_PRIVATE (plugin);
 	
-  priv->settings	= settings;
-  priv->first		= TRUE;
-
-  gnome_scan_plugin_params_foreach (plugin,
-				    (GFunc) gss_params_foreach_set_param,
-				    GSANE_SCANNER (plugin));
-	
-  if (priv->reload) {
-    gnome_scan_plugin_params_foreach (plugin,
-				      (GFunc) gss_params_foreach_update_param,
-				      GSANE_SCANNER (plugin));
-    priv->reload = FALSE;
-  }
-  priv->settings = NULL;
+	priv->settings	= settings;
+	priv->first		= TRUE;
+	
+	gnome_scan_plugin_params_foreach (plugin,
+									  (GFunc) gss_params_foreach_set_param,
+									  GSANE_SCANNER (plugin));
+	
+	if (priv->reload) {
+		gnome_scan_plugin_params_foreach (plugin,
+										  (GFunc) gss_params_foreach_update_param,
+										  GSANE_SCANNER (plugin));
+		priv->reload = FALSE;
+	}
+	priv->settings = NULL;
 }
 
 static GList*
 gss_get_child_nodes (GnomeScanPlugin *plugin,
-		     GeglNode *root)
+					 GeglNode *root)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (plugin);
-  GList* list = NULL;
-
-  priv->load = gegl_node_new_child (root,
-				    "operation", "load-buffer",
-				    "buffer", priv->buffer,
-				    NULL);
-  list = g_list_append (list, priv->load);
-  return list;
+	GSaneScannerPrivate *priv = GET_PRIVATE (plugin);
+	GList* list = NULL;
+	
+	priv->load = gegl_node_new_child (root,
+									  "operation", "load-buffer",
+									  "buffer", priv->buffer,
+									  NULL);
+	list = g_list_append (list, priv->load);
+	return list;
 }
 
 static gboolean
 gss_sane_start (GSaneScanner *gss)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  SANE_Status status;
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	SANE_Status status;
 	
-  status = sane_start (priv->handle);
-  if (status != SANE_STATUS_GOOD) {
-    g_debug (G_STRLOC ": %s", sane_strstatus (status));
-    return FALSE;
-  }
-	
-  status = sane_get_parameters (priv->handle, &priv->params);
-  if (status != SANE_STATUS_GOOD) {
-    g_debug (G_STRLOC ": %s", sane_strstatus (status));
-    return FALSE;
-  }
+	status = sane_start (priv->handle);
+	if (status != SANE_STATUS_GOOD) {
+		g_debug (G_STRLOC ": %s", sane_strstatus (status));
+		return FALSE;
+	}
+	
+	status = sane_get_parameters (priv->handle, &priv->params);
+	if (status != SANE_STATUS_GOOD) {
+		g_debug (G_STRLOC ": %s", sane_strstatus (status));
+		return FALSE;
+	}
 	
-  priv->bytes_read = 0;
-  priv->frame_no++;
+	priv->bytes_read = 0;
+	priv->frame_no++;
 	
-  return TRUE;
+	return TRUE;
 }
 
 static gboolean
 gss_start_frame	(GnomeScanPlugin *plugin)
 {
-  GSaneScanner *gss = GSANE_SCANNER (plugin);
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  gboolean first = priv->first;
-  Babl *format;
-  gchar *fmt;
-	
-  priv->bytes_read = 0;
-  priv->frame_no = 0;
-	
-  if (first || gss->adf) {
-    if (!gss_sane_start (gss))
-      return FALSE;
+	GSaneScanner *gss = GSANE_SCANNER (plugin);
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	gboolean first = priv->first;
+	Babl *format;
+	gchar *fmt;
+	
+	priv->bytes_read = 0;
+	priv->frame_no = 0;
+	
+	if (first || gss->adf) {
+		if (!gss_sane_start (gss))
+			return FALSE;
 		
-    priv->format = fmt = g_strdup_printf("%s u%i",
-					 priv->params.format == SANE_FRAME_GRAY ? "Y" : "RGB",
-					 MAX(8, priv->params.depth));
-    format = babl_format(fmt);
+		priv->format = fmt = g_strdup_printf("%s u%i",
+											 priv->params.format == SANE_FRAME_GRAY ? "Y" : "RGB",
+											 MAX(8, priv->params.depth));
+		format = babl_format(fmt);
 		
-    priv->chunk_len = priv->params.bytes_per_line;
-    priv->data_len	= priv->params.bytes_per_line * priv->params.lines;
-    priv->n_frames = 3;
-
-    GeglRectangle extent = {0, 0, priv->params.pixels_per_line, priv->params.lines};
-    priv->buffer = gegl_buffer_new (&extent, format);
-
-    g_debug (G_STRLOC ": buffer is %p in format %s",
-	     priv->buffer, fmt);
-
-    gegl_node_set (priv->load,
-		   "buffer", priv->buffer,
-		   NULL);
+		priv->chunk_len = priv->params.bytes_per_line;
+		priv->data_len	= priv->params.bytes_per_line * priv->params.lines;
+		priv->n_frames = 3;
 		
-    priv->first = FALSE;
-    return TRUE;
-  }
+		GeglRectangle extent = {0, 0, priv->params.pixels_per_line, priv->params.lines};
+		priv->buffer = gegl_buffer_new (&extent, format);
+		
+		g_debug (G_STRLOC ": buffer is %p in format %s",
+				 priv->buffer, fmt);
+		
+		gegl_node_set (priv->load,
+					   "buffer", priv->buffer,
+					   NULL);
+		
+		priv->first = FALSE;
+		return TRUE;
+	}
 	
-  return FALSE;
+	return FALSE;
 }
 
 const gchar*
 gss_get_output_format	(GnomeScanner *scanner)
 {
-  return GET_PRIVATE (scanner)->format;
+	return GET_PRIVATE (scanner)->format;
 }
 
 
@@ -373,12 +373,12 @@
 gchar*
 byte_to_string (guchar bt)
 {
-  guint i;
-  gchar *s = g_new0(gchar, 9);
-  for (i = 0; i < 8; i++) {
-    sprintf(s, "%s%i", s, (bt & (1<<(7-i))) ? 1 : 0);
-  }
-  return s;
+	guint i;
+	gchar *s = g_new0(gchar, 9);
+	for (i = 0; i < 8; i++) {
+		sprintf(s, "%s%i", s, (bt & (1<<(7-i))) ? 1 : 0);
+	}
+	return s;
 }
 #endif
 
@@ -387,248 +387,231 @@
 static void
 gss_data_color1 (GSaneScanner *gss, GeglRectangle *rect, Babl* format, guchar *buf, gint len)
 {
-  guint i, tlen;
-  guchar *tbuf, mask, val;
+	guint i, tlen;
+	guchar *tbuf, mask, val;
 	
-  tlen = len * 8;
-  tbuf = g_new0 (guchar, tlen);
-  /* we loop each bit */
-  for (i = 0; i < tlen; i++) {
-    val = buf[i/8]; /* get the byte containing the inth bit */
-    mask = (0x80 >> (i%8)); /* first bit is the MSB */
-    tbuf[i] = (val & mask) ? 0xFF : 0x00;
-		
-    /* for extended debugging */
-#define DGB 0
-		
-#if DGB
-    guint j, t, x, y;
-    gchar comp;
-    gchar *o0, *o1;
-    t = ((priv->bytes_read*8+i)/3);
-    x = rect->x + i/3;
-    y = rect->y;
-    switch (i%3) {
-    case 0:
-      comp = 'R';
-      break;
-    case 1:
-      comp = 'G';
-      break;
-    case 2:
-      comp = 'B';
-      break;
-    }
-    o0 = byte_to_string(val);
-    o1 = byte_to_string (mask);
-    g_debug ("(%i,%i) %c =  %s & %s = %x; ",
-	     x, y, comp, o0, o1, tbuf[i]);
-    g_free (o0);
-    g_free (o1);
-#endif
-  }
-  gegl_buffer_set (GET_PRIVATE (gss)->buffer,
-		   rect,
-		   format,
-		   tbuf);
-  g_free (tbuf);
-
-#if DGB
-  exit(0);
-#endif
+	tlen = len * 8;
+	tbuf = g_new0 (guchar, tlen);
+	/* we loop each bit */
+		for (i = 0; i < tlen; i++) {
+			/* get the byte containing the inth bit */
+			val = buf[i/8];
+			/* first bit is the MSB */
+			mask = (0x80 >> (i%8));
+			tbuf[i] = (val & mask) ? 0xFF : 0x00;
+		}
+	gegl_buffer_set (GET_PRIVATE (gss)->buffer,
+					 rect,
+					 format,
+					 tbuf,
+					 GEGL_AUTO_ROWSTRIDE);
+	g_free (tbuf);
 }
-				
+
 
 /* process 8/16 bit RGB in to â 8/16 bit RGB */
 static void
 gss_data_color (GSaneScanner *gss,
-		GeglRectangle *rect,
-		Babl* format,
-		guchar* buf,
-		gint len)
-{
-  gegl_buffer_set (GET_PRIVATE (gss)->buffer,
-		   rect,
-		   format,
-		   buf);
+				GeglRectangle *rect,
+				Babl* format,
+				guchar* buf,
+				gint len)
+{
+	gegl_buffer_set (GET_PRIVATE (gss)->buffer,
+					 rect,
+					 format,
+					 buf,
+					 GEGL_AUTO_ROWSTRIDE);
 }
 
 /* process 1 bit RGB into RGB 8bit */
 static void
-gss_data_color1_three_pass (GSaneScanner *gss, GeglRectangle *rect, Babl* format, guchar *buf, gint len)
-{
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  guchar *tbuf;
-  guint i, offset = 0, tlen = len * 8;
-  guchar mask;
-	
-  switch (priv->params.format) {
-  case SANE_FRAME_RED:
-    offset = 0;
-    break;
-  case SANE_FRAME_GREEN:
-    offset = 1;;
-    break;
-  case SANE_FRAME_BLUE:
-    offset = 2;;
-    break;
-  default:
-    break;
-  }
-	
-  tbuf = g_new0 (guchar, tlen * 3);
-  gegl_buffer_get (priv->buffer, 1., rect, format, tbuf, GEGL_AUTO_ROWSTRIDE);
-  for (i = 0; i < tlen; i++) {
-    mask = 0x80 >> (i%8);
-    tbuf[i*3+offset] = (buf[i/8] & mask) ? 0xFF : 0x00;
-  }
-  gegl_buffer_set (priv->buffer, rect, format, tbuf);
-  g_free (tbuf);
+gss_data_color1_three_pass (GSaneScanner *gss,
+							GeglRectangle *rect,
+							Babl* format,
+							guchar *buf,
+							gint len)
+{
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	guchar *tbuf;
+	guint i, offset = 0, tlen = len * 8;
+	guchar mask;
+	
+	switch (priv->params.format) {
+		case SANE_FRAME_RED:
+			offset = 0;
+		break;
+		case SANE_FRAME_GREEN:
+			offset = 1;;
+		break;
+		case SANE_FRAME_BLUE:
+			offset = 2;;
+		break;
+		default:
+			break;
+	}
+	
+	tbuf = g_new0 (guchar, tlen * 3);
+	gegl_buffer_get (priv->buffer, 1., rect, format, tbuf, GEGL_AUTO_ROWSTRIDE);
+	for (i = 0; i < tlen; i++) {
+		mask = 0x80 >> (i%8);
+		tbuf[i*3+offset] = (buf[i/8] & mask) ? 0xFF : 0x00;
+	}
+	gegl_buffer_set (priv->buffer, rect, format, tbuf,
+					 GEGL_AUTO_ROWSTRIDE);
+	g_free (tbuf);
 }
 
 /* 8/16 bit three pass RGB */
 static void
-gss_data_color_three_pass (GSaneScanner *gss, GeglRectangle *rect, Babl* format, guchar* buf, gint len)
-{
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  guchar *tbuf;
-  guint i, offset = 0, px_stride, sp_stride;
-
-	
-  /* sample stride */
-  sp_stride = priv->params.depth/8;
-  px_stride = 3 * sp_stride;
-	
-  switch (priv->params.format) {
-  case SANE_FRAME_RED:
-    offset = 0;
-    break;
-  case SANE_FRAME_GREEN:
-    offset = 1;
-    break;
-  case SANE_FRAME_BLUE:
-    offset = 2;
-    break;
-  default:
-    break;
-  }
-  offset*= sp_stride;
-	
-  tbuf = g_new0 (guchar, len*3);
-  gegl_buffer_get (priv->buffer, 1., rect, NULL, tbuf, GEGL_AUTO_ROWSTRIDE);
-	
-  for (i = 0; i < len/sp_stride; i++) {
-    /* copy 1 or 2 bytes of sample at the right place */
-    memcpy(tbuf+i*px_stride+offset, buf+i*sp_stride, sp_stride);
-  }
+gss_data_color_three_pass (GSaneScanner *gss,
+						   GeglRectangle *rect,
+						   Babl* format,
+						   guchar* buf,
+						   gint len)
+{
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	guchar *tbuf;
+	guint i, offset = 0, px_stride, sp_stride;
+	
+	
+	/* sample stride */
+		sp_stride = priv->params.depth/8;
+	px_stride = 3 * sp_stride;
+	
+	switch (priv->params.format) {
+		case SANE_FRAME_RED:
+			offset = 0;
+		break;
+		case SANE_FRAME_GREEN:
+			offset = 1;
+		break;
+		case SANE_FRAME_BLUE:
+			offset = 2;
+		break;
+		default:
+			break;
+	}
+	offset*= sp_stride;
 	
-  gegl_buffer_set (priv->buffer, rect, NULL, tbuf);
-  g_free (tbuf);
+	tbuf = g_new0 (guchar, len*3);
+	gegl_buffer_get (priv->buffer, 1., rect, NULL, tbuf, GEGL_AUTO_ROWSTRIDE);
+	
+	for (i = 0; i < len/sp_stride; i++) {
+		/* copy 1 or 2 bytes of sample at the right place */
+			memcpy(tbuf+i*px_stride+offset, buf+i*sp_stride, sp_stride);
+	}
+	
+	gegl_buffer_set (priv->buffer, rect, NULL, tbuf,
+					 GEGL_AUTO_ROWSTRIDE);
+	g_free (tbuf);
 }
 
 /* Black&White */
 static void
 gss_data_gray1 (GSaneScanner *gss, GeglRectangle *rect, Babl* format, guchar* buf, gint len)
 {
-  guchar *tbuf;
-  guint i, tlen;
-  guchar mask;
-	
-  tlen = 8 * len;
-  tbuf = g_new0 (guchar, tlen);
-  for (i = 0; i < tlen; i++) {
-    mask = 0x80 >> (i%8);
-    tbuf[i] = (buf[i/8] & mask) ? 0xFF : 0x00;
-  }
-  gegl_buffer_set (GET_PRIVATE (gss)->buffer, rect, format, tbuf);
-  g_free (tbuf);
+	guchar *tbuf;
+	guint i, tlen;
+	guchar mask;
+	
+	tlen = 8 * len;
+	tbuf = g_new0 (guchar, tlen);
+	for (i = 0; i < tlen; i++) {
+		mask = 0x80 >> (i%8);
+		tbuf[i] = (buf[i/8] & mask) ? 0xFF : 0x00;
+	}
+	gegl_buffer_set (GET_PRIVATE (gss)->buffer, rect, format, tbuf,
+					 GEGL_AUTO_ROWSTRIDE);
+	g_free (tbuf);
 }
 
 /* 8/16 bit gray */
 static void
 gss_data_gray (GSaneScanner *gss, GeglRectangle *rect, Babl* format, guchar* buf, gint len)
 {
-  gegl_buffer_set (GET_PRIVATE (gss)->buffer, rect, format, buf);
+	gegl_buffer_set (GET_PRIVATE (gss)->buffer, rect, format, buf,
+					 GEGL_AUTO_ROWSTRIDE);
 }
 
 
 static gboolean
 gss_work (GnomeScanPlugin *plugin, gdouble *progress)
 {
-  GSaneScanner *gss = GSANE_SCANNER (plugin);
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  GeglRectangle rect;
-  SANE_Status status;
-  Babl* format;
-  SANE_Byte *buf;
-  SANE_Int len;
-  GSSDataFunc processor = NULL;
-	
-  buf = g_new0 (SANE_Byte, priv->chunk_len);
-  status = sane_read (priv->handle, buf, priv->chunk_len, &len);
-	
-  /* start new frame for three pass acquisition */
-  if (status == SANE_STATUS_EOF && !priv->params.last_frame) {
-    g_free (buf);
-    return gss_sane_start (gss);
-  }
-	
-  /* EOF, NO_DOCS, errors â */
-  if (status != SANE_STATUS_GOOD) {
-    gs_debug (G_STRLOC ": %s", sane_strstatus (status));
-    g_free (buf);
-    return FALSE;
-  }
-	
-  /* determine which function to call */
-  switch (priv->params.format) {
-  case SANE_FRAME_RGB:
-    processor = priv->params.depth == 1 ? gss_data_color1 : gss_data_color;
-    priv->n_frames = 1;
-    break;
-  case SANE_FRAME_RED:
-  case SANE_FRAME_GREEN:
-  case SANE_FRAME_BLUE:
-    processor = (priv->params.depth == 1) ? gss_data_color1_three_pass : gss_data_color_three_pass;
-    break;
-  case SANE_FRAME_GRAY:
-    processor = (priv->params.depth == 1) ? gss_data_gray1 : gss_data_gray;
-    break;
-  default:
-    g_warning ("Frame format not supported");
-    return FALSE;
-    break;
-  }
-	
-  rect.x	= priv->bytes_read % priv->params.bytes_per_line;
-  rect.y	= priv->bytes_read / priv->params.bytes_per_line;
-  rect.height	= len / priv->params.bytes_per_line;
-  rect.width	= priv->params.pixels_per_line;
-	
-  g_object_get (priv->buffer, "format", &format, NULL);
-	
-  if (processor)
-    processor(gss, &rect, format, buf, len);
-	
-  g_free (buf);
-  priv->bytes_read+= len;
-	
-  /* This very complex formula compute the right progress over one or three frame */
-  *progress = ((gdouble) priv->frame_no-1) * (1./(gdouble) priv->n_frames) + ((gdouble) priv->bytes_read / (gdouble) priv->data_len) / (gdouble) priv->n_frames;
-  return TRUE;
+	GSaneScanner *gss = GSANE_SCANNER (plugin);
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	GeglRectangle rect;
+	SANE_Status status;
+	Babl* format;
+	SANE_Byte *buf;
+	SANE_Int len;
+	GSSDataFunc processor = NULL;
+	
+	buf = g_new0 (SANE_Byte, priv->chunk_len);
+	status = sane_read (priv->handle, buf, priv->chunk_len, &len);
+	
+	/* start new frame for three pass acquisition */
+		if (status == SANE_STATUS_EOF && !priv->params.last_frame) {
+			g_free (buf);
+			return gss_sane_start (gss);
+		}
+	
+	/* EOF, NO_DOCS, errors â */
+		if (status != SANE_STATUS_GOOD) {
+			gs_debug (G_STRLOC ": %s", sane_strstatus (status));
+			g_free (buf);
+			return FALSE;
+		}
+	
+	/* determine which function to call */
+		switch (priv->params.format) {
+			case SANE_FRAME_RGB:
+				processor = priv->params.depth == 1 ? gss_data_color1 : gss_data_color;
+			priv->n_frames = 1;
+			break;
+			case SANE_FRAME_RED:
+				case SANE_FRAME_GREEN:
+				case SANE_FRAME_BLUE:
+				processor = (priv->params.depth == 1) ? gss_data_color1_three_pass : gss_data_color_three_pass;
+			break;
+			case SANE_FRAME_GRAY:
+				processor = (priv->params.depth == 1) ? gss_data_gray1 : gss_data_gray;
+			break;
+			default:
+				g_warning ("Frame format not supported");
+			return FALSE;
+			break;
+		}
+	
+	rect.x	= priv->bytes_read % priv->params.bytes_per_line;
+	rect.y	= priv->bytes_read / priv->params.bytes_per_line;
+	rect.height	= len / priv->params.bytes_per_line;
+	rect.width	= priv->params.pixels_per_line;
+	
+	g_object_get (priv->buffer, "format", &format, NULL);
+	
+	if (processor)
+		processor(gss, &rect, format, buf, len);
+	
+	g_free (buf);
+	priv->bytes_read+= len;
+	
+	/* This very complex formula compute the right progress over one or three frame */
+		*progress = ((gdouble) priv->frame_no-1) * (1./(gdouble) priv->n_frames) + ((gdouble) priv->bytes_read / (gdouble) priv->data_len) / (gdouble) priv->n_frames;
+	return TRUE;
 }
 
 static void
 gss_end_frame (GnomeScanPlugin *plugin)
 {
-  GSaneScanner *gss = GSANE_SCANNER (plugin);
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  sane_cancel (priv->handle);
-  g_object_unref (priv->buffer);
-  g_free (priv->format);
-  priv->format = NULL;
-
-  priv->buffer = NULL;
+	GSaneScanner *gss = GSANE_SCANNER (plugin);
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	sane_cancel (priv->handle);
+	g_object_unref (priv->buffer);
+	g_free (priv->format);
+	priv->format = NULL;
+	
+	priv->buffer = NULL;
 }
 
 
@@ -640,563 +623,563 @@
 static void
 gss_init	(GSaneScanner *gss)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  MetaParam *mp;
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	MetaParam *mp;
 	
-  /* declare MetaParams */
+	/* declare MetaParams */
 #define	gss_mp_new(name, gss)	mp = meta_param_##name(gss);		\
-  g_hash_table_insert (priv->meta_params, meta_param_get_name (mp), mp)
-	
-  gss_mp_new(paper_size, gss);
-  gss_mp_new(source, gss);
+g_hash_table_insert (priv->meta_params, meta_param_get_name (mp), mp)
+		
+		gss_mp_new(paper_size, gss);
+	gss_mp_new(source, gss);
 	
 #undef gss_mp_new
 	
-  /* launch options probe */
-  gss_probe_options (gss);
+	/* launch options probe */
+		gss_probe_options (gss);
 }
 
 static void
 gss_probe_options(GSaneScanner *gss)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  GParamSpec *spec;
-  GPtrArray *arg = g_ptr_array_sized_new (3);
-  GValue *value;
-  MetaParam *mp = NULL;
-  gint n, i;
-  static const gchar*front_option_names[] = {
-    "resolution",
-    "source",
-    "mode",
-    NULL
-  };
-  static const gchar*hidden_options[] = {
-    "preview",
-    NULL
-  };
-	
-  gnome_scanner_set_status (GNOME_SCANNER (gss),
-			    GNOME_SCANNER_BUSY);
-	
-  spec = gss_option_get_param_spec (gss, 0);
-  value = gsane_scanner_option_get_value(gss, spec);
-  n = g_value_get_int (value);
-	
-  gs_debug(" === Device %s (%d options) ===",
-	   gnome_scan_plugin_get_name(GNOME_SCAN_PLUGIN(gss)), n);
-	
-  g_ptr_array_add (arg, gss);
-  g_ptr_array_add (arg, &mp);
-	
-  /* loop each sane option */
-  for (i = 1; i < n; i++) {
-    /* get corresponding spec */
-    spec = gss_option_get_param_spec(gss, i);
-    if (spec) {
-      /* override group for front options */
-      if (gss_option_name_matches_array (spec, front_option_names)) {
-	gs_param_spec_set_group (spec, GS_PARAM_GROUP_SCANNER_FRONT);
-      }
-			
-      if (gss_option_name_matches_array (spec, hidden_options)) {
-	gs_param_spec_set_group (spec, GS_PARAM_GROUP_HIDDEN);
-      }
-			
-			
-      /* search if this option does not belong to a MetaParam */
-      mp = NULL;
-      g_ptr_array_add (arg, spec);
-      g_hash_table_foreach (priv->meta_params,
-			    (GHFunc) gss_mp_foreach_option_matches,
-			    arg);
-      g_ptr_array_remove (arg, spec);
-			
-      if (mp)
-	meta_param_add_params (mp, spec);
-      /* or add directly to scanner */
-      else 
-	gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (gss), spec);
-    }
-  }
-
-  /* now ask each MetaParam to add its param to the scanner */
-  g_hash_table_foreach (priv->meta_params,
-			(GHFunc) gss_mp_foreach_add_param,
-			gss);
-  gs_debug ("\n");
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	GParamSpec *spec;
+	GPtrArray *arg = g_ptr_array_sized_new (3);
+	GValue *value;
+	MetaParam *mp = NULL;
+	gint n, i;
+	static const gchar*front_option_names[] = {
+		"resolution",
+		"source",
+		"mode",
+		NULL
+	};
+	static const gchar*hidden_options[] = {
+		"preview",
+		NULL
+	};
+	
+	gnome_scanner_set_status (GNOME_SCANNER (gss),
+							  GNOME_SCANNER_BUSY);
+	
+	spec = gss_option_get_param_spec (gss, 0);
+	value = gsane_scanner_option_get_value(gss, spec);
+	n = g_value_get_int (value);
+	
+	gs_debug(" === Device %s (%d options) ===",
+			 gnome_scan_plugin_get_name(GNOME_SCAN_PLUGIN(gss)), n);
+	
+	g_ptr_array_add (arg, gss);
+	g_ptr_array_add (arg, &mp);
+	
+	/* loop each sane option */
+		for (i = 1; i < n; i++) {
+			/* get corresponding spec */
+				spec = gss_option_get_param_spec(gss, i);
+			if (spec) {
+				/* override group for front options */
+					if (gss_option_name_matches_array (spec, front_option_names)) {
+						gs_param_spec_set_group (spec, GS_PARAM_GROUP_SCANNER_FRONT);
+					}
+				
+				if (gss_option_name_matches_array (spec, hidden_options)) {
+					gs_param_spec_set_group (spec, GS_PARAM_GROUP_HIDDEN);
+				}
+				
+				
+				/* search if this option does not belong to a MetaParam */
+					mp = NULL;
+				g_ptr_array_add (arg, spec);
+				g_hash_table_foreach (priv->meta_params,
+									  (GHFunc) gss_mp_foreach_option_matches,
+									  arg);
+				g_ptr_array_remove (arg, spec);
+				
+				if (mp)
+					meta_param_add_params (mp, spec);
+				/* or add directly to scanner */
+					else 
+					gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (gss), spec);
+			}
+		}
+	
+	/* now ask each MetaParam to add its param to the scanner */
+		g_hash_table_foreach (priv->meta_params,
+							  (GHFunc) gss_mp_foreach_add_param,
+							  gss);
+	gs_debug ("\n");
 	
 	
 	
-  gnome_scanner_set_status (GNOME_SCANNER (gss), GNOME_SCANNER_READY);
-  if (priv->changed) {
-    gnome_scanner_settings_changed (GNOME_SCANNER (gss));
-    priv->changed = FALSE;
-  }
+	gnome_scanner_set_status (GNOME_SCANNER (gss), GNOME_SCANNER_READY);
+	if (priv->changed) {
+		gnome_scanner_settings_changed (GNOME_SCANNER (gss));
+		priv->changed = FALSE;
+	}
 	
-  g_thread_exit (NULL);
+	g_thread_exit (NULL);
 }
 
 
 static GParamSpec*
 gss_option_get_param_spec (GSaneScanner *gss, SANE_Int n)
 {
-  static GQuark group;
-  static gint unnamed = 0;
+	static GQuark group;
+	static gint unnamed = 0;
 	
-  GSaneScannerPrivate *priv = GET_PRIVATE(gss);
-  GParamSpec *spec = NULL;
-  GValue *default_value = NULL, *value, *vmin, *vmax, *vstep;
-  GValueArray *values;
-  GType type = G_TYPE_INVALID;
-  GType spec_type = G_TYPE_INVALID;
-  gchar *constraint, *name, *sflags;
-  gint i, m;
-  guint flags = 0, unit;
-  GEnumClass *enumclass;
-  GEnumValue *enumvalue;
-  const SANE_Option_Descriptor *desc;
-	
-  desc = sane_get_option_descriptor(priv->handle, n);
-	
-  /* FLAG */
-  sflags = "";
-  if (SANE_OPTION_IS_ACTIVE (desc->cap)) {
-    flags = flags | G_PARAM_WRITABLE;
-    sflags = "writable";
-  }
-	
-  /* UNIT */
-  switch (desc->unit) {
-  case SANE_UNIT_PIXEL:
-    unit = GS_UNIT_PIXEL;
-    break;
-  case SANE_UNIT_BIT:
-    unit = GS_UNIT_BIT;
-    break;
-  case SANE_UNIT_MM:
-    unit = GS_UNIT_MM;
-    break;
-  case SANE_UNIT_DPI:
-    unit = GS_UNIT_DPI;
-    break;
-  case SANE_UNIT_PERCENT:
-    unit = GS_UNIT_PERCENT;
-    break;
-  case SANE_UNIT_MICROSECOND:
-    unit = GS_UNIT_PERCENT;
-    break;
-  case SANE_UNIT_NONE:
-  default:
-    unit = GS_UNIT_NONE;
-    break;
-  }
-	
-  enumclass = g_type_class_ref (GNOME_TYPE_SCAN_UNIT);
-  enumvalue = g_enum_get_value (enumclass, unit);
-  g_type_class_unref (enumclass);
-	
-  /* VALUE TYPE*/
-  switch (desc->type) {
-  case SANE_TYPE_BOOL:
-    type = G_TYPE_BOOLEAN;
-    break;
-  case SANE_TYPE_INT:
-    type = G_TYPE_INT;
-    break;
-  case SANE_TYPE_FIXED:
-    type = G_TYPE_DOUBLE;
-    break;
-  case SANE_TYPE_STRING:
-    type = G_TYPE_STRING;
-    break;
-  case SANE_TYPE_GROUP:
-    group = g_quark_from_string(desc->title);
-    gs_debug ("\n");
-    gs_debug (" -- Group ÂÂ%sÂÂ --", desc->title);
-    type = G_TYPE_NONE;
-    return NULL;
-    break;
-  case SANE_TYPE_BUTTON:
-    gs_debug("// button : %s (%s)", desc->title, desc->desc);
-    type = G_TYPE_NONE;
-    return NULL;
-    break;
-  }
-	
-  name = g_utf8_strlen(desc->name, 32) < 1 ?
-    g_strdup_printf("option-%i", unnamed++)
-    : g_strdup (desc->name);
-	
-  if (desc->cap & SANE_CAP_HARD_SELECT) {
-    gs_debug ("/!\\ IGNORING BUTTON %s !", name);
-    return NULL;
-  }
-	
-	
-  /* SPEC_TYPE */
-  switch (desc->constraint_type) {
-    /* RANGE */
-  case SANE_CONSTRAINT_RANGE:
-    spec_type = GS_TYPE_PARAM_RANGE;
-    break;
-		
-    /* ENUM */
-  case SANE_CONSTRAINT_WORD_LIST:
-  case SANE_CONSTRAINT_STRING_LIST:
-    spec_type = GS_TYPE_PARAM_ENUM;
-    break;
-  case SANE_CONSTRAINT_NONE:
-    constraint = NULL;
-    switch (type) {
-    case G_TYPE_BOOLEAN:
-      spec_type = G_TYPE_PARAM_BOOLEAN;
-      break;
-    case G_TYPE_INT:
-      spec_type = G_TYPE_PARAM_INT;
-      break;
-    case G_TYPE_DOUBLE:
-      spec_type = G_TYPE_PARAM_DOUBLE;
-      break;
-    case G_TYPE_STRING:
-      spec_type = G_TYPE_PARAM_STRING;
-      break;
-    default:
-      spec_type = G_TYPE_NONE;
-      break;
-    }
-    break;
-  }
-	
-  if (type != G_TYPE_NONE) {
-    if (desc->cap & SANE_CAP_AUTOMATIC)
-      gss_option_set_default_value_by_index (gss, n, type);
-    default_value = gss_option_get_value_by_index (gss, n, type);
-  }
-	
-  /* SPEC */
-  if (spec_type == G_TYPE_PARAM_BOOLEAN) {
-    spec = gs_param_spec_boolean (name, desc->title, desc->desc, group,
-				  g_value_get_boolean (default_value), flags);
-  }
-  else if (spec_type == G_TYPE_PARAM_INT) {
-    spec = gs_param_spec_int(name, desc->title, desc->desc, group,
-			     G_MININT, G_MAXINT,
-			     g_value_get_int (default_value), flags);
-  }
-  else if (spec_type == G_TYPE_PARAM_DOUBLE) {
-    spec = gs_param_spec_double (name, desc->title, desc->desc, group,
-				 G_MINDOUBLE, G_MAXDOUBLE,
-				 MIN (G_MAXDOUBLE, MAX (G_MINDOUBLE, g_value_get_double (default_value))),
-				 flags);
-  }
-  else if (spec_type == G_TYPE_PARAM_STRING) {
-    spec = gs_param_spec_string (name, desc->title, desc->desc, group,
-				 dgettext ("sane-backends",
-					   g_value_get_string (default_value)),
-				 flags);
-  }
-  else if (spec_type == GS_TYPE_PARAM_RANGE) {
-    /* init values */
-    value = g_new0(GValue, 1);
-    g_value_init (value, type);
-    vmin = g_new0(GValue, 1);
-    g_value_init (vmin, type);
-    vmax = g_new0(GValue, 1);
-    g_value_init (vmax, type);
-    vstep = g_new0(GValue, 1);
-    g_value_init (vstep, type);
-		
-    /* set values */
-    switch (type) {
-    case G_TYPE_INT:
-      g_value_set_int (vmin, desc->constraint.range->min);
-      g_value_set_int (vmax, desc->constraint.range->max);
-      g_value_set_int (vstep, desc->constraint.range->quant);
-      break;
-    case G_TYPE_DOUBLE:
-      g_value_set_double (vmin, SANE_UNFIX (desc->constraint.range->min));
-      g_value_set_double (vmax, SANE_UNFIX (desc->constraint.range->max));
-      g_value_set_double (vstep, SANE_UNFIX (desc->constraint.range->quant));
-      break;
-    }
-		
-    constraint = g_strdup_printf ("[%s;%s;%s]",
-				  g_strdup_value_contents (vmin),
-				  g_strdup_value_contents (vstep),
-				  g_strdup_value_contents (vmax));
+	GSaneScannerPrivate *priv = GET_PRIVATE(gss);
+	GParamSpec *spec = NULL;
+	GValue *default_value = NULL, *value, *vmin, *vmax, *vstep;
+	GValueArray *values;
+	GType type = G_TYPE_INVALID;
+	GType spec_type = G_TYPE_INVALID;
+	gchar *constraint, *name, *sflags;
+	gint i, m;
+	guint flags = 0, unit;
+	GEnumClass *enumclass;
+	GEnumValue *enumvalue;
+	const SANE_Option_Descriptor *desc;
+	
+	desc = sane_get_option_descriptor(priv->handle, n);
+	
+	/* FLAG */
+		sflags = "";
+	if (SANE_OPTION_IS_ACTIVE (desc->cap)) {
+		flags = flags | G_PARAM_WRITABLE;
+		sflags = "writable";
+	}
+	
+	/* UNIT */
+		switch (desc->unit) {
+			case SANE_UNIT_PIXEL:
+				unit = GS_UNIT_PIXEL;
+			break;
+			case SANE_UNIT_BIT:
+				unit = GS_UNIT_BIT;
+			break;
+			case SANE_UNIT_MM:
+				unit = GS_UNIT_MM;
+			break;
+			case SANE_UNIT_DPI:
+				unit = GS_UNIT_DPI;
+			break;
+			case SANE_UNIT_PERCENT:
+				unit = GS_UNIT_PERCENT;
+			break;
+			case SANE_UNIT_MICROSECOND:
+				unit = GS_UNIT_PERCENT;
+			break;
+			case SANE_UNIT_NONE:
+				default:
+				unit = GS_UNIT_NONE;
+			break;
+		}
+	
+	enumclass = g_type_class_ref (GNOME_TYPE_SCAN_UNIT);
+	enumvalue = g_enum_get_value (enumclass, unit);
+	g_type_class_unref (enumclass);
+	
+	/* VALUE TYPE*/
+		switch (desc->type) {
+			case SANE_TYPE_BOOL:
+				type = G_TYPE_BOOLEAN;
+			break;
+			case SANE_TYPE_INT:
+				type = G_TYPE_INT;
+			break;
+			case SANE_TYPE_FIXED:
+				type = G_TYPE_DOUBLE;
+			break;
+			case SANE_TYPE_STRING:
+				type = G_TYPE_STRING;
+			break;
+			case SANE_TYPE_GROUP:
+				group = g_quark_from_string(desc->title);
+			gs_debug ("\n");
+			gs_debug (" -- Group ÂÂ%sÂÂ --", desc->title);
+			type = G_TYPE_NONE;
+			return NULL;
+			break;
+			case SANE_TYPE_BUTTON:
+				gs_debug("// button : %s (%s)", desc->title, desc->desc);
+			type = G_TYPE_NONE;
+			return NULL;
+			break;
+		}
+	
+	name = g_utf8_strlen(desc->name, 32) < 1 ?
+		g_strdup_printf("option-%i", unnamed++)
+		: g_strdup (desc->name);
+	
+	if (desc->cap & SANE_CAP_HARD_SELECT) {
+		gs_debug ("/!\\ IGNORING BUTTON %s !", name);
+		return NULL;
+	}
+	
+	
+	/* SPEC_TYPE */
+		switch (desc->constraint_type) {
+			/* RANGE */
+				case SANE_CONSTRAINT_RANGE:
+				spec_type = GS_TYPE_PARAM_RANGE;
+			break;
+			
+			/* ENUM */
+				case SANE_CONSTRAINT_WORD_LIST:
+				case SANE_CONSTRAINT_STRING_LIST:
+				spec_type = GS_TYPE_PARAM_ENUM;
+			break;
+			case SANE_CONSTRAINT_NONE:
+				constraint = NULL;
+			switch (type) {
+				case G_TYPE_BOOLEAN:
+					spec_type = G_TYPE_PARAM_BOOLEAN;
+				break;
+				case G_TYPE_INT:
+					spec_type = G_TYPE_PARAM_INT;
+				break;
+				case G_TYPE_DOUBLE:
+					spec_type = G_TYPE_PARAM_DOUBLE;
+				break;
+				case G_TYPE_STRING:
+					spec_type = G_TYPE_PARAM_STRING;
+				break;
+				default:
+					spec_type = G_TYPE_NONE;
+				break;
+			}
+			break;
+		}
+	
+	if (type != G_TYPE_NONE) {
+		if (desc->cap & SANE_CAP_AUTOMATIC)
+			gss_option_set_default_value_by_index (gss, n, type);
+		default_value = gss_option_get_value_by_index (gss, n, type);
+	}
+	
+	/* SPEC */
+		if (spec_type == G_TYPE_PARAM_BOOLEAN) {
+			spec = gs_param_spec_boolean (name, desc->title, desc->desc, group,
+										  g_value_get_boolean (default_value), flags);
+		}
+	else if (spec_type == G_TYPE_PARAM_INT) {
+		spec = gs_param_spec_int(name, desc->title, desc->desc, group,
+								 G_MININT, G_MAXINT,
+								 g_value_get_int (default_value), flags);
+	}
+	else if (spec_type == G_TYPE_PARAM_DOUBLE) {
+		spec = gs_param_spec_double (name, desc->title, desc->desc, group,
+									 G_MINDOUBLE, G_MAXDOUBLE,
+									 MIN (G_MAXDOUBLE, MAX (G_MINDOUBLE, g_value_get_double (default_value))),
+									 flags);
+	}
+	else if (spec_type == G_TYPE_PARAM_STRING) {
+		spec = gs_param_spec_string (name, desc->title, desc->desc, group,
+									 dgettext ("sane-backends",
+											   g_value_get_string (default_value)),
+									 flags);
+	}
+	else if (spec_type == GS_TYPE_PARAM_RANGE) {
+		/* init values */
+			value = g_new0(GValue, 1);
+		g_value_init (value, type);
+		vmin = g_new0(GValue, 1);
+		g_value_init (vmin, type);
+		vmax = g_new0(GValue, 1);
+		g_value_init (vmax, type);
+		vstep = g_new0(GValue, 1);
+		g_value_init (vstep, type);
 		
-    /* create spec */
-    spec = gs_param_spec_range(name, desc->title, desc->desc, group,
-			       vmin, vmax, vstep, default_value, flags);
+		/* set values */
+			switch (type) {
+				case G_TYPE_INT:
+					g_value_set_int (vmin, desc->constraint.range->min);
+				g_value_set_int (vmax, desc->constraint.range->max);
+				g_value_set_int (vstep, desc->constraint.range->quant);
+				break;
+				case G_TYPE_DOUBLE:
+					g_value_set_double (vmin, SANE_UNFIX (desc->constraint.range->min));
+				g_value_set_double (vmax, SANE_UNFIX (desc->constraint.range->max));
+				g_value_set_double (vstep, SANE_UNFIX (desc->constraint.range->quant));
+				break;
+			}
 		
-    g_free (vmin);
-    g_free (vmax);
-    g_free (vstep);
-  }
-  /* ENUM */
-  else if (spec_type == GS_TYPE_PARAM_ENUM) {
-    value = g_new0(GValue, 1);
-    g_value_init (value, type);
-    constraint = "";
+		constraint = g_strdup_printf ("[%s;%s;%s]",
+									  g_strdup_value_contents (vmin),
+									  g_strdup_value_contents (vstep),
+									  g_strdup_value_contents (vmax));
 		
-    if (type == G_TYPE_STRING) {
-      values = g_value_array_new (0);
-      for (i = 0; desc->constraint.string_list[i]; i++) {
-	g_value_set_static_string (value,
-				   desc->constraint.string_list[i]);
-	g_value_array_append(values, value);
-      }
-      if (g_value_get_string (default_value) == NULL) {
-	g_value_unset (default_value);
-	g_free (default_value);
-	default_value = values->values;
-      }
-      constraint = g_strdup_printf ("{\"%s\"}",
-				    g_strjoinv("\", \"",
-					       (gchar**) desc->constraint.string_list));
-    }
-    else {
-      m = (gint) desc->constraint.word_list[0];
-      values = g_value_array_new (m);
-      for (i = 0; i < m; i++) {
-	switch (type) {
-	case G_TYPE_INT:
-	  g_value_set_int (value, desc->constraint.word_list[i+1]);
-	  constraint = g_strdup_printf("%s, %d", constraint,
-				       g_value_get_int  (value));
-	  break;
-	case G_TYPE_DOUBLE:
-	  g_value_set_double (value, SANE_UNFIX(desc->constraint.word_list[i+1]));
-	  constraint = g_strdup_printf("%s; %.2f", constraint,
-				       g_value_get_double (value));
-	  break;
-	}
-	g_value_array_append (values, value);
-      }
-      constraint = g_strdup_printf("{%s}", constraint+2);
-    }
-    g_value_unset (value);
-    g_free (value);
+		/* create spec */
+			spec = gs_param_spec_range(name, desc->title, desc->desc, group,
+									   vmin, vmax, vstep, default_value, flags);
 		
-    spec = gs_param_spec_enum(name, desc->title, desc->desc, group,
-			      values, default_value, flags);
-  }
-  else if (spec_type == G_TYPE_NONE) {
-    return NULL;
-  }
-
-  /* common specs datas */
-  if (spec) {
-    g_param_spec_set_qdata (spec, GSANE_OPTION_DESC_QUARK, (gpointer) desc);
-    gs_param_spec_set_group (spec, group);
-    gs_param_spec_set_domain (spec, "sane-backends");
-    gs_param_spec_set_unit (spec, unit);
-    gs_param_spec_set_index(spec, (guint) n);
-  }
-	
-  gs_debug ("%s (%s):", desc->title, desc->name);
-  gs_debug (" %s %s (%s), %s",
-	    g_type_name(type), enumvalue->value_nick,
-	    g_type_name(spec_type), constraint);
-  gs_debug (" default = %s ; flags = {%s}",
-	    g_strdup_value_contents (default_value), sflags);
-  gs_debug ("%s", "");
+		g_free (vmin);
+		g_free (vmax);
+		g_free (vstep);
+	}
+	/* ENUM */
+		else if (spec_type == GS_TYPE_PARAM_ENUM) {
+			value = g_new0(GValue, 1);
+			g_value_init (value, type);
+			constraint = "";
+			
+			if (type == G_TYPE_STRING) {
+				values = g_value_array_new (0);
+				for (i = 0; desc->constraint.string_list[i]; i++) {
+					g_value_set_static_string (value,
+											   desc->constraint.string_list[i]);
+					g_value_array_append(values, value);
+				}
+				if (g_value_get_string (default_value) == NULL) {
+					g_value_unset (default_value);
+					g_free (default_value);
+					default_value = values->values;
+				}
+				constraint = g_strdup_printf ("{\"%s\"}",
+											  g_strjoinv("\", \"",
+														 (gchar**) desc->constraint.string_list));
+			}
+			else {
+				m = (gint) desc->constraint.word_list[0];
+				values = g_value_array_new (m);
+				for (i = 0; i < m; i++) {
+					switch (type) {
+						case G_TYPE_INT:
+							g_value_set_int (value, desc->constraint.word_list[i+1]);
+						constraint = g_strdup_printf("%s, %d", constraint,
+													 g_value_get_int  (value));
+						break;
+						case G_TYPE_DOUBLE:
+							g_value_set_double (value, SANE_UNFIX(desc->constraint.word_list[i+1]));
+						constraint = g_strdup_printf("%s; %.2f", constraint,
+													 g_value_get_double (value));
+						break;
+					}
+					g_value_array_append (values, value);
+				}
+				constraint = g_strdup_printf("{%s}", constraint+2);
+			}
+			g_value_unset (value);
+			g_free (value);
+			
+			spec = gs_param_spec_enum(name, desc->title, desc->desc, group,
+									  values, default_value, flags);
+		}
+	else if (spec_type == G_TYPE_NONE) {
+		return NULL;
+	}
+	
+	/* common specs datas */
+		if (spec) {
+			g_param_spec_set_qdata (spec, GSANE_OPTION_DESC_QUARK, (gpointer) desc);
+			gs_param_spec_set_group (spec, group);
+			gs_param_spec_set_domain (spec, "sane-backends");
+			gs_param_spec_set_unit (spec, unit);
+			gs_param_spec_set_index(spec, (guint) n);
+		}
+	
+	gs_debug ("%s (%s):", desc->title, desc->name);
+	gs_debug (" %s %s (%s), %s",
+			  g_type_name(type), enumvalue->value_nick,
+			  g_type_name(spec_type), constraint);
+	gs_debug (" default = %s ; flags = {%s}",
+			  g_strdup_value_contents (default_value), sflags);
+	gs_debug ("%s", "");
 	
-  g_free (name);
-  g_free (constraint);
+	g_free (name);
+	g_free (constraint);
 	
-  return spec;
+	return spec;
 }
 
 
 static void
 gss_option_set_default_value_by_index (GSaneScanner *gss, SANE_Int n, GType type)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  SANE_Status status;
-  SANE_Int i;
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	SANE_Status status;
+	SANE_Int i;
 	
-  status = sane_control_option (priv->handle, n, SANE_ACTION_SET_AUTO,
-				NULL, &i);
+	status = sane_control_option (priv->handle, n, SANE_ACTION_SET_AUTO,
+								  NULL, &i);
 }
 
 GValue*
 gsane_scanner_option_get_value	(GSaneScanner *sane, GParamSpec *spec)
 {
-  /* determine true value type using gs_param_value_set_default */
-  GValue *default_value = g_new0 (GValue, 1);
-  GType type;
-  g_value_init (default_value, G_PARAM_SPEC_VALUE_TYPE (spec));
-  g_param_value_set_default (spec, default_value);
-  type = G_VALUE_TYPE (default_value);
-  g_value_unset (default_value);
-  g_free (default_value);
-	
-  return gss_option_get_value_by_index (sane,
-					(SANE_Int) gs_param_spec_get_index (spec),
-					type);
+	/* determine true value type using gs_param_value_set_default */
+		GValue *default_value = g_new0 (GValue, 1);
+	GType type;
+	g_value_init (default_value, G_PARAM_SPEC_VALUE_TYPE (spec));
+	g_param_value_set_default (spec, default_value);
+	type = G_VALUE_TYPE (default_value);
+	g_value_unset (default_value);
+	g_free (default_value);
+	
+	return gss_option_get_value_by_index (sane,
+										  (SANE_Int) gs_param_spec_get_index (spec),
+										  type);
 }
 
 
 static GValue*
 gss_option_get_value_by_index (GSaneScanner *gss, SANE_Int n, GType type)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  GValue *value = g_new0(GValue, 1);
-  const SANE_Option_Descriptor *desc;
-  SANE_Status status;
-  SANE_Int i;
-  void *v;
-	
-  desc = sane_get_option_descriptor (priv->handle, n);
-	
-  g_value_init (value, type);
-  v = g_malloc0(desc->size);
-  status = sane_control_option(priv->handle, n, SANE_ACTION_GET_VALUE, v, &i);
-	
-  switch (type) {
-  case G_TYPE_BOOLEAN:
-    g_value_set_boolean(value, *((gboolean*) v));
-    break;
-  case G_TYPE_INT:
-    g_value_set_int(value, *((gint*) v));
-    break;
-  case G_TYPE_DOUBLE:
-    g_value_set_double(value, SANE_UNFIX (*((SANE_Word*) v)));
-    break;
-  case G_TYPE_STRING:
-    g_value_set_string (value, g_strdup(v));
-    break;
-  default:
-    g_warning ("%s: Can't retrieve value of type %s for option %s.",
-	       G_STRLOC,
-	       g_type_name(type),
-	       desc->name);
-    break;
-  }
-	
-  /*
-    if (i & SANE_INFO_RELOAD_OPTIONS) {
-    gs_debug ("Option reload needed for %s !", desc->name);
-    }
-  */
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	GValue *value = g_new0(GValue, 1);
+	const SANE_Option_Descriptor *desc;
+	SANE_Status status;
+	SANE_Int i;
+	void *v;
+	
+	desc = sane_get_option_descriptor (priv->handle, n);
+	
+	g_value_init (value, type);
+	v = g_malloc0(desc->size);
+	status = sane_control_option(priv->handle, n, SANE_ACTION_GET_VALUE, v, &i);
 	
-  return value;
+	switch (type) {
+		case G_TYPE_BOOLEAN:
+			g_value_set_boolean(value, *((gboolean*) v));
+		break;
+		case G_TYPE_INT:
+			g_value_set_int(value, *((gint*) v));
+		break;
+		case G_TYPE_DOUBLE:
+			g_value_set_double(value, SANE_UNFIX (*((SANE_Word*) v)));
+		break;
+		case G_TYPE_STRING:
+			g_value_set_string (value, g_strdup(v));
+		break;
+		default:
+			g_warning ("%s: Can't retrieve value of type %s for option %s.",
+					   G_STRLOC,
+					   g_type_name(type),
+					   desc->name);
+		break;
+	}
+	
+	/*
+		if (i & SANE_INFO_RELOAD_OPTIONS) {
+			gs_debug ("Option reload needed for %s !", desc->name);
+		}
+	*/
+		
+		return value;
 }
 
 /* returns TRUE if we need to reload options. */
 SANE_Int
 gsane_scanner_option_set_value (GSaneScanner *gss, GParamSpec *spec, GValue *value)
 {
-  GValue *old;
-  SANE_Int i, n = (SANE_Int) gs_param_spec_get_index (spec);
-  SANE_Bool boolean;
-  SANE_Word word;
-  SANE_Status status;
-  void *v = NULL;
-
-  /* don't reset option to the same value */
-  old = gsane_scanner_option_get_value (gss, spec);
-  if (gs_param_values_cmp (spec, old, value) == 0)
-    return 0;
-
-  switch (G_VALUE_TYPE (value)) {
-  case G_TYPE_BOOLEAN:
-    boolean = g_value_get_boolean (value);
-    v = &boolean;
-    break;
-  case G_TYPE_INT:
-    word = g_value_get_int (value);
-    v = &word;
-    break;
-  case G_TYPE_DOUBLE:
-    word = SANE_FIX (g_value_get_double (value));
-    v = &word;
-    break;
-  case G_TYPE_STRING:
-    v = g_value_dup_string (value);
-    break;
-  }
-	
-  gs_debug ("setting '%s' to %s",
-	    g_param_spec_get_name (spec),
-	    g_strdup_value_contents(value));
+	GValue *old;
+	SANE_Int i, n = (SANE_Int) gs_param_spec_get_index (spec);
+	SANE_Bool boolean;
+	SANE_Word word;
+	SANE_Status status;
+	void *v = NULL;
+	
+	/* don't reset option to the same value */
+		old = gsane_scanner_option_get_value (gss, spec);
+	if (gs_param_values_cmp (spec, old, value) == 0)
+		return 0;
+	
+	switch (G_VALUE_TYPE (value)) {
+		case G_TYPE_BOOLEAN:
+			boolean = g_value_get_boolean (value);
+		v = &boolean;
+		break;
+		case G_TYPE_INT:
+			word = g_value_get_int (value);
+		v = &word;
+		break;
+		case G_TYPE_DOUBLE:
+			word = SANE_FIX (g_value_get_double (value));
+		v = &word;
+		break;
+		case G_TYPE_STRING:
+			v = g_value_dup_string (value);
+		break;
+	}
 	
-  status = sane_control_option (GET_PRIVATE (gss)->handle, n,
-				SANE_ACTION_SET_VALUE, v, &i);
-
-  return i;
+	gs_debug ("setting '%s' to %s",
+			  g_param_spec_get_name (spec),
+			  g_strdup_value_contents(value));
+	
+	status = sane_control_option (GET_PRIVATE (gss)->handle, n,
+								  SANE_ACTION_SET_VALUE, v, &i);
+	
+	return i;
 }
 
 
 static void
 gss_params_foreach_set_param (GParamSpec *spec, GSaneScanner *gss)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  GValue * value, *value0;
-  SANE_Int i = 0;
-  MetaParam *mp = NULL;
-	
-  mp = g_param_spec_get_qdata (spec, GSANE_META_PARAM_QUARK);
-	
-  value = gnome_scan_settings_get (priv->settings,
-				   g_param_spec_get_name (spec));
-
-  i = mp ? meta_param_set_value (mp, spec, priv->settings) : gsane_scanner_option_set_value (gss, spec, value);
-	
-  if (i & SANE_INFO_RELOAD_OPTIONS) {
-    priv->reload = TRUE;
-  }
-	
-  if (i & SANE_INFO_INEXACT) {
-    value0 = mp ? meta_param_get_value (mp, spec) : gsane_scanner_option_get_value (gss, spec);
-    if (value0)
-      g_value_copy (value0, value);
-    gnome_scan_settings_set (priv->settings,
-			     g_param_spec_get_name (spec),
-			     value);
-    priv->changed = TRUE;
-    gs_debug (" exact value = %s", g_strdup_value_contents (value));
-  }
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	GValue * value, *value0;
+	SANE_Int i = 0;
+	MetaParam *mp = NULL;
+	
+	mp = g_param_spec_get_qdata (spec, GSANE_META_PARAM_QUARK);
+	
+	value = gnome_scan_settings_get (priv->settings,
+									 g_param_spec_get_name (spec));
+	
+	i = mp ? meta_param_set_value (mp, spec, priv->settings) : gsane_scanner_option_set_value (gss, spec, value);
+	
+	if (i & SANE_INFO_RELOAD_OPTIONS) {
+		priv->reload = TRUE;
+	}
+	
+	if (i & SANE_INFO_INEXACT) {
+		value0 = mp ? meta_param_get_value (mp, spec) : gsane_scanner_option_get_value (gss, spec);
+		if (value0)
+			g_value_copy (value0, value);
+		gnome_scan_settings_set (priv->settings,
+								 g_param_spec_get_name (spec),
+								 value);
+		priv->changed = TRUE;
+		gs_debug (" exact value = %s", g_strdup_value_contents (value));
+	}
 }
 
 static void
 gss_params_foreach_update_param (GParamSpec *pspec, GSaneScanner *gss)
 {
-  GSaneScannerPrivate *priv = GET_PRIVATE (gss);
-  const SANE_Option_Descriptor *desc;
-  guint flags = 0;
-  guint n = gs_param_spec_get_index (pspec);
-	
-  desc = sane_get_option_descriptor(priv->handle, n);
-  if (SANE_OPTION_IS_ACTIVE (desc->cap)) {
-    flags = flags | G_PARAM_WRITABLE;
-    g_param_spec_set_qdata (pspec, GSANE_OPTION_DESC_QUARK, (gpointer) desc);
-  }
-	
-  if (flags != pspec->flags) {
-    gs_debug (G_STRLOC ": %s %sabled", g_param_spec_get_name (pspec),
-	      (flags & G_PARAM_WRITABLE ? "en" : "dis"));
-    pspec->flags = flags;
-    gnome_scan_plugin_params_changed (GNOME_SCAN_PLUGIN (gss), pspec);
-  }
+	GSaneScannerPrivate *priv = GET_PRIVATE (gss);
+	const SANE_Option_Descriptor *desc;
+	guint flags = 0;
+	guint n = gs_param_spec_get_index (pspec);
+	
+	desc = sane_get_option_descriptor(priv->handle, n);
+	if (SANE_OPTION_IS_ACTIVE (desc->cap)) {
+		flags = flags | G_PARAM_WRITABLE;
+		g_param_spec_set_qdata (pspec, GSANE_OPTION_DESC_QUARK, (gpointer) desc);
+	}
+	
+	if (flags != pspec->flags) {
+		gs_debug (G_STRLOC ": %s %sabled", g_param_spec_get_name (pspec),
+				  (flags & G_PARAM_WRITABLE ? "en" : "dis"));
+		pspec->flags = flags;
+		gnome_scan_plugin_params_changed (GNOME_SCAN_PLUGIN (gss), pspec);
+	}
 }
 
 static void
 gss_mp_foreach_option_matches (const gchar *key, MetaParam *mp, GPtrArray* arg)
 {
-  MetaParam **dest = g_ptr_array_index (arg, 1);
-  GParamSpec *spec = g_ptr_array_index (arg, 2);
-  if (gss_option_name_matches_array (spec,
-				     (const gchar**) meta_param_get_options_names (mp))) {
-    *dest = mp;
-  }
+	MetaParam **dest = g_ptr_array_index (arg, 1);
+	GParamSpec *spec = g_ptr_array_index (arg, 2);
+	if (gss_option_name_matches_array (spec,
+									   (const gchar**) meta_param_get_options_names (mp))) {
+										   *dest = mp;
+									   }
 }
 
 static void
 gss_mp_foreach_add_param (const gchar* key, MetaParam *mp, GSaneScanner *gss)
 {
-  /* ask MetaParam to add its sub params to gss */
-  meta_param_get_params (mp);
+	/* ask MetaParam to add its sub params to gss */
+		meta_param_get_params (mp);
 }

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Tue Jan 15 17:21:22 2008
@@ -7,6 +7,7 @@
 lib/gnome-scan-param-specs.c
 lib/gnome-scan-param-widget.c
 lib/gnome-scan-preview-plugin-area.c
+lib/gnome-scan-processor-common.c
 modules/gsane-meta-param.c
 modules/gsfile-filenames-widget.c
 modules/gsfile-scanner.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]