gnome-scan r651 - trunk/modules



Author: bersace
Date: Mon Dec  8 18:27:48 2008
New Revision: 651
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=651&view=rev

Log:
Add GSFile options implementation.

Added:
   trunk/modules/gsfile-options.c
   trunk/modules/gsfile-options.h

Added: trunk/modules/gsfile-options.c
==============================================================================
--- (empty file)
+++ trunk/modules/gsfile-options.c	Mon Dec  8 18:27:48 2008
@@ -0,0 +1,116 @@
+/* GSFile - Scan from files
+ * Copyright  2007  Ãtienne Bersac <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 "gsfile-options.h"
+#include <gnome-scan-module-helper.h>
+
+enum {
+	GSFILE_OPTION_FILENAMES_DUMMY_PROPERTY,
+	GSFILE_OPTION_FILENAMES_FORMATS,
+	GSFILE_OPTION_FILENAMES_VALUE,
+};
+struct _GSFileOptionFilenamesPrivate {
+	GSList* formats;
+	GSList* filenames;
+};
+
+#define	GSFILE_OPTION_FILENAMES_GET_PRIVATE(o)	(G_TYPE_INSTANCE_GET_PRIVATE((o), GSFILE_TYPE_OPTION_FILENAMES, GSFileOptionFilenamesPrivate))
+
+GS_DEFINE_MODULE_TYPE(GSFileOptionFilenames, gsfile_option_filenames, GNOME_SCAN_TYPE_OPTION);
+
+
+GSList* gsfile_option_filenames_get_formats(GSFileOptionFilenames*self)
+{
+	return self->priv->formats;
+}
+
+void gsfile_option_filenames_set_formats(GSFileOptionFilenames*self, GSList* formats)
+{
+	self->priv->formats = formats;
+}
+
+GSList* gsfile_option_filenames_get_value(GSFileOptionFilenames* self)
+{
+	return self->priv->filenames;
+}
+
+void gsfile_option_filenames_set_value(GSFileOptionFilenames* self, GSList* filenames)
+{
+	self->priv->filenames = filenames;
+}
+
+static void gsfile_option_filenames_get_property(GObject* object, guint property_id, GValue* value, GParamSpec* pspec)
+{
+	GSFileOptionFilenames* self = GSFILE_OPTION_FILENAMES(object);
+	switch(property_id) {
+	case GSFILE_OPTION_FILENAMES_FORMATS:
+		g_value_set_pointer(value, gsfile_option_filenames_get_formats(self));
+		break;
+	case GSFILE_OPTION_FILENAMES_VALUE:
+		g_value_set_pointer(value, gsfile_option_filenames_get_value(self));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+		break;
+	}
+}
+
+static void gsfile_option_filenames_set_property(GObject* object, guint property_id, const GValue* value, GParamSpec* pspec)
+{
+	GSFileOptionFilenames* self = GSFILE_OPTION_FILENAMES(object);
+	switch(property_id) {
+	case GSFILE_OPTION_FILENAMES_FORMATS:
+		gsfile_option_filenames_set_formats(self, g_value_get_pointer(value));
+		break;
+	case GSFILE_OPTION_FILENAMES_VALUE:
+		gsfile_option_filenames_set_value(self, g_value_get_pointer(value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+		break;
+	}
+}
+
+static void gsfile_option_filenames_class_init(GSFileOptionFilenamesClass *klass)
+{
+	g_type_class_add_private(klass, sizeof(GSFileOptionFilenamesPrivate));
+	GObjectClass* object_class = G_OBJECT_CLASS(klass);
+	object_class->get_property	= gsfile_option_filenames_get_property;
+	object_class->set_property	= gsfile_option_filenames_set_property;
+	g_object_class_install_property(object_class,
+					GSFILE_OPTION_FILENAMES_FORMATS,
+					g_param_spec_pointer("formats", "Formats", "List for format available",
+							     G_PARAM_STATIC_STRINGS|G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+	g_object_class_install_property(object_class,
+					GSFILE_OPTION_FILENAMES_VALUE,
+					g_param_spec_pointer("value", "Value", "List for files to scan",
+							     G_PARAM_STATIC_STRINGS|G_PARAM_READWRITE));
+}
+
+static void gsfile_option_filenames_init(GSFileOptionFilenames* self)
+{
+	self->priv = GSFILE_OPTION_FILENAMES_GET_PRIVATE(self);
+}
+
+GSFileOptionFilenames* gsfile_option_filenames_new(const gchar* name, const gchar* title, const gchar* desc, const gchar* domain, const gchar* group, GSList* formats, GnomeScanOptionHint hint)
+{
+	return g_object_new(GSFILE_TYPE_OPTION_FILENAMES, "name", name, "title", title, "desc",	desc, "domain",	domain, "group", group, "formats", formats, "hint", hint, NULL);
+}

Added: trunk/modules/gsfile-options.h
==============================================================================
--- (empty file)
+++ trunk/modules/gsfile-options.h	Mon Dec  8 18:27:48 2008
@@ -0,0 +1,57 @@
+/* GSFile - Scan from files
+ * Copyright  2007  Ãtienne Bersac <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 <gnome-scan-option.h>
+
+#ifndef _GSFILE_OPTION_H
+#define _GSFILE_OPTION_H
+
+G_BEGIN_DECLS
+
+#define	GSFILE_TYPE_OPTION_FILENAMES	(gsfile_option_filenames_get_type())
+#define	GSFILE_OPTION_FILENAMES(o)	(G_TYPE_CHECK_INSTANCE_CAST((o), GSFILE_TYPE_OPTION_FILENAMES, GSFileOptionFilenames))
+#define GSFILE_IS_OPTION_FILENAMES(o)	(G_TYPE_CHECK_INSTANCE_TYPE((o), GSFILE_TYPE_OPTION_FILENAMES))
+	
+typedef struct _GSFileOptionFilenames GSFileOptionFilenames;
+typedef struct _GSFileOptionFilenamesClass GSFileOptionFilenamesClass;
+typedef struct _GSFileOptionFilenamesPrivate GSFileOptionFilenamesPrivate;
+
+struct _GSFileOptionFilenames {
+	GnomeScanOption	parent_instance;
+	GSFileOptionFilenamesPrivate* priv;
+};
+
+struct _GSFileOptionFilenamesClass {
+	GnomeScanOptionClass parent_class;
+};
+
+void gsfile_option_filenames_register_type(GTypeModule* module);
+GType gsfile_option_filenames_get_type(void) G_GNUC_CONST;
+GSFileOptionFilenames* gsfile_option_filenames_new(const gchar* name, const gchar* title, const gchar* desc, const gchar* domain, const gchar* group, GSList* formats, GnomeScanOptionHint hint);
+GSList* gsfile_option_filenames_get_formats(GSFileOptionFilenames*self);
+void gsfile_option_filenames_set_formats(GSFileOptionFilenames*self, GSList* formats);
+GSList* gsfile_option_filenames_get_value(GSFileOptionFilenames* self);
+void gsfile_option_filenames_set_value(GSFileOptionFilenames* self, GSList* filenames);
+
+
+G_END_DECLS
+
+#endif



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