gnome-scan r560 - in trunk: . modules



Author: bersace
Date: Fri Feb 29 00:08:10 2008
New Revision: 560
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=560&view=rev

Log:
Fix GSFile backend. Migrate to GEGL 0.0.16. Reindent code.

Modified:
   trunk/ChangeLog
   trunk/modules/gsfile-scanner.c

Modified: trunk/modules/gsfile-scanner.c
==============================================================================
--- trunk/modules/gsfile-scanner.c	(original)
+++ trunk/modules/gsfile-scanner.c	Fri Feb 29 00:08:10 2008
@@ -40,104 +40,103 @@
 
 static GnomeScannerClass* parent_class = NULL;
 
-static void	gsf_configure		(GnomeScanPlugin *plugin,
-					 GnomeScanSettings *settings);
+static void	gsf_configure			(GnomeScanPlugin *plugin,
+									 GnomeScanSettings *settings);
 static GList*	gsf_get_child_nodes	(GnomeScanPlugin *plugin,
-					 GeglNode *root);
+										 GeglNode *root);
 static gboolean	gsf_start_frame		(GnomeScanPlugin *plugin);
-static gboolean	gsf_work		(GnomeScanPlugin *plugin,
-					 gdouble *progress);
-static void	gsf_end_frame		(GnomeScanPlugin *plugin);
+static gboolean	gsf_work			(GnomeScanPlugin *plugin,
+										gdouble *progress);
 
 GS_DEFINE_MODULE_TYPE (GSFileScanner, gsfile_scanner, GNOME_TYPE_SCANNER);
 
 static void
 gsfile_scanner_init (GSFileScanner *object)
 {
-  GParamSpec *pspec;
-  GSList *formats = NULL;
+	GParamSpec *pspec;
+	GSList *formats = NULL;
 	
-  static gchar *png_mime[] = {
-    "image/png",
-    NULL
-  };
-  static gchar *png_exts[] = {
-    "png",
-    NULL
-  };
-	
-  formats = g_slist_append (formats,
-			    gnome_scan_format_new ("png",
-						   GETTEXT_PACKAGE,
-						   N_("PNG picture"),
-						   png_mime,
-						   png_exts));
-	
-  static gchar *jpeg_mime[] = {
-    "image/jpeg",
-    NULL
-  };
-  static gchar *jpeg_exts[] = {
-    "jpeg",
-    "jpe",
-    "jpg",
-    NULL
-  };
-	
-  formats = g_slist_append (formats,
-			    gnome_scan_format_new ("jpeg",
-						   GETTEXT_PACKAGE,
-						   N_("JPEG picture"),
-						   jpeg_mime,
-						   jpeg_exts));
-	
-  pspec = gsfile_param_spec_filenames ("input-filenames",
-				       N_("Files"),
-				       N_("Files to import."),
-				       GS_PARAM_GROUP_SCANNER_FRONT,
-				       formats, G_PARAM_WRITABLE);
-  gs_param_spec_set_domain (pspec, GETTEXT_PACKAGE);
-  gs_param_spec_set_unit (pspec, GS_UNIT_NONE);
-  gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (object), pspec);
-  GNOME_SCANNER (object)->status = GNOME_SCANNER_READY;
+	static gchar *png_mime[] = {
+		"image/png",
+		NULL
+	};
+	static gchar *png_exts[] = {
+		"png",
+		NULL
+	};
+	
+	formats = g_slist_append (formats,
+							  gnome_scan_format_new ("png",
+													 GETTEXT_PACKAGE,
+													 N_("PNG picture"),
+													 png_mime,
+													 png_exts));
+	
+	static gchar *jpeg_mime[] = {
+		"image/jpeg",
+		NULL
+	};
+	static gchar *jpeg_exts[] = {
+		"jpeg",
+		"jpe",
+		"jpg",
+		NULL
+	};
+	
+	formats = g_slist_append (formats,
+							  gnome_scan_format_new ("jpeg",
+													 GETTEXT_PACKAGE,
+													 N_("JPEG picture"),
+													 jpeg_mime,
+													 jpeg_exts));
+	
+	pspec = gsfile_param_spec_filenames ("input-filenames",
+										 N_("Files"),
+										 N_("Files to import."),
+										 GS_PARAM_GROUP_SCANNER_FRONT,
+										 formats, G_PARAM_WRITABLE);
+	gs_param_spec_set_domain (pspec, GETTEXT_PACKAGE);
+	gs_param_spec_set_unit (pspec, GS_UNIT_NONE);
+	gnome_scan_plugin_params_add (GNOME_SCAN_PLUGIN (object), pspec);
+	GNOME_SCANNER (object)->status = GNOME_SCANNER_READY;
 }
 
 static void
 gsfile_scanner_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
 gsfile_scanner_class_init (GSFileScannerClass *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);
