[nautilus-actions] NAIImporter: update interface description
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] NAIImporter: update interface description
- Date: Fri, 27 Jan 2012 11:09:42 +0000 (UTC)
commit 9cebc83b4420670ddea38f3d06ae968d1e1823cb
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jan 27 10:59:18 2012 +0100
NAIImporter: update interface description
ChangeLog | 11 +
docs/reference/nautilus-actions-sections.txt | 18 +-
src/api/na-iimporter.h | 387 +++++++++++++-------------
src/core/na-iimporter.c | 12 +-
src/core/na-importer.c | 5 +-
src/io-desktop/nadp-reader.c | 7 +-
src/io-desktop/nadp-reader.h | 2 +-
src/io-xml/naxml-reader.c | 26 +-
src/io-xml/naxml-reader.h | 2 +-
9 files changed, 244 insertions(+), 226 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 16d982c..1b87b60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-01-27 Pierre Wieser <pwieser trychlos org>
+ * docs/reference/nautilus-actions-sections.txt: Update sections.
+
+ * src/api/na-iimporter.h:
+ * src/core/na-iimporter.c: Update interface description.
+
+ * src/io-desktop/nadp-reader.c:
+ * src/io-desktop/nadp-reader.h (nadp_reader_iimporter_import_from_uri):
+ * src/io-xml/naxml-reader.c:
+ * src/io-xml/naxml-reader.h (naxml_reader_import_from_uri):
+ Updated accordingly.
+
* src/api/na-iio-provider.h: better distinguish own internal comments.
* docs/reference/nautilus-actions-overrides.txt:
diff --git a/docs/reference/nautilus-actions-sections.txt b/docs/reference/nautilus-actions-sections.txt
index bf19932..03f69e2 100644
--- a/docs/reference/nautilus-actions-sections.txt
+++ b/docs/reference/nautilus-actions-sections.txt
@@ -11,7 +11,7 @@ na_extension_shutdown
</SECTION>
# ---------------------------------------------------------------------
-# NAIIOProvider â The I/O Provider Interface v 1
+# NAIIOProvider â The I/O Provider Interface
<SECTION>
<FILE>iio-provider</FILE>
@@ -30,12 +30,10 @@ na_iio_provider_get_type
<SUBSECTION Private>
NAIIOProviderInterfacePrivate
-IIO_PROVIDER_SIGNAL_ITEM_CHANGED
-NAIIOProvider::notify-pivot
</SECTION>
# ---------------------------------------------------------------------
-# NAIImporter â The Import Interface v 1
+# NAIImporter â The Import Interface
<SECTION>
<FILE>iimporter</FILE>
@@ -47,10 +45,10 @@ NAIImporter
NAIImporterInterface
NAIImporterImportMode
NAIImporterImportStatus
-NAIImporterCheckFn
NAIImporterAskUserFn
+NAIImporterCheckFn
NAIImporterImportFromUriParms
-NAIImporterImportFromUriParmsv1
+NAIImporterImportFromUriParmsv2
NAIImporterManageImportModeParms
na_iimporter_import_from_uri
na_iimporter_manage_import_mode
@@ -63,7 +61,7 @@ NAIImporterInterfacePrivate
</SECTION>
# ---------------------------------------------------------------------
-# NAIExporter â The Export Interface v 1
+# NAIExporter â The Export Interface
<SECTION>
<FILE>iexporter</FILE>
@@ -75,11 +73,11 @@ NAIExporter
NAIExporterInterface
NAIExporterExportStatus
NAIExporterFormat
-NAIExporterFormatExt
+NAIExporterFormatv2
NAIExporterFileParms
-NAIExporterFileParmsv1
+NAIExporterFileParmsv2
NAIExporterBufferParms
-NAIExporterBufferParmsv1
+NAIExporterBufferParmsv2
<SUBSECTION Standard>
na_iexporter_get_type
diff --git a/src/api/na-iimporter.h b/src/api/na-iimporter.h
index 3737ad3..dc91412 100644
--- a/src/api/na-iimporter.h
+++ b/src/api/na-iimporter.h
@@ -34,25 +34,34 @@
/**
* SECTION: iimporter
* @title: NAIImporter
- * @short_description: The Import Interface v 1
+ * @short_description: The Import Interface
* @include: nautilus-actions/na-iimporter.h
*
- * The #NAIImporter interface imports items from the outside world.
+ * The #NAIImporter interface imports items from the outside world
+ * into &prodname; repository (see #NAIIOProvider interface for how
+ * these items will be later managed to be store somewhere).
*
- * &prodname; version 3.2 introduces the version 2 of this interface,
- * which greatly simplify it. The I/O provider which implements the
- * #NAIImporter interface is no more required to check for existence
- * of the imported items, but this check is pushed back to the caller
- * responsability.
+ * In version 1 of the #NAIImporter interface, &prodname; used to
+ * provide the implementation with all was needed to be able to manage
+ * the import process up to be ready for insertion, including the
+ * deduplication if required.
+ *
+ * This used to put on the implementation the responsability to check
+ * for the unicity of the imported identifier, maybe asking the caller
+ * (via provided callback functions) what to do with it, maybe
+ * reallocating a new identifier, and so on...
+ *
+ * Starting with &prodname; version 3.2, this interface is bumped to
+ * a version 2 which greatly simplifies it.
+ *
+ * The I/O provider which implements the #NAIImporter interface is no
+ * more required to check for existence of the imported items, but this
+ * check is pushed back to the caller responsability.
*
* Rationale is that only the caller is able to check against a valid
* repository in its current import context, while the #NAIImporter
* provider should only be responsible to import an item in memory.
*
- * Internal Nautilus-Actions code should never directly call a
- * #NAIImporter interface method, but rather should call the
- * corresponding na_importer_xxx() function.
- *
* <refsect2>
* <title>Versions historic</title>
* <table>
@@ -98,19 +107,14 @@ G_BEGIN_DECLS
#define NA_IS_IIMPORTER( instance ) ( G_TYPE_CHECK_INSTANCE_TYPE( instance, NA_TYPE_IIMPORTER ))
#define NA_IIMPORTER_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NA_TYPE_IIMPORTER, NAIImporterInterface ))
-typedef struct _NAIImporter NAIImporter;
-typedef struct _NAIImporterInterfacePrivate NAIImporterInterfacePrivate;
-typedef struct _NAIImporterImportFromUriParms NAIImporterImportFromUriParms;
-
-#ifdef NA_ENABLE_DEPRECATED
-typedef struct _NAIImporterManageImportModeParms NAIImporterManageImportModeParms;
-#endif
+typedef struct _NAIImporter NAIImporter;
+typedef struct _NAIImporterInterfacePrivate NAIImporterInterfacePrivate;
/**
* NAIImporterInterface:
- * @get_version: returns the version of this interface that the
- * plugin implements.
- * @import_from_uri: imports an item.
+ * @get_version: [should] returns the version of this interface that the
+ * plugin implements.
+ * @import_from_uri: [should] imports an item.
*
* This defines the interface that a #NAIImporter should implement.
*/
@@ -122,17 +126,19 @@ typedef struct {
/*< public >*/
/**
* get_version:
- * @instance: the #NAIImporter provider.
+ * @instance: the NAIImporter provider.
*
- * This method is called by the &prodname; program each time
- * it needs to know which version of this interface the plugin
- * implements.
+ * Nautilus-Actions calls this method each time it needs to know
+ * which version of this interface the plugin implements.
*
* If this method is not implemented by the plugin,
- * the &prodname; program considers that the plugin only implements
- * the version 1 of the #NAIImporter interface.
+ * Nautilus-Actions considers that the plugin only implements
+ * the version 1 of the NAIImporter interface.
+ *
+ * Return value: if implemented, this method must return the version
+ * number of this interface the I/O provider is supporting.
*
- * Returns: the version of this interface supported by the plugin.
+ * Defaults to 1.
*
* Since: 2.30
*/
@@ -140,78 +146,35 @@ typedef struct {
/**
* import_from_uri:
- * @instance: the #NAIImporter provider.
- * @parms: a #NAIImporterImportFromUriParms structure.
+ * @instance: the NAIImporter provider.
+ * @parms: a NAIImporterImportFromUriParms structure.
*
* Imports an item.
*
- * Returns: the return code of the operation.
+ * If the provider implements the version 1 of this interface, then
+ * @parms is supposed to map to NAIImporterImportFromUriParms structure.
+ *
+ * Contrarily, if the provider implements the version 2 of the interface,
+ * then @parms is supposed to map to a NAIImporterImportFromUriParmsv2
+ * structure.
+ *
+ * Return value: the return code of the operation.
*
* Since: 2.30
*/
- guint ( *import_from_uri )( const NAIImporter *instance, NAIImporterImportFromUriParms *parms );
+ guint ( *import_from_uri )( const NAIImporter *instance, void *parms );
}
NAIImporterInterface;
#ifdef NA_ENABLE_DEPRECATED
/**
- * NAIImporterImportMode:
- * @IMPORTER_MODE_NO_IMPORT: a "do not import" mode.
- * @IMPORTER_MODE_RENUMBER: reallocate a new id when the imported one already exists.
- * @IMPORTER_MODE_OVERRIDE: override the existing id with the imported one.
- * @IMPORTER_MODE_ASK: ask the user for what to do with this particular item.
- *
- * Define the mode of an import operation.
- *
- * Deprecated: 3.2
- */
-typedef enum {
- IMPORTER_MODE_NO_IMPORT = 1,
- IMPORTER_MODE_RENUMBER,
- IMPORTER_MODE_OVERRIDE,
- IMPORTER_MODE_ASK
-}
- NAIImporterImportMode;
-#endif
-
-/**
- * NAIImporterImportStatus:
- * @IMPORTER_CODE_OK: import ok.
- * @IMPORTER_CODE_PROGRAM_ERROR: a program error has been detected.
- * You should open a bug in
- * <ulink url="https://bugzilla.gnome.org/enter_bug.cgi?product=nautilus-actions">Bugzilla</ulink>.
- * @IMPORTER_CODE_NOT_WILLING_TO: the plugin is not willing to import the uri.
- * @IMPORTER_CODE_NO_ITEM_ID: item id not found.
- * @IMPORTER_CODE_NO_ITEM_TYPE: item type not found.
- * @IMPORTER_CODE_UNKNOWN_ITEM_TYPE: unknown item type.
- * @IMPORTER_CODE_CANCELLED: operation cancelled by the user.
- * @IMPORTER_CODE_NOT_LOADABLE: the file is considered as not loadable at all.
- * This is not a matter of which I/O provider has been tried,
- * but the file is empty, or too big, or eventually not a
- * regular file.
- *
- * Define the return status of an import operation.
- */
-typedef enum {
- IMPORTER_CODE_OK = 0,
- IMPORTER_CODE_PROGRAM_ERROR,
- IMPORTER_CODE_NOT_WILLING_TO,
- IMPORTER_CODE_NO_ITEM_ID,
- IMPORTER_CODE_NO_ITEM_TYPE,
- IMPORTER_CODE_UNKNOWN_ITEM_TYPE,
- IMPORTER_CODE_CANCELLED,
- IMPORTER_CODE_NOT_LOADABLE
-}
- NAIImporterImportStatus;
-
-#ifdef NA_ENABLE_DEPRECATED
-/**
* NAIImporterCheckFn:
* @imported: the currently imported #NAObjectItem -derived object.
* @fn_data: some data to be passed to the function.
*
- * This function may be provided by the caller in order the #NAIImporter
- * provider be able to check for pre-existence of the imported item.
+ * In version 1 of the interface, this function may be provided by
+ * the caller in order the #NAIImporter provider be able to check for
+ * pre-existence of the imported item.
* This function should return the already existing item which has the
* same id than the currently being imported one, or %NULL if the
* imported id will be unique.
@@ -251,9 +214,9 @@ typedef NAObjectItem * ( *NAIImporterCheckFn )( const NAObjectItem *, void * );
* @existing: an already existing #NAObjectItem with same id.
* @fn_data: some data to be passed to the function.
*
- * This function may be provided by the caller as a convenience way for
- * the #NAIImporter to ask the user to know what to do in the case of a
- * duplicate id.
+ * In version 1 of the interface, this function may be provided by the
+ * caller as a convenience way for the #NAIImporter to ask the user to
+ * know what to do in the case of a duplicate id.
*
* If this function is not provided, and the #NAIImporter does not have
* any other way to ask the user, then a 'no import' policy should be
@@ -268,150 +231,184 @@ typedef NAObjectItem * ( *NAIImporterCheckFn )( const NAObjectItem *, void * );
typedef guint ( *NAIImporterAskUserFn )( const NAObjectItem *, const NAObjectItem *, void * );
/**
- * NAIImporterImportFromUriParmsv1:
- * @version: the version of this structure.
- * input;
- * since version 1 of the structure.
- * @uri: uri of the file to be imported.
- * input;
- * since version 1 of the structure.
- * @asked_mode: asked import mode.
- * input;
- * since version 1 of the structure.
- * @exist: whether the imported Id already existed.
- * output;
- * since version 1 of the structure.
- * @import_mode: actually used import mode.
- * output;
- * since version 1 of the structure.
- * @imported: the imported #NAObjectItem -derived object, or %NULL.
- * output;
- * since version 1 of the structure.
- * @check_fn: a NAIImporterCheckFn() function to check the existence of the imported id.
- * input;
- * since version 1 of the structure.
- * @check_fn_data: @check_fn data
- * input;
- * since version 1 of the structure.
- * @ask_fn: a NAIImporterAskUserFn() function to ask the user what to do in case of a duplicate id
- * input;
- * since version 1 of the structure.
- * @ask_fn_data: @ask_fn data
- * input;
- * since version 1 of the structure.
- * @messages: a #GSList list of localized strings;
- * the provider may append messages to this list, but shouldn't reinitialize it
- * input/output;
- * since version 1 of the structure.
+ * NAIImporterManageImportModeParms:
+ * @version: [in] the version of the structure content, equals to 1;
+ * since structure version 1.
+ * @imported: [in] the imported #NAObjectItem -derived object;
+ * since structure version 1.
+ * @asked_mode: [in] asked import mode;
+ * since structure version 1.
+ * @check_fn: [in] a #NAIImporterCheckFn function to check the existence of the imported id;
+ * since structure version 1.
+ * @check_fn_data: [in] @check_fn data;
+ * since structure version 1.
+ * @ask_fn: [in] a #NAIImporterAskUserFn function to ask the user what to do in case of a duplicate id;
+ * since structure version 1.
+ * @ask_fn_data: [in] @ask_fn data;
+ * since structure version 1.
+ * @exist: [out] whether the imported Id already existed;
+ * since structure version 1.
+ * @import_mode: [out] actually used import mode;
+ * since structure version 1.
+ * @messages: [in/out] a #GSList list of localized strings;
+ * the provider may append messages to this list, but shouldn't reinitialize it;
+ * since structure version 1.
*
- * This structure allows all used parameters when importing from an URI
+ * This structure allows all used parameters when managing the import mode
* to be passed and received through a single structure.
*
* Since: 2.30
* Deprecated: 3.2
*/
-struct _NAIImporterImportFromUriParmsv1 {
+typedef struct {
guint version;
- gchar *uri;
- guint asked_mode;
- gboolean exist;
- guint import_mode;
NAObjectItem *imported;
+ guint asked_mode;
NAIImporterCheckFn check_fn;
void *check_fn_data;
NAIImporterAskUserFn ask_fn;
void *ask_fn_data;
+ gboolean exist;
+ guint import_mode;
GSList *messages;
-};
-
-#endif /* NA_ENABLE_DEPRECATED */
+}
+ NAIImporterManageImportModeParms;
/**
- * NAIImporterImportFromUriParms:
- * @version: the version of this structure, currently equals to 2.
- * input;
- * since version 1 of the structure.
- * @uri: uri of the file to be imported.
- * input;
- * since version 1 of the structure.
- * @imported: the imported #NAObjectItem -derived object, or %NULL.
- * output;
- * since version 1 of the structure.
- * @messages: a #GSList list of localized strings;
- * the provider may append messages to this list, but shouldn't reinitialize it
- * input/output;
- * since version 1 of the structure.
+ * NAIImporterImportMode:
+ * @IMPORTER_MODE_NO_IMPORT: a "do not import" mode.
+ * @IMPORTER_MODE_RENUMBER: reallocate a new id when the imported one already exists.
+ * @IMPORTER_MODE_OVERRIDE: override the existing id with the imported one.
+ * @IMPORTER_MODE_ASK: ask the user for what to do with this particular item.
*
- * This structure allows all used parameters when importing from an URI
- * to be passed and received through a single structure.
+ * Define the mode of an import operation.
*
- * Since: 2.30
+ * Deprecated: 3.2
*/
-struct _NAIImporterImportFromUriParms {
- guint version;
- const gchar *uri;
- NAObjectItem *imported;
- GSList *messages;
-};
+typedef enum {
+ IMPORTER_MODE_NO_IMPORT = 1,
+ IMPORTER_MODE_RENUMBER,
+ IMPORTER_MODE_OVERRIDE,
+ IMPORTER_MODE_ASK
+}
+ NAIImporterImportMode;
+
+guint na_iimporter_manage_import_mode( NAIImporterManageImportModeParms *parms );
-#ifdef NA_ENABLE_DEPRECATED
/**
- * NAIImporterManageImportModeParms:
- * @version: the version of this structure, currently equals to 1.
- * input;
- * since version 1 of the structure.
- * @imported: the imported #NAObjectItem -derived object
- * @asked_mode: asked import mode
- * @check_fn: a #NAIImporterCheckFn function to check the existence of the imported id.
- * input;
- * since version 1 of the structure.
- * @check_fn_data: @check_fn data
- * input;
- * since version 1 of the structure.
- * @ask_fn: a #NAIImporterAskUserFn function to ask the user what to do in case of a duplicate id
- * input;
- * since version 1 of the structure.
- * @ask_fn_data: @ask_fn data
- * input;
- * since version 1 of the structure.
- * @exist: whether the imported Id already existed
- * output;
- * since version 1 of the structure.
- * @import_mode: actually used import mode
- * output;
- * since version 1 of the structure.
- * @messages: a #GSList list of localized strings;
- * the provider may append messages to this list, but shouldn't reinitialize it
- * input/output;
- * since version 1 of the structure.
+ * NAIImporterImportFromUriParms:
+ * @version: [in] the version of this structure;
+ * since structure version 1.
+ * @uri: [in] uri of the file to be imported;
+ * since structure version 1.
+ * @asked_mode: [in] asked import mode;
+ * since structure version 1.
+ * @exist: [out] whether the imported Id already existed;
+ * since structure version 1.
+ * @import_mode: [out] actually used import mode;
+ * since structure version 1.
+ * @imported: [out] the imported #NAObjectItem -derived object, or %NULL;
+ * since structure version 1.
+ * @check_fn: [in] a NAIImporterCheckFn() function to check the existence
+ * of the imported id;
+ * since structure version 1.
+ * @check_fn_data: [in] @check_fn data;
+ * since structure version 1.
+ * @ask_fn: [in] a NAIImporterAskUserFn() function to ask the user what to
+ * do in case of a duplicate id;
+ * since structure version 1.
+ * @ask_fn_data: [in] @ask_fn data;
+ * since structure version 1.
+ * @messages: [in/out] a #GSList list of localized strings;
+ * the provider may append messages to this list, but
+ * shouldn't reinitialize it;
+ * since structure version 1.
*
- * This structure allows all used parameters when managing the import mode
+ * This structure allows all used parameters when importing from an URI
* to be passed and received through a single structure.
*
* Since: 2.30
* Deprecated: 3.2
*/
-struct _NAIImporterManageImportModeParms {
+typedef struct {
guint version;
- NAObjectItem *imported;
+ gchar *uri;
guint asked_mode;
+ gboolean exist;
+ guint import_mode;
+ NAObjectItem *imported;
NAIImporterCheckFn check_fn;
void *check_fn_data;
NAIImporterAskUserFn ask_fn;
void *ask_fn_data;
- gboolean exist;
- guint import_mode;
GSList *messages;
-};
+}
+ NAIImporterImportFromUriParms;
+
#endif /* NA_ENABLE_DEPRECATED */
-GType na_iimporter_get_type( void );
+/**
+ * NAIImporterImportStatus:
+ * @IMPORTER_CODE_OK: import ok.
+ * @IMPORTER_CODE_PROGRAM_ERROR: a program error has been detected.
+ * You should open a bug in
+ * <ulink url="https://bugzilla.gnome.org/enter_bug.cgi?product=nautilus-actions">Bugzilla</ulink>.
+ * @IMPORTER_CODE_NOT_WILLING_TO: the plugin is not willing to import the uri.
+ * @IMPORTER_CODE_NO_ITEM_ID: item id not found.
+ * @IMPORTER_CODE_NO_ITEM_TYPE: item type not found.
+ * @IMPORTER_CODE_UNKNOWN_ITEM_TYPE: unknown item type.
+ * @IMPORTER_CODE_CANCELLED: operation cancelled by the user.
+ * @IMPORTER_CODE_NOT_LOADABLE: the file is considered as not loadable at all.
+ * This is not a matter of which I/O provider has been tried,
+ * but the file is empty, or too big, or eventually not a
+ * regular file.
+ *
+ * Define the return status of an import operation.
+ */
+typedef enum {
+ IMPORTER_CODE_OK = 0,
+ IMPORTER_CODE_PROGRAM_ERROR,
+ IMPORTER_CODE_NOT_WILLING_TO,
+ IMPORTER_CODE_NO_ITEM_ID,
+ IMPORTER_CODE_NO_ITEM_TYPE,
+ IMPORTER_CODE_UNKNOWN_ITEM_TYPE,
+ IMPORTER_CODE_CANCELLED,
+ IMPORTER_CODE_NOT_LOADABLE
+}
+ NAIImporterImportStatus;
+
+/**
+ * NAIImporterImportFromUriParmsv2:
+ * @version: [in] the version of the structure, equals to 2;
+ * since structure version 1.
+ * @content: [in] the version of the description content, equals to 1;
+ * since structure version 2.
+ * @uri: [in] uri of the file to be imported;
+ * since structure version 1.
+ * @imported: [out] the imported #NAObjectItem -derived object, or %NULL;
+ * since structure version 1.
+ * @messages: [in/out] a #GSList list of localized strings;
+ * the provider may append messages to this list, but
+ * shouldn't reinitialize it;
+ * since structure version 1.
+ *
+ * This structure allows all used parameters when importing from an URI
+ * to be passed and received through a single structure.
+ *
+ * Since: 3.2
+ */
+typedef struct {
+ guint version;
+ guint content;
+ const gchar *uri;
+ NAObjectItem *imported;
+ GSList *messages;
+}
+ NAIImporterImportFromUriParmsv2;
-guint na_iimporter_import_from_uri( const NAIImporter *importer, NAIImporterImportFromUriParms *parms );
+GType na_iimporter_get_type ( void );
-#ifdef NA_ENABLE_DEPRECATED
-guint na_iimporter_manage_import_mode( NAIImporterManageImportModeParms *parms );
-#endif
+guint na_iimporter_import_from_uri( const NAIImporter *importer, NAIImporterImportFromUriParmsv2 *parms );
G_END_DECLS
diff --git a/src/core/na-iimporter.c b/src/core/na-iimporter.c
index 27a9f1f..6b7f5f6 100644
--- a/src/core/na-iimporter.c
+++ b/src/core/na-iimporter.c
@@ -146,23 +146,28 @@ iimporter_get_version( const NAIImporter *instance )
/**
* na_iimporter_import_from_uri:
* @importer: this #NAIImporter instance.
- * @parms: a #NAIImporterImportFromUriParms structure.
+ * @parms: a #NAIImporterImportFromUriParmsv2 structure.
*
* Tries to import a #NAObjectItem from the URI specified in @parms, returning
* the result in <structfield>@parms->imported</structfield>.
*
+ * Note that, starting with &prodname; 3.2, the @parms argument is no more a
+ * #NAIImporterImportFromUriParms pointer, but a #NAIImporterImportFromUriParmsv2
+ * one.
+ *
* Returns: the return code of the operation.
*
* Since: 2.30
*/
guint
-na_iimporter_import_from_uri( const NAIImporter *importer, NAIImporterImportFromUriParms *parms )
+na_iimporter_import_from_uri( const NAIImporter *importer, NAIImporterImportFromUriParmsv2 *parms )
{
static const gchar *thisfn = "na_iimporter_import_from_uri";
guint code;
g_return_val_if_fail( NA_IS_IIMPORTER( importer ), IMPORTER_CODE_PROGRAM_ERROR );
+ g_return_val_if_fail( parms && parms->version == 2, IMPORTER_CODE_PROGRAM_ERROR );
code = IMPORTER_CODE_NOT_WILLING_TO;
@@ -179,7 +184,7 @@ na_iimporter_import_from_uri( const NAIImporter *importer, NAIImporterImportFrom
#ifdef NA_ENABLE_DEPRECATED
/**
* na_iimporter_manage_import_mode:
- * @parms: a NAIImporterManageImportModeParms struct.
+ * @parms: a #NAIImporterManageImportModeParms struct.
*
* Returns: the #NAIImporterImportStatus status of the operation:
*
@@ -208,6 +213,7 @@ na_iimporter_import_from_uri( const NAIImporter *importer, NAIImporterImportFrom
* </itemizedlist>
*
* Since: 2.30
+ * Deprecated: 3.2
*/
guint
na_iimporter_manage_import_mode( NAIImporterManageImportModeParms *parms )
diff --git a/src/core/na-importer.c b/src/core/na-importer.c
index 60db120..6e39cb1 100644
--- a/src/core/na-importer.c
+++ b/src/core/na-importer.c
@@ -217,7 +217,7 @@ static NAImporterResult *
import_from_uri( const NAPivot *pivot, GList *modules, const gchar *uri )
{
NAImporterResult *result;
- NAIImporterImportFromUriParms provider_parms;
+ NAIImporterImportFromUriParmsv2 provider_parms;
GList *im;
guint code;
GSList *all_messages;
@@ -228,8 +228,9 @@ import_from_uri( const NAPivot *pivot, GList *modules, const gchar *uri )
provider = NULL;
code = IMPORTER_CODE_NOT_WILLING_TO;
- memset( &provider_parms, '\0', sizeof( NAIImporterImportFromUriParms ));
+ memset( &provider_parms, '\0', sizeof( NAIImporterImportFromUriParmsv2 ));
provider_parms.version = 2;
+ provider_parms.content = 1;
provider_parms.uri = uri;
for( im = modules ;
diff --git a/src/io-desktop/nadp-reader.c b/src/io-desktop/nadp-reader.c
index 02aae5c..dde79cd 100644
--- a/src/io-desktop/nadp-reader.c
+++ b/src/io-desktop/nadp-reader.c
@@ -360,17 +360,20 @@ free_desktop_paths( GList *paths )
* thus no more checking here against possible duplicate identifiers.
*/
guint
-nadp_reader_iimporter_import_from_uri( const NAIImporter *instance, NAIImporterImportFromUriParms *parms )
+nadp_reader_iimporter_import_from_uri( const NAIImporter *instance, void *parms_ptr )
{
static const gchar *thisfn = "nadp_reader_iimporter_import_from_uri";
guint code;
+ NAIImporterImportFromUriParmsv2 *parms;
NadpDesktopFile *ndf;
- g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, ( void * ) parms );
+ g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, parms_ptr );
g_return_val_if_fail( NA_IS_IIMPORTER( instance ), IMPORTER_CODE_PROGRAM_ERROR );
g_return_val_if_fail( NADP_IS_DESKTOP_PROVIDER( instance ), IMPORTER_CODE_PROGRAM_ERROR );
+ parms = ( NAIImporterImportFromUriParmsv2 * ) parms_ptr;
+
if( !na_core_utils_file_is_loadable( parms->uri )){
code = IMPORTER_CODE_NOT_LOADABLE;
return( code );
diff --git a/src/io-desktop/nadp-reader.h b/src/io-desktop/nadp-reader.h
index c01f5ad..3dd5101 100644
--- a/src/io-desktop/nadp-reader.h
+++ b/src/io-desktop/nadp-reader.h
@@ -39,7 +39,7 @@ G_BEGIN_DECLS
GList *nadp_iio_provider_read_items ( const NAIIOProvider *provider, GSList **messages );
-guint nadp_reader_iimporter_import_from_uri ( const NAIImporter *instance, NAIImporterImportFromUriParms *parms );
+guint nadp_reader_iimporter_import_from_uri ( const NAIImporter *instance, void *parms_ptr );
void nadp_reader_ifactory_provider_read_start( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, GSList **messages );
NADataBoxed *nadp_reader_ifactory_provider_read_data ( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, const NADataDef *iddef, GSList **messages );
diff --git a/src/io-xml/naxml-reader.c b/src/io-xml/naxml-reader.c
index 832a36a..7964447 100644
--- a/src/io-xml/naxml-reader.c
+++ b/src/io-xml/naxml-reader.c
@@ -74,25 +74,25 @@ typedef struct {
* to import. We thus have one NAXMLReader object per import operation.
*/
struct _NAXMLReaderPrivate {
- gboolean dispose_has_run;
+ gboolean dispose_has_run;
/* data provided by the caller
*/
- NAIImporter *importer;
- NAIImporterImportFromUriParms *parms;
+ NAIImporter *importer;
+ NAIImporterImportFromUriParmsv2 *parms;
/* data dynamically set during the import operation
*/
- gboolean type_found;
- GList *nodes;
- GList *dealt;
- RootNodeStr *root_node_str;
- gchar *item_id;
+ gboolean type_found;
+ GList *nodes;
+ GList *dealt;
+ RootNodeStr *root_node_str;
+ gchar *item_id;
/* following values are reset and reused while iterating on each
* element nodes of the imported item (cf. reset_node_data())
*/
- gboolean node_ok;
+ gboolean node_ok;
};
extern NAXMLKeyStr naxml_schema_key_schema_str[];
@@ -307,7 +307,7 @@ reader_new( void )
/**
* naxml_reader_import_uri:
* @instance: the #NAIImporter provider.
- * @parms: a #NAIImporterUriParms structure.
+ * @parms: a #NAIImporterImportFromUriParmsv2 structure.
*
* Imports an item.
*
@@ -321,16 +321,18 @@ reader_new( void )
* thus no more checking here against possible duplicate identifiers.
*/
guint
-naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterImportFromUriParms *parms )
+naxml_reader_import_from_uri( const NAIImporter *instance, void *parms_ptr )
{
static const gchar *thisfn = "naxml_reader_import_from_uri";
NAXMLReader *reader;
+ NAIImporterImportFromUriParmsv2* parms;
guint code;
- g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, ( void * ) parms );
+ g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, parms_ptr );
g_return_val_if_fail( NA_IS_IIMPORTER( instance ), IMPORTER_CODE_PROGRAM_ERROR );
+ parms = ( NAIImporterImportFromUriParmsv2 * ) parms_ptr;
parms->imported = NULL;
if( !na_core_utils_file_is_loadable( parms->uri )){
diff --git a/src/io-xml/naxml-reader.h b/src/io-xml/naxml-reader.h
index 0426e42..a8ead05 100644
--- a/src/io-xml/naxml-reader.h
+++ b/src/io-xml/naxml-reader.h
@@ -78,7 +78,7 @@ typedef struct {
GType naxml_reader_get_type( void );
-guint naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterImportFromUriParms *parms );
+guint naxml_reader_import_from_uri( const NAIImporter *instance, void *parms_ptr );
void naxml_reader_read_start( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages );
NADataBoxed *naxml_reader_read_data ( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, const NADataDef *def, GSList **messages );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]