[nautilus-actions] Define NAIImporter interface



commit 8cd2d7143636f965200cdaeec709441fcf1ceffe
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Feb 15 19:58:45 2010 +0100

    Define NAIImporter interface

 ChangeLog               |    5 ++
 src/api/Makefile.am     |    1 +
 src/api/na-iimporter.h  |   77 ++++++++++++++++++++++++++
 src/core/Makefile.am    |    1 +
 src/core/na-iimporter.c |  137 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 221 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3eb1b3d..29db56a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-02-15 Pierre Wieser <pwieser trychlos org>
 
+	Define NAIImporter interface.
+
+	* src/api/na-iimporter.h:
+	* src/core/na-iimporter.c: New files.
+
 	Define NAIExporter interface.
 
 	* src/api/na-iexporter.h:
diff --git a/src/api/Makefile.am b/src/api/Makefile.am
index c5423c7..ea6a222 100644
--- a/src/api/Makefile.am
+++ b/src/api/Makefile.am
@@ -36,6 +36,7 @@ api_include_HEADERS = \
 	na-idata-factory-enum.h								\
 	na-idata-factory-str.h								\
 	na-iexporter.h										\
+	na-iimporter.h										\
 	na-iio-factory.h									\
 	na-iio-factory-factory.h							\
 	na-iio-provider.h									\
diff --git a/src/api/na-iimporter.h b/src/api/na-iimporter.h
new file mode 100644
index 0000000..e89de26
--- /dev/null
+++ b/src/api/na-iimporter.h
@@ -0,0 +1,77 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifndef __NAUTILUS_ACTIONS_API_NA_IIMPORTER_H__
+#define __NAUTILUS_ACTIONS_API_NA_IIMPORTER_H__
+
+/**
+ * SECTION: na_iimporter
+ * @short_description: #NAIImporter interface definition.
+ * @include: nautilus-actions/na-iimporter.h
+ *
+ * The #NAIImporter interface imports  items from the outside world.
+ *
+ * Nautilus-Actions v 2.30 - API version:  1
+ */
+
+#include "na-object-item.h"
+
+G_BEGIN_DECLS
+
+#define NA_IIMPORTER_TYPE						( na_iimporter_get_type())
+#define NA_IIMPORTER( instance )				( G_TYPE_CHECK_INSTANCE_CAST( instance, NA_IIMPORTER_TYPE, NAIImporter ))
+#define NA_IS_IIMPORTER( instance )				( G_TYPE_CHECK_INSTANCE_TYPE( instance, NA_IIMPORTER_TYPE ))
+#define NA_IIMPORTER_GET_INTERFACE( instance )	( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NA_IIMPORTER_TYPE, NAIImporterInterface ))
+
+typedef struct NAIImporter                 NAIImporter;
+
+typedef struct NAIImporterInterfacePrivate NAIImporterInterfacePrivate;
+
+typedef struct {
+	GTypeInterface               parent;
+	NAIImporterInterfacePrivate *private;
+
+	/**
+	 * get_version:
+	 * @instance: the #NAIImporter provider.
+	 *
+	 * Returns: the version of this interface supported by the I/O provider.
+	 *
+	 * Defaults to 1.
+	 */
+	guint          ( *get_version )( const NAIImporter *instance );
+}
+	NAIImporterInterface;
+
+GType na_iimporter_get_type( void );
+
+G_END_DECLS
+
+#endif /* __NAUTILUS_ACTIONS_API_NA_IIMPORTER_H__ */
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index e1c77dc..2b709c5 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -48,6 +48,7 @@ libna_core_la_SOURCES = \
 	na-iduplicable.c									\
 	na-idata-factory.c									\
 	na-iexporter.c										\
+	na-iimporter.c										\
 	na-iio-factory.c									\
 	na-iio-provider.c									\
 	na-io-factory.c										\
diff --git a/src/core/na-iimporter.c b/src/core/na-iimporter.c
new file mode 100644
index 0000000..ca96205
--- /dev/null
+++ b/src/core/na-iimporter.c
@@ -0,0 +1,137 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-iimporter.h>
+
+/* private interface data
+ */
+struct NAIImporterInterfacePrivate {
+	void *empty;						/* so that gcc -pedantic is happy */
+};
+
+static gboolean st_initialized = FALSE;
+static gboolean st_finalized   = FALSE;
+
+static GType  register_type( void );
+static void   interface_base_init( NAIImporterInterface *klass );
+static void   interface_base_finalize( NAIImporterInterface *klass );
+
+static guint  iimporter_get_version( const NAIImporter *instance );
+
+/**
+ * na_iimporter_get_type:
+ *
+ * Returns: the #GType type of this interface.
+ */
+GType
+na_iimporter_get_type( void )
+{
+	static GType type = 0;
+
+	if( !type ){
+		type = register_type();
+	}
+
+	return( type );
+}
+
+/*
+ * na_iimporter_register_type:
+ *
+ * Registers this interface.
+ */
+static GType
+register_type( void )
+{
+	static const gchar *thisfn = "na_iimporter_register_type";
+	GType type;
+
+	static const GTypeInfo info = {
+		sizeof( NAIImporterInterface ),
+		( GBaseInitFunc ) interface_base_init,
+		( GBaseFinalizeFunc ) interface_base_finalize,
+		NULL,
+		NULL,
+		NULL,
+		0,
+		0,
+		NULL
+	};
+
+	g_debug( "%s", thisfn );
+
+	type = g_type_register_static( G_TYPE_INTERFACE, "NAIImporter", &info, 0 );
+
+	g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
+
+	return( type );
+}
+
+static void
+interface_base_init( NAIImporterInterface *klass )
+{
+	static const gchar *thisfn = "na_iimporter_interface_base_init";
+
+	if( !st_initialized ){
+
+		g_debug( "%s: klass%p (%s)", thisfn, ( void * ) klass, G_OBJECT_CLASS_NAME( klass ));
+
+		klass->private = g_new0( NAIImporterInterfacePrivate, 1 );
+
+		klass->get_version = iimporter_get_version;
+
+		st_initialized = TRUE;
+	}
+}
+
+static void
+interface_base_finalize( NAIImporterInterface *klass )
+{
+	static const gchar *thisfn = "na_iimporter_interface_base_finalize";
+
+	if( st_initialized && !st_finalized ){
+
+		g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+		st_finalized = TRUE;
+
+		g_free( klass->private );
+	}
+}
+
+static guint
+iimporter_get_version( const NAIImporter *instance )
+{
+	return( 1 );
+}



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