-	
-  g_type_class_add_private (object_class, sizeof (GSFileScannerPrivate));
-	
-  plugin_class->configure		= gsf_configure;
-  plugin_class->start_frame	= gsf_start_frame;
-  plugin_class->work			= gsf_work;
-  plugin_class->end_frame		= gsf_end_frame;
+	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);
+	
+	g_type_class_add_private (object_class, sizeof (GSFileScannerPrivate));
+	
+	plugin_class->configure			= gsf_configure;
+	plugin_class->start_frame		= gsf_start_frame;
+	plugin_class->work				= gsf_work;
+	plugin_class->get_child_nodes   = gsf_get_child_nodes;
 	
-  object_class->finalize	= gsfile_scanner_finalize;
+	object_class->finalize	= gsfile_scanner_finalize;
 }
 
 GnomeScanner*
 gsfile_scanner_new ()
 {
-  static gint count = 0;
-  GObject *object = g_object_new (GSFILE_TYPE_SCANNER,
-				  "name", (!count ? _("Files") : g_strdup_printf (_("Files (%i)"), count)),
-				  "blurb", _("Import from files."),
-				  "icon-name", "gnome-mime-image",
-				  NULL);
-  count++;
-  return GNOME_SCANNER (object);
+	static gint count = 0;
+	GObject *object = g_object_new (GSFILE_TYPE_SCANNER,
+									"name", (!count ? _("Files") : g_strdup_printf (_("Files (%i)"), count)),
+									"blurb", _("Import from files."),
+									"icon-name", "gnome-mime-image",
+									NULL);
+	count++;
+	return GNOME_SCANNER (object);
 }
 
 /* INTERNALS */
@@ -145,48 +144,47 @@
 static void
 gsf_configure (GnomeScanPlugin *plugin, GnomeScanSettings *settings)
 {
-  GSFileScanner *scanner = GSFILE_SCANNER (plugin);
-  GValue *value;
+	GSFileScanner *scanner = GSFILE_SCANNER (plugin);
+	GValue *value;
 	
-  value = gnome_scan_settings_get (settings, "input-filenames");
-  scanner->filenames = g_value_get_pointer (value);
-  scanner->current = scanner->filenames;
+	value = gnome_scan_settings_get (settings, "input-filenames");
+	scanner->filenames = g_value_get_pointer (value);
+	scanner->current = scanner->filenames;
 }
 
 static GList*
 gsf_get_child_nodes (GnomeScanPlugin *plugin,
-		     GeglNode *root)
+					 GeglNode *root)
 {
-  GSFileScanner *scanner = GSFILE_SCANNER (plugin);
-  GSFileScannerPrivate *priv = GET_PRIVATE (scanner);
-  GList *list = NULL;
-
-  priv->load = gegl_node_new_child (root,
-				    "operation", "load",
-				    "cache", TRUE,
-				    NULL);
-  
-  list = g_list_append (list, priv->load);
-  return list;
+	GSFileScanner *scanner = GSFILE_SCANNER (plugin);
+	GSFileScannerPrivate *priv = GET_PRIVATE (scanner);
+	GList *list = NULL;
+	
+	priv->load = gegl_node_new_child (root,
+									  "operation", "load",
+									  NULL);
+	
+	list = g_list_append (list, priv->load);
+	return list;
 }
 
 
 static gboolean
 gsf_start_frame (GnomeScanPlugin *plugin)
 {
-  GSFileScanner *scanner = GSFILE_SCANNER (plugin);
-  GSFileScannerPrivate *priv = GET_PRIVATE (scanner);
+	GSFileScanner *scanner = GSFILE_SCANNER (plugin);
+	GSFileScannerPrivate *priv = GET_PRIVATE (scanner);
 	
-  if (scanner->current == NULL) {
-    return FALSE;
-  }
-	
-  gegl_node_set (priv->load,
-		 "pathname", scanner->current->data,
-		 NULL);
-
-  scanner->current = scanner->current->next;
-  return TRUE;
+	if (scanner->current == NULL) {
+		return FALSE;
+	}
+	
+	gegl_node_set (priv->load,
+				   "path", scanner->current->data,
+				   NULL);
+	
+	scanner->current = scanner->current->next;
+	return TRUE;
 }
 
 static gboolean
@@ -195,13 +193,3 @@
   *progress = 1.;
   return FALSE;
 }
-
-static void
-gsf_end_frame (GnomeScanPlugin *plugin)
-{
-  GSFileScannerPrivate *priv = GET_PRIVATE (plugin);
-
-#define destroy(t,o)	g_object_unref(o); o = NULL;
-  destroy("load", priv->load);
-#undef destroy
-}



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