[nautilus-actions] Refactor NAImporterAsk dialog



commit a1b1a3b44380c1bba99e17228c1d607c470d4cc3
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Feb 25 01:08:23 2010 +0100

    Refactor NAImporterAsk dialog

 ChangeLog                                |   18 +
 src/api/na-iimporter.h                   |   11 +-
 src/core/Makefile.am                     |   16 +-
 src/core/na-iimporter.c                  |   23 +
 src/core/na-importer-ask.c               |  454 ++++++++++
 src/core/na-importer-ask.h               |   77 ++
 src/core/na-iprefs.c                     |   78 ++
 src/core/na-iprefs.h                     |   10 +-
 src/io-xml/naxml-reader.c                | 1373 +++---------------------------
 src/nact/Makefile.am                     |    2 -
 src/nact/nact-assistant-import.c         |  131 ++-
 src/nact/nact-import-ask.c               |  419 ---------
 src/nact/nact-import-ask.h               |   81 --
 src/nact/nact-iprefs.c                   |   82 --
 src/nact/nact-iprefs.h                   |    5 -
 src/nact/nact-main-window.h              |    2 +-
 src/nact/nact-preferences-editor.c       |   12 +-
 src/nact/nact-tree-model-dnd.c           |   12 +-
 src/nact/nautilus-actions-config-tool.ui |  219 +-----
 src/test/test-reader.c                   |    4 +-
 20 files changed, 930 insertions(+), 2099 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 94aa7a6..23a5b56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2009-02-24 Pierre Wieser <pwieser trychlos org>
 
+	* src/api/na-iimporter.h:
+	* src/core/Makefile.am:
+	* src/core/na-iimporter.c:
+	* src/core/na-importer-ask.c:
+	* src/core/na-importer-ask.h:
+	* src/core/na-iprefs.c:
+	* src/core/na-iprefs.h:
+	* src/io-xml/naxml-reader.c:
+	* src/nact/Makefile.am:
+	* src/nact/nact-assistant-import.c:
+	* src/nact/nact-iprefs.c:
+	* src/nact/nact-iprefs.h:
+	* src/nact/nact-main-window.h:
+	* src/nact/nact-preferences-editor.c:
+	* src/nact/nact-tree-model-dnd.c:
+	* src/nact/nautilus-actions-config-tool.ui:
+	* src/test/test-reader.c: ImporterAsk dialog.
+
 	* src/io-xml/naxml-keys.c:
 	* src/io-xml/naxml-keys.h:
 	* src/io-xml/naxml-reader.c: Able to import type 3 XML files.
diff --git a/src/api/na-iimporter.h b/src/api/na-iimporter.h
index 6eeea1d..5299d23 100644
--- a/src/api/na-iimporter.h
+++ b/src/api/na-iimporter.h
@@ -41,6 +41,8 @@
  * Nautilus-Actions v 2.30 - API version:  1
  */
 
+#include <gtk/gtk.h>
+
 #include "na-object-item.h"
 
 G_BEGIN_DECLS
@@ -112,15 +114,16 @@ enum {
 
 /* parameters via a structure
  */
-typedef gboolean ( *NAIImporterCheckFn )( const NAObjectItem *, void *fn_data );
+typedef NAObjectItem * ( *NAIImporterCheckFn )( const NAObjectItem *, void *fn_data );
 
 struct NAIImporterParms {
 	guint              version;			/* i 1: version of this structure */
 	gchar             *uri;				/* i 1: uri of the file to be imported */
 	guint              mode;			/* i 1: import mode */
+	GtkWindow         *window;			/* i 1: a window which will act as a parent of the ask dialog */
 	NAObjectItem      *item;			/*  o1: imported NAObjectItem-derived object */
-	NAIImporterCheckFn fn;				/* i 1: a function to check the existance of the imported item */
-	void              *fn_data;			/* i 1: data function */
+	NAIImporterCheckFn check_fn;		/* i 1: a function to check the existance of the imported item */
+	void              *check_fn_data;	/* i 1: data function */
 	GSList            *messages;		/* io1: a #GSList list of localized strings;
 										 *       the provider may append messages to this list,
 										 *       but shouldn't reinitialize it. */
@@ -128,6 +131,8 @@ struct NAIImporterParms {
 
 GType na_iimporter_get_type( void );
 
+guint na_iimporter_ask_user( const NAIImporter *importer, const NAIImporterParms *parms, const NAObjectItem *existing );
+
 G_END_DECLS
 
 #endif /* __NAUTILUS_ACTIONS_API_NA_IIMPORTER_H__ */
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 617d57e..bfdfd5b 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -31,8 +31,9 @@ pkglib_LTLIBRARIES = libna-core.la
 AM_CPPFLAGS += \
 	-I $(top_srcdir)									\
 	-I $(top_srcdir)/src								\
-	-DPKGLIBDIR=\""$(pkglibdir)"\"						\
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"			\
+	-DPKGDATADIR=\"$(pkgdatadir)\"						\
+	-DPKGLIBDIR=\""$(pkglibdir)"\"						\
 	-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_CORE}\"				\
 	$(NAUTILUS_ACTIONS_CFLAGS)							\
 	$(NULL)
@@ -65,6 +66,8 @@ libna_core_la_SOURCES = \
 	na-io-provider.h									\
 	na-importer.c										\
 	na-importer.h										\
+	na-importer-ask.c									\
+	na-importer-ask.h									\
 	na-ipivot-consumer.c								\
 	na-ipivot-consumer.h								\
 	na-iprefs.c											\
@@ -96,3 +99,14 @@ libna_core_la_LDFLAGS = \
 	-no-undefined										\
 	-version-number $(VERSION_INFO)						\
 	$(NULL)
+
+pkgdata_DATA = \
+	na-importer-ask.ui									\
+	$(NULL)
+
+EXTRA_DIST = \
+	$(pkgdata_DATA)										\
+	$(NULL)
+
+uninstall-hook:
+	-\rm -fr $(DESTDIR)$(pkgdatadir)
diff --git a/src/core/na-iimporter.c b/src/core/na-iimporter.c
index b7b3d66..196f1d7 100644
--- a/src/core/na-iimporter.c
+++ b/src/core/na-iimporter.c
@@ -34,6 +34,8 @@
 
 #include <api/na-iimporter.h>
 
+#include "na-importer-ask.h"
+
 /* private interface data
  */
 struct NAIImporterInterfacePrivate {
@@ -135,3 +137,24 @@ iimporter_get_version( const NAIImporter *instance )
 {
 	return( 1 );
 }
+
+/**
+ * na_iimporter_ask_user:
+ * @importer: this #NAIImporter instance.
+ * @parms: a #NAIImporterParms structure.
+ * @existing: the #NAObjectItem-derived already existing object.
+ *
+ * Ask the user for what to do when an imported item has the same ID
+ * that an already existing one.
+ *
+ * Returns: the definitive import mode.
+ */
+guint
+na_iimporter_ask_user( const NAIImporter *importer, const NAIImporterParms *parms, const NAObjectItem *existing )
+{
+	guint mode;
+
+	mode = na_importer_ask_user( parms, existing );
+
+	return( mode );
+}
diff --git a/src/core/na-importer-ask.c b/src/core/na-importer-ask.c
new file mode 100644
index 0000000..7420b16
--- /dev/null
+++ b/src/core/na-importer-ask.c
@@ -0,0 +1,454 @@
+/*
+ * 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 <gconf/gconf-client.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include <api/na-object-api.h>
+
+#include "na-iprefs.h"
+#include "na-importer-ask.h"
+
+/* private class data
+ */
+struct NAImporterAskClassPrivate {
+	void *empty;						/* so that gcc -pedantic is happy */
+};
+
+/* private instance data
+ */
+struct NAImporterAskPrivate {
+	gboolean          dispose_has_run;
+	GtkBuilder       *builder;
+	GtkWindow        *toplevel;
+	NAIImporterParms *parms;
+	NAObjectItem     *existing;
+	guint             mode;
+	GConfClient      *gconf;
+	gint              dialog_code;
+};
+
+static GtkDialogClass *st_parent_class = NULL;
+
+static GType      register_type( void );
+static void       class_init( NAImporterAskClass *klass );
+static void       instance_init( GTypeInstance *instance, gpointer klass );
+static void       instance_dispose( GObject *dialog );
+static void       instance_finalize( GObject *dialog );
+
+static NAImporterAsk *import_ask_new();
+
+static void       init_dialog( NAImporterAsk *editor );
+static void       on_cancel_clicked( GtkButton *button, NAImporterAsk *editor );
+static void       on_ok_clicked( GtkButton *button, NAImporterAsk *editor );
+static void       get_selected_mode( NAImporterAsk *editor );
+static gboolean   on_dialog_response( NAImporterAsk *editor, gint code );
+static GtkWidget *search_for_child_widget( GtkContainer *container, const gchar *name );
+
+GType
+na_importer_ask_get_type( void )
+{
+	static GType dialog_type = 0;
+
+	if( !dialog_type ){
+		dialog_type = register_type();
+	}
+
+	return( dialog_type );
+}
+
+static GType
+register_type( void )
+{
+	static const gchar *thisfn = "na_importer_ask_register_type";
+	GType type;
+
+	static GTypeInfo info = {
+		sizeof( NAImporterAskClass ),
+		( GBaseInitFunc ) NULL,
+		( GBaseFinalizeFunc ) NULL,
+		( GClassInitFunc ) class_init,
+		NULL,
+		NULL,
+		sizeof( NAImporterAsk ),
+		0,
+		( GInstanceInitFunc ) instance_init
+	};
+
+	g_debug( "%s", thisfn );
+
+	type = g_type_register_static( GTK_TYPE_DIALOG, "NAImporterAsk", &info, 0 );
+
+	return( type );
+}
+
+static void
+class_init( NAImporterAskClass *klass )
+{
+	static const gchar *thisfn = "na_importer_ask_class_init";
+	GObjectClass *object_class;
+
+	g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+
+	st_parent_class = g_type_class_peek_parent( klass );
+
+	object_class = G_OBJECT_CLASS( klass );
+	object_class->dispose = instance_dispose;
+	object_class->finalize = instance_finalize;
+
+	klass->private = g_new0( NAImporterAskClassPrivate, 1 );
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+	static const gchar *thisfn = "na_importer_ask_instance_init";
+	NAImporterAsk *self;
+	GError *error;
+
+	g_debug( "%s: instance=%p (%s), klass=%p",
+			thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ), ( void * ) klass );
+
+	g_return_if_fail( NA_IS_IMPORTER_ASK( instance ));
+	self = NA_IMPORTER_ASK( instance );
+
+	self->private = g_new0( NAImporterAskPrivate, 1 );
+
+	self->private->dispose_has_run = FALSE;
+
+	self->private->builder = gtk_builder_new();
+
+	error = NULL;
+	gtk_builder_add_from_file( self->private->builder, PKGDATADIR "/na-importer-ask.ui", &error );
+	if( error ){
+		g_warning( "%s: %s", thisfn, error->message );
+		g_error_free( error );
+
+	} else {
+		self->private->toplevel = GTK_WINDOW( gtk_builder_get_object( self->private->builder, "ImporterAskDialog" ));
+	}
+}
+
+static void
+instance_dispose( GObject *dialog )
+{
+	static const gchar *thisfn = "na_importer_ask_instance_dispose";
+	NAImporterAsk *self;
+
+	g_debug( "%s: dialog=%p (%s)", thisfn, ( void * ) dialog, G_OBJECT_TYPE_NAME( dialog ));
+
+	g_return_if_fail( NA_IS_IMPORTER_ASK( dialog ));
+	self = NA_IMPORTER_ASK( dialog );
+
+	if( !self->private->dispose_has_run ){
+
+		g_object_unref( self->private->builder );
+
+		self->private->dispose_has_run = TRUE;
+
+		/* chain up to the parent class */
+		if( G_OBJECT_CLASS( st_parent_class )->dispose ){
+			G_OBJECT_CLASS( st_parent_class )->dispose( dialog );
+		}
+	}
+}
+
+static void
+instance_finalize( GObject *dialog )
+{
+	static const gchar *thisfn = "na_importer_ask_instance_finalize";
+	NAImporterAsk *self;
+
+	g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
+	g_return_if_fail( NA_IS_IMPORTER_ASK( dialog ));
+	self = NA_IMPORTER_ASK( dialog );
+
+	g_free( self->private );
+
+	/* chain call to parent class */
+	if( G_OBJECT_CLASS( st_parent_class )->finalize ){
+		G_OBJECT_CLASS( st_parent_class )->finalize( dialog );
+	}
+}
+
+/*
+ * Returns a newly allocated NAImporterAsk object.
+ */
+static NAImporterAsk *
+import_ask_new()
+{
+	return( g_object_new( NA_IMPORTER_ASK_TYPE, NULL ));
+}
+
+/**
+ * na_importer_ask_user:
+ * @importer: this #NAIImporter instance.
+ * @parms: a #NAIImporterParms structure.
+ * @existing: the #NAObjectItem-derived already existing object.
+ *
+ * Ask the user for what to do when an imported item has the same ID
+ * that an already existing one.
+ *
+ * Returns: the definitive import mode.
+ *
+ * When the user selects 'Keep same choice without asking me', this choice
+ * becomes his preference import mode.
+ */
+guint
+na_importer_ask_user( const NAIImporterParms *parms, const NAObjectItem *existing )
+{
+	static const gchar *thisfn = "na_importer_ask_user";
+	NAImporterAsk *dialog;
+	guint mode;
+	gint code;
+
+	g_return_val_if_fail( NA_IS_OBJECT_ITEM( existing ), IMPORTER_MODE_NO_IMPORT );
+
+	g_debug( "%s: parms=%p, existing=%p", thisfn, ( void * ) parms, ( void * ) existing );
+
+	mode = IMPORTER_MODE_NO_IMPORT;
+	dialog = import_ask_new();
+
+	if( dialog->private->toplevel ){
+
+		dialog->private->parms = ( NAIImporterParms * ) parms;
+		dialog->private->existing = ( NAObjectItem * ) existing;
+		dialog->private->gconf = gconf_client_get_default();
+		dialog->private->mode = na_iprefs_get_import_mode( dialog->private->gconf, IPREFS_IMPORT_ASK_LAST_MODE );
+
+		init_dialog( dialog );
+		/* toplevel is modal, not dialog
+		g_debug( "dialog is modal: %s", gtk_window_get_modal( GTK_WINDOW( dialog )) ? "True":"False" );
+		g_debug( "toplevel is modal: %s", gtk_window_get_modal( dialog->private->toplevel ) ? "True":"False" );*/
+		do {
+			code = gtk_dialog_run( GTK_DIALOG( dialog->private->toplevel ));
+		} while ( !on_dialog_response( dialog, code ));
+
+		mode = dialog->private->mode;
+
+		gtk_widget_hide_all( GTK_WIDGET( dialog->private->toplevel ));
+		gtk_widget_destroy( GTK_WIDGET( dialog->private->toplevel ));
+
+	} else {
+		g_object_unref( dialog );
+	}
+
+	return( mode );
+}
+
+static void
+init_dialog( NAImporterAsk *editor )
+{
+	static const gchar *thisfn = "na_importer_ask_init_dialog";
+	gchar *imported_label, *existing_label;
+	gchar *label;
+	GtkWidget *widget;
+	GtkWidget *button;
+
+	g_return_if_fail( NA_IS_IMPORTER_ASK( editor ));
+
+	g_debug( "%s: editor=%p", thisfn, ( void * ) editor );
+
+	imported_label = na_object_get_label( editor->private->parms->item );
+	existing_label = na_object_get_label( editor->private->existing );
+
+	if( NA_IS_OBJECT_ACTION( editor->private->parms->item )){
+		/* i18n: The action <action_label> imported from <file> has the same id than <existing_label> */
+		label = g_strdup_printf(
+				_( "The action \"%s\" imported from \"%s\" has the same identifiant than the already existing \"%s\"." ),
+				imported_label, editor->private->parms->uri, existing_label );
+
+	} else {
+		/* i18n: The menu <menu_label> imported from <file> has the same id than <existing_label> */
+		label = g_strdup_printf(
+				_( "The menu \"%s\" imported from \"%s\" has the same identifiant than the already existing \"%s\"." ),
+				imported_label, editor->private->parms->uri, existing_label );
+	}
+
+	widget = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "ImporterAskLabel" );
+	gtk_label_set_text( GTK_LABEL( widget ), label );
+	g_free( label );
+
+	switch( editor->private->mode ){
+		case IMPORTER_MODE_RENUMBER:
+			button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskRenumberButton" );
+			break;
+
+		case IMPORTER_MODE_OVERRIDE:
+			button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskOverrideButton" );
+			break;
+
+		case IMPORTER_MODE_NO_IMPORT:
+		default:
+			button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskNoImportButton" );
+			break;
+	}
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), TRUE );
+
+	button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), FALSE );
+
+	button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "OKButton" );
+	g_signal_connect(
+			G_OBJECT( button ),
+			"clicked",
+			G_CALLBACK( on_ok_clicked ),
+			editor );
+
+	button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "CancelButton" );
+	g_signal_connect(
+			G_OBJECT( button ),
+			"clicked",
+			G_CALLBACK( on_cancel_clicked ),
+			editor );
+
+	if( editor->private->parms->window ){
+		gtk_window_set_transient_for( editor->private->toplevel, editor->private->parms->window );
+	}
+
+	gtk_widget_show_all( GTK_WIDGET( editor->private->toplevel ));
+}
+
+static void
+on_cancel_clicked( GtkButton *button, NAImporterAsk *editor )
+{
+	g_debug( "na_importer_ask_on_cancel_clicked" );
+	editor->private->dialog_code = GTK_RESPONSE_CANCEL;
+	gtk_dialog_response( GTK_DIALOG( editor ), GTK_RESPONSE_CANCEL );
+}
+
+static void
+on_ok_clicked( GtkButton *button, NAImporterAsk *editor )
+{
+	g_debug( "na_importer_ask_on_ok_clicked" );
+	editor->private->dialog_code = GTK_RESPONSE_OK;
+	gtk_dialog_response( GTK_DIALOG( editor ), GTK_RESPONSE_OK );
+}
+
+static void
+get_selected_mode( NAImporterAsk *editor )
+{
+	guint import_mode;
+	GtkWidget *button;
+	gboolean keep;
+
+	import_mode = IMPORTER_MODE_NO_IMPORT;
+
+	button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskRenumberButton" );
+	if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+		import_mode = IMPORTER_MODE_RENUMBER;
+
+	} else {
+		button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskOverrideButton" );
+		if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
+			import_mode = IMPORTER_MODE_OVERRIDE;
+		}
+	}
+
+	editor->private->mode = import_mode;
+	na_iprefs_set_import_mode( editor->private->gconf, IPREFS_IMPORT_ASK_LAST_MODE, editor->private->mode );
+
+	button = search_for_child_widget( GTK_CONTAINER( editor->private->toplevel ), "AskKeepChoiceButton" );
+	keep = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
+	if( keep ){
+		na_iprefs_set_import_mode( editor->private->gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE, import_mode );
+	}
+}
+
+/*
+ * very curiously, the code sent by on_cancel_clicked() and
+ * on_ok_clicked() arrives here at zero ! we so rely on a private one !
+ */
+static gboolean
+on_dialog_response( NAImporterAsk *editor, gint code )
+{
+	static const gchar *thisfn = "na_importer_ask_on_dialog_response";
+
+	g_return_val_if_fail( NA_IS_IMPORTER_ASK( editor ), FALSE );
+
+	g_debug( "%s: editor=%p, code=%d", thisfn, ( void * ) editor, code );
+
+	switch( editor->private->dialog_code ){
+		case GTK_RESPONSE_CANCEL:
+			editor->private->mode = IMPORTER_MODE_NO_IMPORT;
+			return( TRUE );
+			break;
+
+		case GTK_RESPONSE_OK:
+			get_selected_mode( editor );
+			return( TRUE );
+			break;
+
+		case GTK_RESPONSE_NONE:
+		case GTK_RESPONSE_DELETE_EVENT:
+		case GTK_RESPONSE_CLOSE:
+			break;
+	}
+
+	return( FALSE );
+}
+
+static GtkWidget *
+search_for_child_widget( GtkContainer *container, const gchar *name )
+{
+	GList *children = gtk_container_get_children( container );
+	GList *ic;
+	GtkWidget *found = NULL;
+	GtkWidget *child;
+	const gchar *child_name;
+
+	for( ic = children ; ic ; ic = ic->next ){
+		if( GTK_IS_WIDGET( ic->data )){
+			child = GTK_WIDGET( ic->data );
+			child_name = gtk_buildable_get_name( GTK_BUILDABLE( child ));
+			if( child_name && strlen( child_name )){
+				/*g_debug( "%s: child=%s", thisfn, child_name );*/
+				if( !g_ascii_strcasecmp( name, child_name )){
+					found = child;
+					break;
+
+				} else if( GTK_IS_CONTAINER( child )){
+					found = search_for_child_widget( GTK_CONTAINER( child ), name );
+					if( found ){
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	g_list_free( children );
+	return( found );
+}
diff --git a/src/core/na-importer-ask.h b/src/core/na-importer-ask.h
new file mode 100644
index 0000000..c57e41d
--- /dev/null
+++ b/src/core/na-importer-ask.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 __CORE_NA_IMPORTER_ASK_H__
+#define __CORE_NA_IMPORTER_ASK_H__
+
+/**
+ * SECTION: na_importer_ask
+ * @short_description: #NAImporterAsk class definition.
+ * @include: core/na-iimporter-ask.h
+ *
+ * This class reates and manages a dialog. It is ran each time an
+ * imported action as the same ID as an existing one, and the user
+ * want to be ask to known what to do with it.
+ */
+
+#include <api/na-iimporter.h>
+
+G_BEGIN_DECLS
+
+#define NA_IMPORTER_ASK_TYPE				( na_importer_ask_get_type())
+#define NA_IMPORTER_ASK( object )			( G_TYPE_CHECK_INSTANCE_CAST( object, NA_IMPORTER_ASK_TYPE, NAImporterAsk ))
+#define NA_IMPORTER_ASK_CLASS( klass )		( G_TYPE_CHECK_CLASS_CAST( klass, NA_IMPORTER_ASK_TYPE, NAImporterAskClass ))
+#define NA_IS_IMPORTER_ASK( object )		( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_IMPORTER_ASK_TYPE ))
+#define NA_IS_IMPORTER_ASK_CLASS( klass )	( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_IMPORTER_ASK_TYPE ))
+#define NA_IMPORTER_ASK_GET_CLASS( object )	( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_IMPORTER_ASK_TYPE, NAImporterAskClass ))
+
+typedef struct NAImporterAskPrivate      NAImporterAskPrivate;
+
+typedef struct {
+	GtkDialog             parent;
+	NAImporterAskPrivate *private;
+}
+	NAImporterAsk;
+
+typedef struct NAImporterAskClassPrivate NAImporterAskClassPrivate;
+
+typedef struct {
+	GtkDialogClass             parent;
+	NAImporterAskClassPrivate *private;
+}
+	NAImporterAskClass;
+
+GType na_importer_ask_get_type( void );
+
+guint na_importer_ask_user( const NAIImporterParms *parms, const NAObjectItem *existing );
+
+G_END_DECLS
+
+#endif /* __CORE_NA_IMPORTER_ASK_H__ */
diff --git a/src/core/na-iprefs.c b/src/core/na-iprefs.c
index 4eda8b9..7a5cd68 100644
--- a/src/core/na-iprefs.c
+++ b/src/core/na-iprefs.c
@@ -33,6 +33,7 @@
 #endif
 
 #include <api/na-gconf-utils.h>
+#include <api/na-iimporter.h>
 
 #include "na-iprefs.h"
 
@@ -52,6 +53,17 @@ static GConfEnumStringPair order_mode_table[] = {
 	{ 0, NULL }
 };
 
+#define DEFAULT_IMPORT_MODE_INT				IMPORTER_MODE_NO_IMPORT
+#define DEFAULT_IMPORT_MODE_STR				"NoImport"
+
+static GConfEnumStringPair import_mode_table[] = {
+	{ IMPORTER_MODE_NO_IMPORT,				DEFAULT_IMPORT_MODE_STR },
+	{ IMPORTER_MODE_RENUMBER,				"Renumber" },
+	{ IMPORTER_MODE_OVERRIDE,				"Override" },
+	{ IMPORTER_MODE_ASK,					"Ask" },
+	{ 0, NULL }
+};
+
 static gboolean st_initialized = FALSE;
 static gboolean st_finalized = FALSE;
 
@@ -199,6 +211,72 @@ na_iprefs_set_order_mode( NAIPrefs *instance, gint mode )
 }
 
 /**
+ * na_iprefs_get_import_mode:
+ * @gconf: a #GCongClient client.
+ * @name: name of the import key to be readen
+ *
+ * Returns: the import mode currently set.
+ *
+ * Note: this function returns a suitable default value even if the key
+ * is not found in GConf preferences or no schema has been installed.
+ *
+ * Note: please take care of keeping the default value synchronized with
+ * those defined in schemas.
+ */
+guint
+na_iprefs_get_import_mode( GConfClient *gconf, const gchar *name )
+{
+	gint import_mode = DEFAULT_IMPORT_MODE_INT;
+	gint import_int;
+	gchar *import_str;
+	gchar *path;
+
+	path = gconf_concat_dir_and_key( IPREFS_GCONF_PREFS_PATH, name );
+
+	import_str = na_gconf_utils_read_string(
+			gconf,
+			path,
+			TRUE,
+			DEFAULT_IMPORT_MODE_STR );
+
+	if( gconf_string_to_enum( import_mode_table, import_str, &import_int )){
+		import_mode = import_int;
+	}
+
+	g_free( import_str );
+	g_free( path );
+
+	return( import_mode );
+}
+
+/**
+ * na_iprefs_set_import_mode:
+ * @gconf: a #GCongClient client.
+ * @mode: the new value to be written.
+ *
+ * Writes the current status of 'import mode' to the GConf
+ * preference system.
+ */
+void
+na_iprefs_set_import_mode( GConfClient *gconf, const gchar *name, guint mode )
+{
+	const gchar *import_str;
+	gchar *path;
+
+	path = gconf_concat_dir_and_key( IPREFS_GCONF_PREFS_PATH, name );
+
+	import_str = gconf_enum_to_string( import_mode_table, mode );
+
+	na_gconf_utils_write_string(
+			gconf,
+			path,
+			import_str ? import_str : DEFAULT_IMPORT_MODE_STR,
+			NULL );
+
+	g_free( path );
+}
+
+/**
  * na_iprefs_get_gconf_client:
  * @instance: this #NAIPrefs interface instance.
  *
diff --git a/src/core/na-iprefs.h b/src/core/na-iprefs.h
index 9cb1fdc..07df107 100644
--- a/src/core/na-iprefs.h
+++ b/src/core/na-iprefs.h
@@ -102,6 +102,9 @@ typedef struct {
 #define IPREFS_RELABEL_ACTIONS				"iprefs-relabel-actions"
 #define IPREFS_RELABEL_PROFILES				"iprefs-relabel-profiles"
 
+#define IPREFS_IMPORT_ITEMS_IMPORT_MODE		"import-mode"
+#define IPREFS_IMPORT_ASK_LAST_MODE			"import-ask-user-last-mode"
+
 /* alphabetical order values
  */
 enum {
@@ -112,8 +115,11 @@ enum {
 
 GType        na_iprefs_get_type( void );
 
-gint         na_iprefs_get_order_mode( NAIPrefs *instance );
-void         na_iprefs_set_order_mode( NAIPrefs *instance, gint mode );
+gint         na_iprefs_get_order_mode   ( NAIPrefs *instance );
+void         na_iprefs_set_order_mode   ( NAIPrefs *instance, gint mode );
+
+guint        na_iprefs_get_import_mode  ( GConfClient *gconf, const gchar *pref );
+void         na_iprefs_set_import_mode  ( GConfClient *gconf, const gchar *pref, guint mode );
 
 GConfClient *na_iprefs_get_gconf_client ( const NAIPrefs *instance );
 
diff --git a/src/io-xml/naxml-reader.c b/src/io-xml/naxml-reader.c
index 3c4ce46..f136b40 100644
--- a/src/io-xml/naxml-reader.c
+++ b/src/io-xml/naxml-reader.c
@@ -144,67 +144,17 @@ static RootNodeStr st_root_node_str[] = {
 	{ NULL }
 };
 
-#if 0
-typedef struct {
-	char    *entry;
-	gboolean entry_found;
-	gboolean locale_waited;
-	gboolean profile_waited;
-	gboolean list_waited;
-}
-	GConfReaderStruct;
-
-static GConfReaderStruct reader_str[] = {
-	{ ACTION_VERSION_ENTRY      , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_LABEL_ENTRY   , FALSE,  TRUE, FALSE, FALSE },
-	{ OBJECT_ITEM_TOOLTIP_ENTRY , FALSE,  TRUE, FALSE, FALSE },
-	{ OBJECT_ITEM_ICON_ENTRY    , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_ENABLED_ENTRY , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_LIST_ENTRY    , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_TYPE_ENTRY    , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_TARGET_SELECTION_ENTRY  , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_TARGET_BACKGROUND_ENTRY , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_TARGET_TOOLBAR_ENTRY    , FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, FALSE, FALSE, FALSE, FALSE },
-	{ OBJECT_ITEM_TOOLBAR_LABEL_ENTRY     ,  TRUE, FALSE, FALSE, FALSE },
-	{ ACTION_PROFILE_LABEL_ENTRY, FALSE,  TRUE,  TRUE, FALSE },
-	{ ACTION_PATH_ENTRY         , FALSE, FALSE,  TRUE, FALSE },
-	{ ACTION_PARAMETERS_ENTRY   , FALSE, FALSE,  TRUE, FALSE },
-	{ ACTION_BASENAMES_ENTRY    , FALSE, FALSE,  TRUE,  TRUE },
-	{ ACTION_MATCHCASE_ENTRY    , FALSE, FALSE,  TRUE, FALSE },
-	{ ACTION_ISFILE_ENTRY       , FALSE, FALSE,  TRUE, FALSE },
-	{ ACTION_ISDIR_ENTRY        , FALSE, FALSE,  TRUE, FALSE },
-	{ ACTION_MULTIPLE_ENTRY     , FALSE, FALSE,  TRUE, FALSE },
-	{ ACTION_MIMETYPES_ENTRY    , FALSE, FALSE,  TRUE,  TRUE },
-	{ ACTION_SCHEMES_ENTRY      , FALSE, FALSE,  TRUE,  TRUE },
-	{ ACTION_FOLDERS_ENTRY      , FALSE, FALSE,  TRUE,  TRUE },
-	{                       NULL, FALSE, FALSE, FALSE, FALSE },
-};
-#endif
-
-#define ERR_XMLDOC_UNABLE_TOPARSE	_( "Unable to parse XML file: %s." )
-#define ERR_ROOT_UNKNOWN			_( "Invalid XML root element %s found at line %d while waiting for %s." )
-#define ERR_NODE_UNKNOWN			_( "Unknown element %s found at line %d while waiting for %s." )
+#define ERR_ITEM_ID_ALREADY_EXISTS	_( "Item ID %s already exists." )
+#define ERR_ITEM_ID_NOT_FOUND		_( "Item ID not found." )
+#define ERR_MENU_UNWAITED			_( "Unwaited key path %s while importing a menu." )
 #define ERR_NODE_ALREADY_FOUND		_( "Element %s at line %d already found, ignored." )
+#define ERR_NODE_INVALID_ID			_( "Invalid item ID: waited for %s, found %s at line %d." )
+#define ERR_NODE_UNKNOWN			_( "Unknown element %s found at line %d while waiting for %s." )
 /* i18n: do not translate keywords 'Action' nor 'Menu' */
 #define ERR_NODE_UNKNOWN_TYPE		_( "Unknown type %s found at line %d, while waiting for Action or Menu." )
-#define ERR_MENU_UNWAITED			_( "Unwaited key path %s while importing a menu." )
-#define ERR_ITEM_ID_NOT_FOUND		_( "Item ID not found." )
-#define ERR_NODE_INVALID_ID			_( "Invalid Item ID: waited for %s, found %s at line %d." )
-
-#if 0
-#define ERR_PATH_LENGTH				_( "Too many elements in key path %s." )
-#define ERR_ITEM_LABEL_NOT_FOUND	_( "Item label not found." )
-#define ERR_IGNORED_SCHEMA			_( "Schema is ignored at line %d." )
-#define ERR_UNEXPECTED_NODE			_( "Unexpected '%s' node found at line %d." )
-#define ERR_UNEXPECTED_ENTRY		_( "Unexpected '%s' entry found at line %d." )
-#define ERR_NODE_NOT_FOUND			_( "Mandatory node '%s' not found." )
-#define ERR_NO_VALUE_FOUND			_( "No value found." )
-#define ERR_INVALID_KEY_PREFIX		_( "Invalid content: waited for %s prefix, found %s at line %d." )
-#define ERR_NOT_AN_UUID				_( "Invalid UUID %s found at line %d." )
-#define ERR_UUID_ALREADY_EXISTS		_( "Already existing action (UUID: %s)." )
-#define ERR_VALUE_ALREADY_SET		_( "Value '%s' already set: new value ignored at line %d." )
-#endif
+#define ERR_ROOT_UNKNOWN			_( "Invalid XML root element %s found at line %d while waiting for %s." )
+#define ERR_XMLDOC_UNABLE_TOPARSE	_( "Unable to parse XML file: %s." )
+#define WARN_UNDEALT_NODE			_( "Node %s at line %d has not been dealt with." )
 
 static gboolean      read_data_is_path_adhoc_for_object( NAXMLReader *reader, const NAIFactoryObject *object, xmlChar *text );
 static NADataBoxed  *read_data_boxed_from_node( NAXMLReader *reader, xmlChar *text, xmlNode *parent, const NADataDef *def );
@@ -223,49 +173,13 @@ static gchar        *build_root_node_list( void );
 static gchar        *get_value_from_child_node( xmlNode *node, const gchar *child );
 static gchar        *get_value_from_child_child_node( xmlNode *node, const gchar *first, const gchar *second );
 static gboolean      is_profile_path( NAXMLReader *reader, xmlChar *text );
+static guint         manage_import_mode( NAXMLReader *reader );
+static void          publish_undealt_nodes( NAXMLReader *reader );
+static void          renumber_label_item( NAXMLReader *reader );
 static void          reset_node_data( NAXMLReader *reader );
 static xmlNode      *search_for_child_node( xmlNode *node, const gchar *key );
 static int           strxcmp( const xmlChar *a, const char *b );
 
-
-#if 0
-static void          iter_on_list_children_run( NAXMLReader *reader, xmlNode *list );
-static void          iter_on_elements_list( NAXMLReader *reader );
-#endif
-#if 0
-static void          set_schema_applyto_value( NAXMLReader *reader, xmlNode *node, const gchar *entry );
-#endif
-
-
-#if 0
-static void          reader_parse_schemalist( NAXMLReader *reader, xmlNode *schemalist );
-static gboolean      reader_parse_schema( NAXMLReader *reader, xmlNode *schema );
-static gboolean      reader_parse_applyto( NAXMLReader *reader, xmlNode *node );
-static gboolean      reader_check_for_entry( NAXMLReader *reader, xmlNode *node, const char *entry );
-static gboolean      reader_parse_locale( NAXMLReader *reader, xmlNode *node );
-static void          reader_parse_default( NAXMLReader *reader, xmlNode *node );
-static gchar        *get_profile_name_from_schema_key( const gchar *key, const gchar *uuid );
-
-static void          reader_parse_entrylist( NAXMLReader *reader, xmlNode *entrylist );
-static gboolean      reader_parse_entry( NAXMLReader *reader, xmlNode *entry );
-static gboolean      reader_parse_dump_key( NAXMLReader *reader, xmlNode *key );
-static void          reader_parse_dump_value( NAXMLReader *reader, xmlNode *key );
-static void          reader_parse_dump_value_list( NAXMLReader *reader, xmlNode *key );
-static gchar        *get_profile_name_from_dump_key( const gchar *key );
-
-static void          apply_values( NAXMLReader *reader );
-static gchar        *get_uuid_from_key( NAXMLReader *reader, const gchar *key, guint line );
-static gboolean      is_uuid_valid( const gchar *uuid );
-static gchar        *get_entry_from_key( const gchar *key );
-
-#endif
-static guint      manage_import_mode( NAXMLReader *reader );
-#if 0
-static void          propagate_default_values( NAXMLReader *reader );
-static NAObjectItem *search_in_auxiliaries( NAXMLReader *reader, const gchar *uuid );
-static void          relabel( NAXMLReader *reader );
-#endif
-
 GType
 naxml_reader_get_type( void )
 {
@@ -421,12 +335,20 @@ naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterParms *par
 
 	if( code == IMPORTER_CODE_OK ){
 		g_assert( NA_IS_OBJECT_ITEM( reader->private->parms->item ));
-#if 0
-		propagate_default_values( reader );
-#endif
 		code = manage_import_mode( reader );
 	}
 
+	if( code != IMPORTER_CODE_OK ){
+		if( reader->private->parms->item ){
+			g_object_unref( reader->private->parms->item );
+			reader->private->parms->item = NULL;
+		}
+	}
+
+	if( code == IMPORTER_CODE_OK ){
+		publish_undealt_nodes( reader );
+	}
+
 	g_object_unref( reader );
 
 	return( code );
@@ -652,167 +574,6 @@ iter_on_list_children( NAXMLReader *reader, xmlNode *list )
 	return( code );
 }
 
-#if 0
-/*
- * iter on list child nodes
- * each 'schema/entry' node should correspond to an elementary data of
- * the imported item - other nodes are warned (and ignored)
- * invalid nodes are just ignored
- * the id of the item must have been set during this run
- */
-static void
-iter_on_list_children_run( NAXMLReader *reader, xmlNode *list )
-{
-	xmlNode *iter;
-
-	for( iter = list->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( strxcmp( iter->name, reader->private->root_node_str->element_key )){
-			add_message( reader,
-					ERR_NODE_UNKNOWN,
-					( const char * ) iter->name, iter->line, reader->private->root_node_str->element_key );
-			continue;
-		}
-
-		reset_node_data( reader );
-
-		if( reader->private->root_node_str->fn_element_parms ){
-			( *reader->private->root_node_str->fn_element_parms )( reader, iter );
-		}
-
-		if( reader->private->root_node_str->fn_element_content ){
-			( *reader->private->root_node_str->fn_element_content )( reader, iter );
-		}
-
-		if( reader->private->node_ok ){
-
-			NAXMLElementStr *str = g_new0( NAXMLElementStr, 1 );
-			str->node = reader->private->node_ptr;
-			str->key = g_strdup( reader->private->node_key );
-			reader->private->elements = g_list_prepend( reader->private->elements, str );
-		}
-	}
-}
-
-/*
- * parse a XML schema
- * root = "gconfschemafile" (already tested)
- *  +- have one descendant node "schemalist"
- *  |   +- have one descendant node per key "schema"
- */
-static void
-reader_parse_schema_root( NAXMLReader *reader, xmlNode *root )
-{
-	static const gchar *thisfn = "naxml_reader_parse_schema_root";
-	xmlNodePtr iter;
-	gboolean found = FALSE;
-
-	g_debug( "%s: reader=%p, root=%p", thisfn, ( void * ) reader, ( void * ) root );
-
-	iter_on_tree_nodes(
-			reader, root,
-			NAXML_KEY_SCHEMA_LIST, NAXML_KEY_SCHEMA_ENTRY, reader_parse_schema_schema );
-
-	for( iter = root->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( strxcmp( iter->name, NAXML_KEY_SCHEMA_LIST )){
-			add_message( reader,
-					ERR_WAITED_IGNORED_NODE,
-					NAXML_KEY_SCHEMA_LIST, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-
-		if( found ){
-			add_message( reader, ERR_IGNORED_NODE, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-
-		found = TRUE;
-		reader_parse_schemalist( reader, iter );
-	}
-}
-#endif
-
-#if 0
-static void
-iter_on_elements_list( NAXMLReader *reader )
-{
-	GList *ielt;
-	gboolean idset;
-	gboolean err;
-
-	idset = FALSE;
-	err = FALSE;
-
-	for( ielt = reader->private->elements ; ielt && !err ; ielt = ielt->next ){
-
-		NAXMLElementStr *str = ( NAXMLElementStr * ) ielt->data;
-		GSList *path_slist = na_core_utils_slist_from_split(  str->key_path, "/" );
-		gchar **path_elts = g_strsplit( str->key_path, "/", -1 );
-		guint path_length = g_slist_length( path_slist );
-		g_debug( "path=%s, length=%d", str->key_path, path_length );
-		/* path=/apps/nautilus-actions/configurations/0af5a47e-96d9-441c-a3b8-d1185ced0351/version, length=6 */
-		/* path=/apps/nautilus-actions/configurations/0af5a47e-96d9-441c-a3b8-d1185ced0351/profile-main/schemes, length=7 */
-
-		if( !idset ){
-			na_object_set_id( reader->private->item, path_elts[ PATH_ID_IDX ] );
-			idset = TRUE;
-			gchar *id = na_object_get_id( reader->private->item );
-			g_debug( "id=%s", id );
-			g_free( id );
-		}
-
-		g_debug( "iddef=%p, name=%s, value=%s",
-				( void * ) str->iddef, str->iddef ? str->iddef->name : "(null)", str->key_value );
-
-		/* this is for the action or menu body
-		 */
-		if( path_length == 2+PATH_ID_IDX ){
-			na_ifactory_object_set_from_string( NA_IFACTORY_OBJECT( reader->private->item ), str->iddef->id, str->key_value );
-
-		/* this is for a profile
-		 */
-		} else {
-			if( path_length != 3+PATH_ID_IDX ){
-				add_message( reader, ERR_PATH_LENGTH, str->key_path );
-				err = TRUE;
-
-			} else if( !NA_IS_OBJECT_ACTION( reader->private->item )){
-				add_message( reader, ERR_MENU_UNWAITED, str->key_path );
-				err = TRUE;
-
-			} else {
-				gchar *profile_name = g_strdup( path_elts[ 1+PATH_ID_IDX] );
-				NAObjectProfile *profile = ( NAObjectProfile * ) na_object_get_item( reader->private->item, profile_name );
-				if( !profile ){
-					profile = na_object_profile_new();
-					na_object_set_id( profile, profile_name );
-					na_object_action_attach_profile( NA_OBJECT_ACTION( reader->private->item ), profile );
-				}
-				na_ifactory_object_set_from_string( NA_IFACTORY_OBJECT( profile ), str->iddef->id, str->key_value );
-				g_free( profile_name );
-			}
-		}
-
-		na_core_utils_slist_free( path_slist );
-		g_strfreev( path_elts );
-	}
-
-	if( err ){
-		g_object_unref( reader->private->item );
-		reader->private->item = NULL;
-	}
-}
-#endif
-
 void
 naxml_reader_read_start( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages  )
 {
@@ -1043,6 +804,7 @@ read_done_get_next_profile_id( NAXMLReader *reader )
 
 	/*g_debug( "read_done_get_next_profile_id: nodes=%p (count=%d)",
 			( void * ) reader->private->nodes, g_list_length( reader->private->nodes ));*/
+
 	for( ip = reader->private->nodes ; ip && !profile_id ; ip = ip->next ){
 		xmlNode *parent_node = ( xmlNode * ) ip->data;
 		xmlNode *entry_node = search_for_child_node( parent_node, reader->private->root_node_str->key_entry );
@@ -1406,812 +1168,6 @@ dump_read_value( NAXMLReader *reader, xmlNode *node, const NADataDef *def )
 	return( string );
 }
 
-#if 0
-/*
- * iter points to the 'schemalist' node (already checked)
- * children should only be 'schema' nodes ; other nodes are warned,
- * but not fatal
- */
-static void
-reader_parse_schemalist( NAXMLReader *reader, xmlNode *schema )
-{
-	static const gchar *thisfn = "reader_parse_schemalist";
-	xmlNode *iter;
-	gboolean ok = TRUE;
-
-	g_debug( "%s: reader=%p, schema=%p", thisfn, ( void * ) reader, ( void * ) schema );
-
-	reader->private->action = na_object_action_new();
-	reader->private->uuid_set = FALSE;
-
-	for( iter = schema->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( strxcmp( iter->name, NAXML_KEY_SCHEMA_ENTRY )){
-			add_message( reader,
-					ERR_WAITED_IGNORED_NODE,
-					NAXML_KEY_SCHEMA_ENTRY, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-
-		if( !reader_parse_schema( reader, iter )){
-			add_message( reader, ERR_IGNORED_SCHEMA, iter->line );
-		}
-	}
-
-	if( !reader->private->uuid_set ){
-		add_message( reader, ERR_UUID_NOT_FOUND );
-		ok = FALSE;
-	}
-
-	if( ok ){
-		gchar *label = na_object_get_label( reader->private->action );
-		if( !label || !g_utf8_strlen( label, -1 )){
-			add_message( reader, ERR_ACTION_LABEL_NOT_FOUND );
-		}
-		g_free( label );
-	}
-
-	if( !ok ){
-		g_object_unref( reader->private->action );
-		reader->private->action = NULL;
-	}
-}
-
-/*
- * iter points to a 'schema' node (already checked)
- *
- * we can have
- * - schema
- *   +- locale
- *      +- default
- * or
- * - schema
- *   +- default
- * depending of the key's entry.
- *
- * data found in schema node is imported into the action if and only if
- * the whole node is correct ; else the error is warned (but not fatal)
- *
- * note also that versions previous to 1.11 used to export profile label
- * as if it were not localized (which is a bug, though not signaled)
- * so if the profile label is not found inside of locale node, we search
- * for it outside
- *
- * Returns TRUE if the node has been successfully parsed, FALSE else.
- */
-static gboolean
-reader_parse_schema( NAXMLReader *reader, xmlNode *schema )
-{
-	static const gchar *thisfn = "reader_parse_schema";
-	xmlNode *iter;
-	gboolean ret = TRUE;
-	gboolean applyto = FALSE;
-	gboolean pre_v1_11 = FALSE;
-	gboolean locale_found = FALSE;
-	gboolean default_found = FALSE;
-
-	g_debug( "%s: reader=%p, schema=%p", thisfn, ( void * ) reader, ( void * ) schema );
-
-	free_reader_values( reader );
-
-	/* check for the children of the 'schema' node
-	 * we must only found known keys
-	 */
-	for( iter = schema->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( strxcmp( iter->name, NAXML_KEY_SCHEMA_KEY ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_APPLYTO ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_OWNER ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_TYPE ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_LIST_TYPE ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_LOCALE ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_DEFAULT )){
-
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-				continue;
-		}
-
-		if( !strxcmp( iter->name, NAXML_KEY_SCHEMA_KEY ) ||
-			!strxcmp( iter->name, NAXML_KEY_SCHEMA_OWNER ) ||
-			!strxcmp( iter->name, NAXML_KEY_SCHEMA_TYPE ) ||
-			!strxcmp( iter->name, NAXML_KEY_SCHEMA_LIST_TYPE )){
-
-				pre_v1_11 = TRUE;
-				continue;
-		}
-	}
-
-	if( !ret ){
-		return( ret );
-	}
-
-	g_debug( "%s: pre_v1_11=%s", thisfn, pre_v1_11 ? "True":"False" );
-
-	/* check for an 'applyto' node
-	 * is mandatory
-	 * will determine if we are waiting for locale+default or only default
-	 */
-	reader->private->locale_waited = FALSE;
-
-	for( iter = schema->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( !strxcmp( iter->name, NAXML_KEY_SCHEMA_APPLYTO )){
-
-			if( applyto ){
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-			}
-
-			applyto = TRUE;
-			ret = reader_parse_applyto( reader, iter );
-		}
-	}
-
-	if( !applyto ){
-		g_assert( ret );
-		add_message( reader, ERR_NODE_NOT_FOUND, NAXML_KEY_SCHEMA_APPLYTO );
-		ret = FALSE;
-	}
-
-	if( !ret ){
-		return( ret );
-	}
-
-	/* check for and parse locale+default or locale depending of the
-	 * previously found 'applyto' node
-	 */
-	for( iter = schema->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( !strxcmp( iter->name, NAXML_KEY_SCHEMA_LOCALE )){
-
-			if( locale_found ){
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-
-			} else {
-				locale_found = TRUE;
-				if( reader->private->locale_waited ){
-					ret = reader_parse_locale( reader, iter );
-				}
-			}
-
-		} else if( !strxcmp( iter->name, NAXML_KEY_SCHEMA_DEFAULT )){
-
-			if( default_found ){
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-
-			} else {
-				default_found = TRUE;
-				if( !reader->private->locale_waited ||
-						( pre_v1_11 && !strcmp( reader->private->entry, ACTION_PROFILE_LABEL_ENTRY ))){
-					reader_parse_default( reader, iter );
-				}
-			}
-		}
-	}
-
-	if( !reader->private->value && !g_slist_length( reader->private->list_value )){
-		g_assert( ret );
-		add_message( reader, ERR_NO_VALUE_FOUND );
-		ret = FALSE;
-	}
-
-	if( ret ){
-		apply_values( reader );
-	}
-
-	return( ret );
-}
-
-static gboolean
-reader_parse_applyto( NAXMLReader *reader, xmlNode *node )
-{
-	static const gchar *thisfn = "reader_parse_applyto";
-	gboolean ret = TRUE;
-	xmlChar *text;
-	gchar *uuid;
-	gchar *profile = NULL;
-	gchar *entry = NULL;
-
-	g_debug( "%s: reader=%p, node=%p", thisfn, ( void * ) reader, ( void * ) node );
-
-	text = xmlNodeGetContent( node );
-	uuid = get_uuid_from_key( reader, ( const gchar * ) text, node->line );
-
-	if( !uuid ){
-		ret = FALSE;
-	}
-
-	if( ret ){
-		if( !reader->private->uuid_set ){
-			na_object_set_id( reader->private->action, uuid );
-			reader->private->uuid_set = TRUE;
-
-		} else {
-			gchar *ref = na_object_get_id( reader->private->action );
-			if( g_ascii_strcasecmp(( const gchar * ) uuid, ( const gchar * ) ref )){
-				add_message( reader, ERR_INVALID_UUID, ref, uuid, node->line );
-				ret = FALSE;
-			}
-			g_free( ref );
-		}
-	}
-
-	if( ret ){
-		profile = get_profile_name_from_schema_key(( const gchar * ) text, uuid );
-
-		if( profile ){
-			reader->private->profile = NA_OBJECT_PROFILE( na_object_get_item( reader->private->action, profile ));
-
-			if( !reader->private->profile ){
-				reader->private->profile = na_object_profile_new();
-				na_object_set_id( reader->private->profile, profile );
-				na_object_action_attach_profile( reader->private->action, reader->private->profile );
-			}
-		}
-
-		entry = get_entry_from_key(( const gchar * ) text );
-		g_assert( entry && strlen( entry ));
-
-		ret = reader_check_for_entry( reader, node, entry );
-	}
-
-	g_free( entry );
-	g_free( profile );
-	g_free( uuid );
-	xmlFree( text );
-
-	return( ret );
-}
-
-static gboolean
-reader_check_for_entry( NAXMLReader *reader, xmlNode *node, const char *entry )
-{
-	static const gchar *thisfn = "reader_check_for_entry";
-	gboolean ret = TRUE;
-	gboolean found = FALSE;
-	int i;
-
-	g_debug( "%s: reader=%p, node=%p, entry=%s", thisfn, ( void * ) reader, ( void * ) node, entry );
-
-	for( i=0 ; reader_str[i].entry ; ++i ){
-
-		if( !strcmp( reader_str[i].entry, entry )){
-
-			found = TRUE;
-
-			if( reader_str[i].entry_found ){
-				add_message( reader, ERR_UNEXPECTED_ENTRY, entry, node->line );
-				ret = FALSE;
-
-			} else {
-				reader_str[i].entry_found = TRUE;
-				reader->private->entry  = g_strdup( reader_str[i].entry );
-				reader->private->locale_waited = reader_str[i].locale_waited;
-				reader->private->profile_waited = reader_str[i].profile_waited;
-				reader->private->list_waited = reader_str[i].list_waited;
-			}
-		}
-	}
-
-	if( !found ){
-		g_assert( ret );
-		add_message( reader, ERR_UNEXPECTED_ENTRY, entry, node->line );
-		ret = FALSE;
-	}
-
-	return( ret );
-}
-
-/*
- * we only parse 'locale' when we are waiting for a value inside of
- * this node
- */
-static gboolean
-reader_parse_locale( NAXMLReader *reader, xmlNode *locale )
-{
-	static const gchar *thisfn = "reader_parse_locale";
-	gboolean ret = TRUE;
-	xmlNode *iter;
-	gboolean default_found = FALSE;
-
-	g_debug( "%s: reader=%p, locale=%p", thisfn, ( void * ) reader, ( void * ) locale );
-
-	for( iter = locale->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-
-		if( strxcmp( iter->name, NAXML_KEY_SCHEMA_SHORT ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_LONG ) &&
-			strxcmp( iter->name, NAXML_KEY_SCHEMA_DEFAULT )){
-
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-				continue;
-		}
-
-		if( !strxcmp( iter->name, NAXML_KEY_SCHEMA_SHORT ) ||
-			!strxcmp( iter->name, NAXML_KEY_SCHEMA_LONG )){
-				continue;
-		}
-
-		if( default_found ){
-			add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-			ret = FALSE;
-			continue;
-		}
-
-		g_assert( ret );
-		default_found = TRUE;
-		reader_parse_default( reader, iter );
-	}
-
-	return( ret );
-}
-
-static void
-reader_parse_default( NAXMLReader *reader, xmlNode *node )
-{
-	xmlChar *text;
-	gchar *value;
-
-	if( reader->private->value ){
-		add_message( reader, ERR_VALUE_ALREADY_SET, reader->private->value, node->line );
-		return;
-	}
-
-	text = xmlNodeGetContent( node );
-	value = g_strdup(( const gchar * ) text );
-
-	if( reader->private->list_waited ){
-		reader->private->list_value = na_utils_schema_to_gslist( value );
-		g_free( value );
-
-	} else {
-		reader->private->value = value;
-	}
-
-	xmlFree( text );
-	/*g_debug( "reader_parse_default: set value=%s", reader->private->value );*/
-}
-
-/*
- * prefix was already been checked when extracting the uuid
- */
-static gchar *
-get_profile_name_from_schema_key( const gchar *key, const gchar *uuid )
-{
-	gchar *prefix = g_strdup_printf( "%s/%s/%s", NA_GCONF_CONFIG_PATH, uuid, OBJECT_PROFILE_PREFIX );
-	gchar *profile_name = NULL;
-	gchar *pos;
-
-	if( g_str_has_prefix( key, prefix )){
-		profile_name = g_strdup( key + strlen( prefix ));
-		pos = g_strrstr( profile_name, "/" );
-		if( pos != NULL ){
-			*pos = '\0';
-		}
-	}
-
-	g_free( prefix );
-	return( profile_name );
-}
-
-/*
- * parse a XML gconf dump
- * root = "gconfentryfile" (already tested)
- *  +- have one descendant node "entrylist"
- *  |   +- have one descendant node per key "entry"
- */
-static void
-reader_parse_dump_root( NAXMLReader *reader, xmlNode *root )
-{
-	static const gchar *thisfn = "reader_parse_dump_root";
-	xmlNodePtr iter;
-	gboolean found = FALSE;
-
-	g_debug( "%s: reader=%p, root=%p", thisfn, ( void * ) reader, ( void * ) root );
-
-	for( iter = root->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-		if( strxcmp( iter->name, NAXML_KEY_DUMP_ENTRYLIST )){
-			add_message( reader,
-					ERR_WAITED_IGNORED_NODE,
-					NAXML_KEY_DUMP_ENTRYLIST, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-		if( found ){
-			add_message( reader, ERR_IGNORED_NODE, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-
-		found = TRUE;
-		reader_parse_entrylist( reader, iter );
-	}
-}
-
-/*
- * iter points to the 'entrylist' node (already checked)
- * children should only be 'entry' nodes ; other nodes are warned,
- * but not fatal
- */
-static void
-reader_parse_entrylist( NAXMLReader *reader, xmlNode *entrylist )
-{
-	static const gchar *thisfn = "reader_parse_entrylist";
-	xmlChar *path;
-	gchar *uuid, *label;
-	gboolean ok;
-
-	g_debug( "%s: reader=%p, entrylist=%p", thisfn, ( void * ) reader, ( void * ) entrylist );
-
-	reader->private->action = na_object_action_new();
-	path = xmlGetProp( entrylist, ( const xmlChar * ) NAXML_KEY_DUMP_ENTRYLIST_BASE );
-	uuid = na_gconf_utils_path_to_key(( const gchar * ) path );
-	/*g_debug( "%s: uuid=%s", thisfn, uuid );*/
-
-	if( is_uuid_valid( uuid )){
-		na_object_set_id( reader->private->action, uuid );
-		reader->private->uuid_set = TRUE;
-
-	} else {
-		add_message( reader, ERR_NOT_AN_UUID, uuid, entrylist->line );
-	}
-
-	g_free( uuid );
-	xmlFree( path );
-	ok = TRUE;
-
-	if( reader->private->uuid_set ){
-		xmlNode *iter;
-		for( iter = entrylist->children ; iter ; iter = iter->next ){
-
-			if( iter->type != XML_ELEMENT_NODE ){
-				continue;
-			}
-
-			if( strxcmp( iter->name, NAXML_KEY_DUMP_ENTRY )){
-				add_message( reader,
-						ERR_WAITED_IGNORED_NODE,
-						NAXML_KEY_DUMP_ENTRY, ( const char * ) iter->name, iter->line );
-				continue;
-			}
-
-			if( !reader_parse_entry( reader, iter )){
-				add_message( reader, ERR_IGNORED_SCHEMA, iter->line );
-			}
-		}
-
-		label = na_object_get_label( reader->private->action );
-		if( !label || !g_utf8_strlen( label, -1 )){
-			add_message( reader, ERR_ACTION_LABEL_NOT_FOUND );
-			ok = FALSE;
-		}
-		g_free( label );
-
-	} else {
-		g_object_unref( reader->private->action );
-		reader->private->action = NULL;
-	}
-}
-
-static gboolean
-reader_parse_entry( NAXMLReader *reader, xmlNode *entry )
-{
-	static const gchar *thisfn = "reader_parse_entry";
-	xmlNode *iter;
-	gboolean ret = TRUE;
-	gboolean key_found = FALSE;
-	gboolean value_found = FALSE;
-
-	g_debug( "%s: reader=%p, entry=%p", thisfn, ( void * ) reader, ( void * ) entry );
-
-	free_reader_values( reader );
-
-	/* check for the children of the 'entry' node
-	 * we must only found known keys
-	 */
-	for( iter = entry->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-		if( strxcmp( iter->name, NAXML_KEY_DUMP_KEY ) &&
-			strxcmp( iter->name, NAXML_KEY_DUMP_VALUE )){
-
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-				continue;
-		}
-	}
-	if( !ret ){
-		return( ret );
-	}
-
-	/* check for one and only one 'key' node
-	 */
-	for( iter = entry->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-		if( !strxcmp( iter->name, NAXML_KEY_DUMP_KEY )){
-
-			if( key_found ){
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-
-			} else {
-				key_found = TRUE;
-				ret = reader_parse_dump_key( reader, iter );
-			}
-		}
-	}
-
-	if( !key_found ){
-		g_assert( ret );
-		add_message( reader, ERR_NODE_NOT_FOUND, NAXML_KEY_DUMP_KEY );
-		ret = FALSE;
-	}
-
-	if( !ret ){
-		return( ret );
-	}
-
-	/* check for one and only one 'value' node
-	 */
-	for( iter = entry->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-		if( !strxcmp( iter->name, NAXML_KEY_DUMP_VALUE )){
-
-			if( value_found ){
-				add_message( reader, ERR_UNEXPECTED_NODE, ( const char * ) iter->name, iter->line );
-				ret = FALSE;
-
-			} else {
-				value_found = TRUE;
-				reader_parse_dump_value( reader, iter );
-			}
-		}
-	}
-
-	if( !value_found ){
-		g_assert( ret );
-		add_message( reader, ERR_NO_VALUE_FOUND );
-		ret = FALSE;
-	}
-
-	if( ret ){
-		apply_values( reader );
-	}
-
-	return( ret );
-}
-
-static gboolean
-reader_parse_dump_key( NAXMLReader *reader, xmlNode *node )
-{
-	static const gchar *thisfn = "reader_parse_dump_key";
-	gboolean ret = TRUE;
-	xmlChar *text;
-	gchar *profile = NULL;
-	gchar *entry = NULL;
-
-	g_debug( "%s: reader=%p, node=%p", thisfn, ( void * ) reader, ( void * ) node );
-
-	text = xmlNodeGetContent( node );
-
-	if( ret ){
-		profile = get_profile_name_from_dump_key(( const gchar * ) text );
-
-		if( profile ){
-			reader->private->profile = NA_OBJECT_PROFILE( na_object_get_item( reader->private->action, profile ));
-
-			if( !reader->private->profile ){
-				reader->private->profile = na_object_profile_new();
-				na_object_set_id( reader->private->profile, profile );
-				na_object_action_attach_profile( reader->private->action, reader->private->profile );
-			}
-		}
-
-		entry = get_entry_from_key(( const gchar * ) text );
-		g_assert( entry && strlen( entry ));
-
-		ret = reader_check_for_entry( reader, node, entry );
-	}
-
-	g_free( entry );
-	g_free( profile );
-	xmlFree( text );
-
-	return( ret );
-}
-
-static void
-reader_parse_dump_value( NAXMLReader *reader, xmlNode *node )
-{
-	xmlNode *iter;
-	for( iter = node->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-		if( strxcmp( iter->name, NAXML_KEY_DUMP_LIST ) &&
-			strxcmp( iter->name, NAXML_KEY_DUMP_STRING )){
-				add_message( reader,
-					ERR_IGNORED_NODE, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-		if( !strxcmp( iter->name, NAXML_KEY_DUMP_STRING )){
-
-			xmlChar *text = xmlNodeGetContent( iter );
-
-			if( reader->private->list_waited ){
-				reader->private->list_value = g_slist_append( reader->private->list_value, g_strdup(( const gchar * ) text ));
-			} else {
-				reader->private->value = g_strdup(( const gchar * ) text );
-			}
-
-			xmlFree( text );
-			continue;
-		}
-		reader_parse_dump_value_list( reader, iter );
-	}
-}
-
-static void
-reader_parse_dump_value_list( NAXMLReader *reader, xmlNode *list_node )
-{
-	xmlNode *iter;
-	for( iter = list_node->children ; iter ; iter = iter->next ){
-
-		if( iter->type != XML_ELEMENT_NODE ){
-			continue;
-		}
-		if( strxcmp( iter->name, NAXML_KEY_DUMP_VALUE )){
-				add_message( reader,
-					ERR_IGNORED_NODE, ( const char * ) iter->name, iter->line );
-			continue;
-		}
-		reader_parse_dump_value( reader, iter );
-	}
-}
-
-static gchar *
-get_profile_name_from_dump_key( const gchar *key )
-{
-	gchar *profile_name = NULL;
-	gchar **split = g_strsplit( key, "/", -1 );
-	guint count = g_strv_length( split );
-
-	g_assert( count );
-
-	if( count > 1 ){
-		profile_name = g_strdup( split[0] );
-	}
-
-	g_strfreev( split );
-
-	return( profile_name );
-}
-
-static void
-apply_values( NAXMLReader *reader )
-{
-	static const gchar *thisfn = "naxml_reader_apply_values";
-
-	g_debug( "%s: reader=%p, entry=%s, value=%s",
-			thisfn, ( void * ) reader, reader->private->entry, reader->private->value );
-
-	if( reader->private->entry && strlen( reader->private->entry )){
-		if( !strcmp( reader->private->entry, ACTION_VERSION_ENTRY )){
-			na_object_action_set_version( reader->private->action, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_LABEL_ENTRY )){
-			na_object_set_label( reader->private->action, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLTIP_ENTRY )){
-			na_object_set_tooltip( reader->private->action, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_ICON_ENTRY )){
-			na_object_set_icon( reader->private->action, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_ENABLED_ENTRY )){
-			na_object_set_enabled( NA_OBJECT_ITEM( reader->private->action ), na_utils_schema_to_boolean( reader->private->value, TRUE ));
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_LIST_ENTRY )){
-			na_object_item_set_items_string_list( NA_OBJECT_ITEM( reader->private->action ), reader->private->list_value );
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TYPE_ENTRY )){
-			/* type (Action, Menu) is not set here, because this must has been
-			 * decided at object construction (it is so too late !)
-			 */
-			;
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TARGET_SELECTION_ENTRY )){
-			na_object_action_set_target_selection( reader->private->action, na_utils_schema_to_boolean( reader->private->value, TRUE ));
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TARGET_BACKGROUND_ENTRY )){
-			na_object_action_set_target_background( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TARGET_TOOLBAR_ENTRY )){
-			na_object_action_set_target_toolbar( reader->private->action, na_utils_schema_to_boolean( reader->private->value, FALSE ));
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY )){
-			/* only used between 2.29.1 and 2.29.4, removed starting with 2.29.5
-			na_object_action_toolbar_set_same_label( reader->private->action, na_utils_schema_to_boolean( reader->private->value, TRUE ));
-			*/
-			;
-
-		} else if( !strcmp( reader->private->entry, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY )){
-			na_object_action_toolbar_set_label( reader->private->action, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_PROFILE_LABEL_ENTRY )){
-			na_object_set_label( reader->private->profile, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_PATH_ENTRY )){
-			na_object_profile_set_path( reader->private->profile, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_PARAMETERS_ENTRY )){
-			na_object_profile_set_parameters( reader->private->profile, reader->private->value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_BASENAMES_ENTRY )){
-			na_object_profile_set_basenames( reader->private->profile, reader->private->list_value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_MATCHCASE_ENTRY )){
-			na_object_profile_set_matchcase( reader->private->profile, na_utils_schema_to_boolean( reader->private->value, TRUE ));
-
-		} else if( !strcmp( reader->private->entry, ACTION_ISFILE_ENTRY )){
-			na_object_profile_set_isfile( reader->private->profile, na_utils_schema_to_boolean( reader->private->value, TRUE ));
-
-		} else if( !strcmp( reader->private->entry, ACTION_ISDIR_ENTRY )){
-			na_object_profile_set_isdir( reader->private->profile, na_utils_schema_to_boolean( reader->private->value, FALSE ));
-
-		} else if( !strcmp( reader->private->entry, ACTION_MULTIPLE_ENTRY )){
-			na_object_profile_set_multiple( reader->private->profile, na_utils_schema_to_boolean( reader->private->value, FALSE ));
-
-		} else if( !strcmp( reader->private->entry, ACTION_MIMETYPES_ENTRY )){
-			na_object_profile_set_mimetypes( reader->private->profile, reader->private->list_value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_SCHEMES_ENTRY )){
-			na_object_profile_set_schemes( reader->private->profile, reader->private->list_value );
-
-		} else if( !strcmp( reader->private->entry, ACTION_FOLDERS_ENTRY )){
-			na_object_profile_set_folders( reader->private->profile, reader->private->list_value );
-
-		} else {
-			g_warning( "%s: unprocessed entry %s", thisfn, reader->private->entry );
-		}
-	}
-}
-#endif
-
 static void
 add_message( NAXMLReader *reader, const gchar *format, ... )
 {
@@ -2327,14 +1283,103 @@ is_profile_path( NAXMLReader *reader, xmlChar *text )
 	return( is_profile );
 }
 
-#if 0
+/*
+ * returns IMPORTER_CODE_OK if we can safely insert the action
+ * - the id doesn't already exist
+ * - the id already exist, but import mode is renumber
+ * - the id already exists, but import mode is override
+ *
+ * returns IMPORTER_CODE_CANCELLED if user chooses to cancel the operation
+ */
+static guint
+manage_import_mode( NAXMLReader *reader )
+{
+	guint code;
+	NAObjectItem *exists;
+	guint mode;
+	gchar *id;
+
+	code = IMPORTER_CODE_OK;
+	exists = NULL;
+
+	if( reader->private->parms->check_fn ){
+		exists = ( *reader->private->parms->check_fn )
+						( reader->private->parms->item, reader->private->parms->check_fn_data );
+	}
+
+	if( exists ){
+		if( reader->private->parms->mode == IMPORTER_MODE_ASK ){
+			mode = na_iimporter_ask_user( reader->private->importer, reader->private->parms, exists );
+
+		} else {
+			mode = reader->private->parms->mode;
+		}
+
+		switch( mode ){
+			case IMPORTER_MODE_RENUMBER:
+				renumber_label_item( reader );
+				if( reader->private->parms->mode == IMPORTER_MODE_ASK ){
+					add_message( reader, "%s", _( "Item was renumbered due to user request." ));
+				}
+				break;
+
+			case IMPORTER_MODE_OVERRIDE:
+				if( reader->private->parms->mode == IMPORTER_MODE_ASK ){
+					add_message( reader, "%s", _( "Existing item was overriden due to user request." ));
+				}
+				break;
+
+			case IMPORTER_MODE_NO_IMPORT:
+			default:
+				id = na_object_get_id( reader->private->parms->item );
+				add_message( reader, ERR_ITEM_ID_ALREADY_EXISTS, id );
+				if( reader->private->parms->mode == IMPORTER_MODE_ASK ){
+					add_message( reader, "%s", _( "Import was canceled due to user request." ));
+				}
+				g_free( id );
+				code = IMPORTER_CODE_CANCELLED;
+		}
+	}
+
+	return( code );
+}
+
 static void
-free_naxml_element_str( NAXMLElementStr *str, void *data )
+publish_undealt_nodes( NAXMLReader *reader )
 {
-	g_free( str->key );
-	g_free( str );
+	GList *iter;
+	xmlChar *text;
+
+	g_debug( "naxml_reader_publish_undealt_nodes: count=%d", g_list_length( reader->private->nodes ));
+
+	for( iter = reader->private->nodes ; iter ; iter = iter->next ){
+		xmlNode *node = ( xmlNode * ) iter->data;
+		text = xmlNodeGetContent( node );
+		add_message( reader, WARN_UNDEALT_NODE, ( const gchar * ) text, node->line );
+		xmlFree( text );
+	}
+}
+
+/*
+ * renumber the item, and set a new label
+ */
+static void
+renumber_label_item( NAXMLReader *reader )
+{
+	gchar *label, *tmp;
+
+	na_object_set_new_id( reader->private->parms->item, NULL );
+
+	label = na_object_get_label( reader->private->parms->item );
+
+	/* i18n: the action has been renumbered during import operation */
+	tmp = g_strdup_printf( "%s %s", label, _( "(renumbered)" ));
+
+	na_object_set_label( reader->private->parms->item, tmp );
+
+	g_free( tmp );
+	g_free( label );
 }
-#endif
 
 /*
  * data are reset before first run on nodes for an item
@@ -2355,18 +1400,6 @@ reset_node_data( NAXMLReader *reader )
 	reader->private->node_ok = TRUE;
 }
 
-#if 0
-/*
- * reset here static data which should be reset before each object
- * (so, obviously, not reader data as a new reader is reallocated
- *  for each import operation)
- */
-static void
-reset_item_data( NAXMLReader *reader )
-{
-}
-#endif
-
 static xmlNode *
 search_for_child_node( xmlNode *node, const gchar *key )
 {
@@ -2397,175 +1430,3 @@ strxcmp( const xmlChar *a, const char *b )
 	xmlFree( xb );
 	return( ret );
 }
-
-#if 0
-static gchar *
-get_uuid_from_key( NAXMLReader *reader, const gchar *key, guint line )
-{
-	gchar *uuid, *pos;
-
-	if( !g_str_has_prefix( key, NA_GCONF_CONFIG_PATH )){
-		add_message( reader,
-				ERR_INVALID_KEY_PREFIX, NA_GCONF_CONFIG_PATH, key, line );
-		return( NULL );
-	}
-
-	uuid = g_strdup( key + strlen( NA_GCONF_CONFIG_PATH "/" ));
-	pos = g_strstr_len( uuid, strlen( uuid ), "/" );
-	if( pos != NULL ){
-		*pos = '\0';
-	}
-
-	if( !is_uuid_valid( uuid )){
-		add_message( reader, ERR_NOT_AN_UUID, uuid, line );
-		g_free( uuid );
-		uuid = NULL;
-	}
-
-	return( uuid );
-}
-
-static gboolean
-is_uuid_valid( const gchar *uuid )
-{
-	uuid_t uu;
-	return( uuid_parse( uuid, uu ) == 0 );
-}
-
-static gchar *
-get_entry_from_key( const gchar *key )
-{
-	gchar *pos = g_strrstr( key, "/" );
-	gchar *entry = pos ? g_strdup( pos+1 ) : g_strdup( key );
-	return( entry );
-}
-#endif
-
-/*
- * returns IMPORTER_CODE_OK if we can safely insert the action
- * - the id doesn't already exist
- * - the id already exist, but import mode is renumber
- * - the id already exists, but import mode is override
- */
-static guint
-manage_import_mode( NAXMLReader *reader )
-{
-#if 0
-	NAObjectItem *exists;
-	gchar *uuid;
-	BaseApplication *appli;
-	NactMainWindow *main_window;
-	gboolean ret;
-	gint mode;
-
-	appli = base_window_get_application( BASE_WINDOW( reader->private->window ));
-	main_window = NACT_MAIN_WINDOW( base_application_get_main_window( appli ));
-
-	uuid = na_object_get_id( reader->private->action );
-	exists = nact_main_window_get_item( main_window, uuid );
-	if( !exists ){
-		exists = search_in_auxiliaries( reader, uuid );
-	}
-
-	if( !exists ){
-		g_free( uuid );
-		return( TRUE );
-	}
-
-	if( reader->private->import_mode == IPREFS_IMPORT_ASK ){
-		mode = nact_assistant_import_ask_user( main_window, reader->private->uri, reader->private->action, exists );
-	} else {
-		mode = reader->private->import_mode;
-	}
-
-	switch( mode ){
-		case IPREFS_IMPORT_RENUMBER:
-			na_object_set_new_id( reader->private->action, NULL );
-			relabel( reader );
-			if( reader->private->import_mode == IPREFS_IMPORT_ASK ){
-				add_message( reader, "%s", _( "Action was renumbered due to user request." ));
-			}
-			ret = TRUE;
-			break;
-
-		case IPREFS_IMPORT_OVERRIDE:
-			if( reader->private->import_mode == IPREFS_IMPORT_ASK ){
-				add_message( reader, "%s", _( "Existing action was overriden due to user request." ));
-			}
-			ret = TRUE;
-			break;
-
-		case IPREFS_IMPORT_NO_IMPORT:
-		default:
-			add_message( reader, ERR_UUID_ALREADY_EXISTS, uuid );
-			if( reader->private->import_mode == IPREFS_IMPORT_ASK ){
-				add_message( reader, "%s", _( "Import was canceled due to user request." ));
-			}
-			ret = FALSE;
-	}
-
-	g_free( uuid );
-	return( ret );
-#endif
-	return( IMPORTER_CODE_OK );
-}
-
-#if 0
-static void
-propagate_default_values( NAXMLReader *reader )
-{
-	gchar *action_label, *toolbar_label;
-	gboolean same_label;
-
-	/* between 2.29.1 and 2.29.4, we use to have a toolbar_same_label indicator
-	 * starting with 2.29.5, we no more have this flag
-	 */
-	same_label = FALSE;
-	action_label = na_object_get_label( reader->private->action );
-	toolbar_label = na_object_action_toolbar_get_label( reader->private->action );
-	if( !toolbar_label || !g_utf8_strlen( toolbar_label, -1 ) || !g_utf8_collate( toolbar_label, action_label )){
-		same_label = TRUE;
-		na_object_action_toolbar_set_label( reader->private->action, action_label );
-	}
-	na_object_action_toolbar_set_same_label( reader->private->action, same_label );
-	g_free( toolbar_label );
-	g_free( action_label );
-}
-
-static NAObjectItem *
-search_in_auxiliaries( NAXMLReader *reader, const gchar *uuid )
-{
-	NAObjectItem *action;
-	gchar *aux_uuid;
-	GList *it;
-
-	action = NULL;
-	for( it = reader->private->auxiliaries ; it && !action ; it = it->next ){
-		aux_uuid = na_object_get_id( it->data );
-		if( !strcmp( aux_uuid, uuid )){
-			action = NA_OBJECT_ITEM( it->data );
-		}
-		g_free( aux_uuid );
-	}
-	return( action );
-}
-
-/*
- * set a new label because the action has been renumbered
- */
-static void
-relabel( NAXMLReader *reader )
-{
-	gchar *label, *tmp;
-
-	label = na_object_get_label( reader->private->action );
-
-	/* i18n: the action has been renumbered during import operation */
-	tmp = g_strdup_printf( "%s %s", label, _( "(renumbered)" ));
-
-	na_object_set_label( reader->private->action, tmp );
-
-	g_free( tmp );
-	g_free( label );
-}
-#endif
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index 72ef636..4bbfda2 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -101,8 +101,6 @@ nautilus_actions_config_tool_SOURCES = \
 	nact-icommand-tab.h									\
 	nact-iconditions-tab.c								\
 	nact-iconditions-tab.h								\
-	nact-import-ask.c									\
-	nact-import-ask.h									\
 	nact-iprefs.c										\
 	nact-iprefs.h										\
 	nact-main.c											\
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index f97e48e..28e5f26 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -66,6 +66,8 @@ enum {
 	ASSIST_PAGE_DONE
 };
 
+/* a structure which hosts successfully imported files
+ */
 typedef struct {
 	gchar        *uri;
 	NAObjectItem *item;
@@ -73,6 +75,14 @@ typedef struct {
 }
 	ImportUriStruct;
 
+/* a structure to check for existance of imported items
+ */
+typedef struct {
+	NactAssistantImport *assistant;
+	GList               *imported;
+}
+	ImportCheck;
+
 /* private class data
  */
 struct NactAssistantImportClassPrivate {
@@ -89,33 +99,34 @@ struct NactAssistantImportPrivate {
 
 static BaseAssistantClass *st_parent_class = NULL;
 
-static GType    register_type( void );
-static void     class_init( NactAssistantImportClass *klass );
-static void     instance_init( GTypeInstance *instance, gpointer klass );
-static void     instance_dispose( GObject *application );
-static void     instance_finalize( GObject *application );
+static GType         register_type( void );
+static void          class_init( NactAssistantImportClass *klass );
+static void          instance_init( GTypeInstance *instance, gpointer klass );
+static void          instance_dispose( GObject *application );
+static void          instance_finalize( GObject *application );
 
 static NactAssistantImport *assist_new( BaseWindow *parent );
 
-static gchar   *window_get_iprefs_window_id( const BaseWindow *window );
-static gchar   *window_get_dialog_name( const BaseWindow *dialog );
-
-static void     on_initial_load_dialog( NactAssistantImport *dialog, gpointer user_data );
-static void     on_runtime_init_dialog( NactAssistantImport *dialog, gpointer user_data );
-static void     runtime_init_intro( NactAssistantImport *window, GtkAssistant *assistant );
-static void     runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant );
-static void     on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data );
-static gboolean has_readable_files( GSList *uris );
-static void     runtime_init_duplicates( NactAssistantImport *window, GtkAssistant *assistant );
-static void     set_import_mode( NactAssistantImport *window, gint mode );
-
-static void     assistant_prepare( BaseAssistant *window, GtkAssistant *assistant, GtkWidget *page );
-static void     prepare_confirm( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
-static gint     get_import_mode( NactAssistantImport *window );
-static gchar   *add_import_mode( NactAssistantImport *window, const gchar *text );
-static void     assistant_apply( BaseAssistant *window, GtkAssistant *assistant );
-static void     prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
-static void     free_results( GSList *list );
+static gchar        *window_get_iprefs_window_id( const BaseWindow *window );
+static gchar        *window_get_dialog_name( const BaseWindow *dialog );
+
+static void          on_initial_load_dialog( NactAssistantImport *dialog, gpointer user_data );
+static void          on_runtime_init_dialog( NactAssistantImport *dialog, gpointer user_data );
+static void          runtime_init_intro( NactAssistantImport *window, GtkAssistant *assistant );
+static void          runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant );
+static void          on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data );
+static gboolean      has_readable_files( GSList *uris );
+static void          runtime_init_duplicates( NactAssistantImport *window, GtkAssistant *assistant );
+static void          set_import_mode( NactAssistantImport *window, gint mode );
+
+static void          assistant_prepare( BaseAssistant *window, GtkAssistant *assistant, GtkWidget *page );
+static void          prepare_confirm( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
+static gint          get_import_mode( NactAssistantImport *window );
+static gchar        *add_import_mode( NactAssistantImport *window, const gchar *text );
+static void          assistant_apply( BaseAssistant *window, GtkAssistant *assistant );
+static NAObjectItem *check_for_existance( const NAObjectItem *, ImportCheck *check );
+static void          prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
+static void          free_results( GSList *list );
 
 GType
 nact_assistant_import_get_type( void )
@@ -465,11 +476,13 @@ runtime_init_duplicates( NactAssistantImport *window, GtkAssistant *assistant )
 {
 	static const gchar *thisfn = "nact_assistant_import_runtime_init_duplicates";
 	GtkWidget *page;
-	gint mode;
+	guint mode;
+	GConfClient *gconf;
 
 	g_debug( "%s: window=%p", thisfn, ( void * ) window );
 
-	mode = nact_iprefs_get_import_mode( BASE_WINDOW( window ), IPREFS_IMPORT_ITEMS_IMPORT_MODE );
+	gconf = gconf_client_get_default();
+	mode = na_iprefs_get_import_mode( gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE );
 	set_import_mode( window, mode );
 
 	page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_DUPLICATES );
@@ -583,8 +596,10 @@ get_import_mode( NactAssistantImport *window )
 	mode = IMPORTER_MODE_NO_IMPORT;
 	if( gtk_toggle_button_get_active( renumber_button )){
 		mode = IMPORTER_MODE_RENUMBER;
+
 	} else if( gtk_toggle_button_get_active( override_button )){
 		mode = IMPORTER_MODE_OVERRIDE;
+
 	} else if( gtk_toggle_button_get_active( ask_button )){
 		mode = IMPORTER_MODE_ASK;
 	}
@@ -652,13 +667,14 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
 	GtkWidget *chooser;
 	GSList *uris, *is;
 	ImportUriStruct *str;
-	GList *items;
+	GList *imported_items;
 	BaseWindow *mainwnd;
 	guint mode;
 	NactApplication *application;
 	NAUpdater *updater;
 	NAIImporterParms parms;
 	guint code;
+	ImportCheck check_str;
 
 	g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) wnd, ( void * ) assistant );
 	g_assert( NACT_IS_ASSISTANT_IMPORT( wnd ));
@@ -672,32 +688,36 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
 
 	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( wnd )));
 	updater = nact_application_get_updater( application );
+	imported_items = NULL;
+	check_str.assistant = window;
+	check_str.imported = imported_items;
 
 	/* import actions
 	 * getting results in the same order than uris
 	 * simultaneously building the actions list
 	 */
-	items = NULL;
 	for( is = uris ; is ; is = is->next ){
 
 		parms.version = 1;
 		parms.uri = ( gchar * ) is->data;
 		parms.mode = mode;
+		parms.window = base_window_get_toplevel( base_application_get_main_window( BASE_APPLICATION( application )));
 		parms.messages = NULL;
 		parms.item = NULL;
-		parms.fn = NULL;
-		parms.fn_data = NULL;
+		parms.check_fn = ( NAIImporterCheckFn ) &check_for_existance;
+		parms.check_fn_data = &check_str;
 
 		code = na_importer_import_from_uri( NA_PIVOT( updater ), &parms );
 
 		str = g_new0( ImportUriStruct, 1 );
 		str->uri = g_strdup( parms.uri );
 		str->item = parms.item;
-		str->msg = parms.messages;
+		str->msg = na_core_utils_slist_duplicate( parms.messages );
+		na_core_utils_slist_free( parms.messages );
 
 		if( str->item ){
 			na_object_check_status( str->item );
-			items = g_list_prepend( items, str->item );
+			imported_items = g_list_prepend( imported_items, str->item );
 		}
 
 		window->private->results = g_slist_prepend( window->private->results, str );
@@ -708,9 +728,44 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
 	/* then insert the list
 	 * assuring that actions will be inserted in the same order as uris
 	 */
-	items = g_list_reverse( items );
-	nact_iactions_list_bis_insert_items( NACT_IACTIONS_LIST( mainwnd ), items, NULL );
-	na_object_unref_items( items );
+	imported_items = g_list_reverse( imported_items );
+	nact_iactions_list_bis_insert_items( NACT_IACTIONS_LIST( mainwnd ), imported_items, NULL );
+	na_object_unref_items( imported_items );
+}
+
+static NAObjectItem *
+check_for_existance( const NAObjectItem *item, ImportCheck *check )
+{
+	NAObjectItem *exists;
+	NactApplication *application;
+	NactMainWindow *main_window;
+	GList *ip;
+
+	exists = NULL;
+	gchar *current_id = na_object_get_id( item );
+	g_debug( "nact_assistant_import_check_for_existance: current_id=%s", current_id );
+
+	/* is the imported item already in the current importation list ?
+	 */
+	for( ip = check->imported ; ip && !exists ; ip = ip->next ){
+		gchar *id = na_object_get_id( ip->data );
+		if( !strcmp( current_id, id )){
+			exists = NA_OBJECT_ITEM( ip->data );
+		}
+		g_free( id );
+	}
+
+	/* else, is it in the main window list ?
+	 */
+	if( !exists ){
+		application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( check->assistant )));
+		main_window = NACT_MAIN_WINDOW( base_application_get_main_window( BASE_APPLICATION( application )));
+		exists = nact_main_window_get_item( main_window, current_id );
+	}
+
+	g_free( current_id );
+
+	return( exists );
 }
 
 static void
@@ -722,7 +777,8 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
 	GSList *is, *im;
 	ImportUriStruct *str;
 	GFile *file;
-	gint mode;
+	guint mode;
+	GConfClient *gconf;
 
 	g_debug( "%s: window=%p, assistant=%p, page=%p",
 			thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
@@ -786,7 +842,8 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
 	g_free( text );
 
 	mode = get_import_mode( window );
-	nact_iprefs_set_import_mode( BASE_WINDOW( window ), IPREFS_IMPORT_ITEMS_IMPORT_MODE, mode );
+	gconf = gconf_client_get_default();
+	na_iprefs_set_import_mode( gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE, mode );
 
 	gtk_assistant_set_page_complete( assistant, page, TRUE );
 	base_assistant_set_warn_on_cancel( BASE_ASSISTANT( window ), FALSE );
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index 0ee856a..ddec69e 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -34,7 +34,6 @@
 #endif
 
 #include <api/na-gconf-utils.h>
-#include <api/na-iimporter.h>
 
 #include <core/na-iprefs.h>
 
@@ -47,17 +46,6 @@ struct NactIPrefsInterfacePrivate {
 	GConfClient *client;
 };
 
-#define DEFAULT_IMPORT_MODE_INT				IMPORTER_MODE_NO_IMPORT
-#define DEFAULT_IMPORT_MODE_STR				"NoImport"
-
-static GConfEnumStringPair import_mode_table[] = {
-	{ IMPORTER_MODE_NO_IMPORT,				DEFAULT_IMPORT_MODE_STR },
-	{ IMPORTER_MODE_RENUMBER,				"Renumber" },
-	{ IMPORTER_MODE_OVERRIDE,				"Override" },
-	{ IMPORTER_MODE_ASK,					"Ask" },
-	{ 0, NULL }
-};
-
 static gboolean st_initialized = FALSE;
 static gboolean st_finalized = FALSE;
 
@@ -203,76 +191,6 @@ nact_iprefs_set_export_format( const BaseWindow *window, const gchar *name, GQua
 }
 
 /**
- * nact_iprefs_get_import_mode:
- * @instance: this #NAIPrefs interface instance.
- * @name: name of the import key to be readen
- *
- * Returns: the import mode currently set.
- *
- * Note: this function returns a suitable default value even if the key
- * is not found in GConf preferences or no schema has been installed.
- *
- * Note: please take care of keeping the default value synchronized with
- * those defined in schemas.
- */
-gint
-nact_iprefs_get_import_mode( const BaseWindow *window, const gchar *name )
-{
-	gint import_mode = DEFAULT_IMPORT_MODE_INT;
-	gint import_int;
-	gchar *import_str;
-	NactApplication *application;
-	NAUpdater *updater;
-
-	g_return_val_if_fail( BASE_IS_WINDOW( window ), DEFAULT_IMPORT_MODE_INT );
-
-	if( st_initialized && !st_finalized ){
-
-		application = NACT_APPLICATION( base_window_get_application( window ));
-		updater = nact_application_get_updater( application );
-
-		import_str = na_iprefs_read_string(
-				NA_IPREFS( updater ),
-				name,
-				DEFAULT_IMPORT_MODE_STR );
-
-		if( gconf_string_to_enum( import_mode_table, import_str, &import_int )){
-			import_mode = import_int;
-		}
-
-		g_free( import_str );
-	}
-
-	return( import_mode );
-}
-
-/**
- * nact_iprefs_set_import_mode:
- * @instance: this #NAIPrefs interface instance.
- * @mode: the new value to be written.
- *
- * Writes the current status of 'import mode' to the GConf
- * preference system.
- */
-void
-nact_iprefs_set_import_mode( const BaseWindow *window, const gchar *name, gint mode )
-{
-	const gchar *import_str;
-
-	g_return_if_fail( BASE_IS_WINDOW( window ));
-
-	if( st_initialized && !st_finalized ){
-
-		import_str = gconf_enum_to_string( import_mode_table, mode );
-
-		nact_iprefs_write_string(
-				window,
-				name,
-				import_str ? import_str : DEFAULT_IMPORT_MODE_STR );
-	}
-}
-
-/**
  * nact_iprefs_migrate_key:
  * @window: a #BaseWindow window.
  * @old_key: the old preference entry.
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index fc206c9..c9686dc 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -65,8 +65,6 @@ typedef struct {
 #define IPREFS_EXPORT_FORMAT_DEFAULT			"GConfEntry"
 
 #define IPREFS_IMPORT_ITEMS_FOLDER_URI			"import-folder-uri"
-#define IPREFS_IMPORT_ITEMS_IMPORT_MODE			"import-mode"
-#define IPREFS_IMPORT_ASK_LAST_MODE				"import-ask-user-last-mode"
 
 #define IPREFS_ASSIST_ESC_QUIT					"assistant-esc-quit"
 #define IPREFS_ASSIST_ESC_CONFIRM				"assistant-esc-confirm"
@@ -84,9 +82,6 @@ GType nact_iprefs_get_type( void );
 GQuark nact_iprefs_get_export_format( const BaseWindow *window, const gchar *pref );
 void   nact_iprefs_set_export_format( const BaseWindow *window, const gchar *pref, GQuark format );
 
-gint  nact_iprefs_get_import_mode   ( const BaseWindow *window, const gchar *pref );
-void  nact_iprefs_set_import_mode   ( const BaseWindow *window, const gchar *pref, gint mode );
-
 void  nact_iprefs_migrate_key       ( const BaseWindow *window, const gchar *old_key, const gchar *new_key );
 
 void  nact_iprefs_write_bool        ( const BaseWindow *window, const gchar *key, gboolean value );
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index 285f735..b8d1a6e 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -77,7 +77,7 @@ GType           nact_main_window_get_type( void );
 NactMainWindow *nact_main_window_new( BaseApplication *application );
 
 NactClipboard  *nact_main_window_get_clipboard     ( const NactMainWindow *window );
-NAObjectItem   *nact_main_window_get_item          ( const NactMainWindow *window, const gchar *uuid );
+NAObjectItem   *nact_main_window_get_item          ( const NactMainWindow *window, const gchar *id );
 gboolean        nact_main_window_has_modified_items( const NactMainWindow *window );
 void            nact_main_window_move_to_deleted   ( NactMainWindow *window, GList *items );
 void            nact_main_window_reload            ( NactMainWindow *window );
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 1e05641..cccea6f 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -299,12 +299,13 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 	gboolean add_about_item;
 	gboolean create_root_menu;
 	gboolean relabel;
-	gint import_mode;
+	guint import_mode;
 	GQuark export_format;
 	GtkWidget *container;
 	GtkWidget *button;
 	gboolean esc_quit, esc_confirm;
 	GtkTreeView *listview;
+	GConfClient *gconf;
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
 
@@ -369,7 +370,8 @@ on_base_runtime_init_dialog( NactPreferencesEditor *editor, gpointer user_data )
 
 	/* third tab: import tool
 	 */
-	import_mode = nact_iprefs_get_import_mode( BASE_WINDOW( editor ), IPREFS_IMPORT_ITEMS_IMPORT_MODE );
+	gconf = gconf_client_get_default();
+	import_mode = na_iprefs_get_import_mode( gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE );
 	switch( import_mode ){
 		case IMPORTER_MODE_ASK:
 			button = base_window_get_widget( BASE_WINDOW( editor ), "PrefsAskButton" );
@@ -468,10 +470,11 @@ save_preferences( NactPreferencesEditor *editor )
 	gint order_mode;
 	gboolean enabled;
 	gboolean relabel;
-	gint import_mode;
+	guint import_mode;
 	GtkWidget *container;
 	GQuark export_format;
 	gboolean esc_quit, esc_confirm;
+	GConfClient *gconf;
 
 	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( editor )));
 	updater = nact_application_get_updater( application );
@@ -542,7 +545,8 @@ save_preferences( NactPreferencesEditor *editor )
 			}
 		}
 	}
-	nact_iprefs_set_import_mode( BASE_WINDOW( editor ), IPREFS_IMPORT_ITEMS_IMPORT_MODE, import_mode );
+	gconf = gconf_client_get_default();
+	na_iprefs_set_import_mode( gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE, import_mode );
 
 	/* fourth tab: export tool
 	 */
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index 558f05b..79649c2 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -32,12 +32,14 @@
 #include <config.h>
 #endif
 
+#include <gconf/gconf-client.h>
 #include <glib/gi18n.h>
 #include <string.h>
 
 #include <api/na-core-utils.h>
 #include <api/na-object-api.h>
 
+#include <core/na-iprefs.h>
 #include <core/na-importer.h>
 
 #include "nact-application.h"
@@ -749,12 +751,13 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData  *selec
 	GSList *uri_list, *is;
 	NactApplication *application;
 	NAUpdater *updater;
-	gint import_mode;
+	guint import_mode;
 	NactMainWindow *main_window;
 	GtkTreePath *new_dest;
 	GList *object_list;
 	NAIImporterParms parms;
 	guint code;
+	GConfClient *gconf;
 
 	application = NACT_APPLICATION( base_window_get_application( model->private->window ));
 	updater = nact_application_get_updater( application );
@@ -767,7 +770,8 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData  *selec
 	}
 
 	uri_list = g_slist_reverse( na_core_utils_slist_from_split(( const gchar * ) selection_data->data, "\n" ));
-	import_mode = nact_iprefs_get_import_mode( BASE_WINDOW( main_window ), IPREFS_IMPORT_ITEMS_IMPORT_MODE );
+	gconf = gconf_client_get_default();
+	import_mode = na_iprefs_get_import_mode( gconf, IPREFS_IMPORT_ITEMS_IMPORT_MODE );
 	object_list = NULL;
 
 	for( is = uri_list ; is ; is = is->next ){
@@ -777,8 +781,8 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData  *selec
 		parms.mode = import_mode;
 		parms.messages = NULL;
 		parms.item = NULL;
-		parms.fn = NULL;
-		parms.fn_data = NULL;
+		parms.check_fn = NULL;
+		parms.check_fn_data = NULL;
 
 		code = na_importer_import_from_uri( NA_PIVOT( updater ), &parms );
 
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 7dfe1cc..ab7fac7 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -1341,9 +1341,15 @@ Defining several profiles lets you have several commands, each applying with a d
       <placeholder/>
     </child>
     <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
       <object class="GtkLabel" id="label3">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">This assistant will guide you through the process of importing actions.</property>
+        <property name="label" translatable="yes">This assistant will guide you through the process of importing items, actions or menus.</property>
       </object>
       <packing>
         <property name="page_type">intro</property>
@@ -1356,10 +1362,10 @@ Defining several profiles lets you have several commands, each applying with a d
         <child>
           <object class="GtkFileChooserWidget" id="ImportFileChooser">
             <property name="visible">True</property>
-            <property name="select_multiple">True</property>
             <property name="use_preview_label">False</property>
-            <property name="local_only">False</property>
+            <property name="select_multiple">True</property>
             <property name="preview_widget_active">False</property>
+            <property name="local_only">False</property>
           </object>
           <packing>
             <property name="position">0</property>
@@ -1384,9 +1390,11 @@ Defining several profiles lets you have several commands, each applying with a d
             <child>
               <object class="GtkLabel" id="label38">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">What should I do when importing an action whose UUID already exists ?</property>
+                <property name="label" translatable="yes">&lt;b&gt;What should I do when importing an item whose ID already exists ?&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
               </object>
               <packing>
+                <property name="expand">False</property>
                 <property name="position">0</property>
               </packing>
             </child>
@@ -1401,7 +1409,7 @@ Defining several profiles lets you have several commands, each applying with a d
                     <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkRadioButton" id="NoImportButton">
-                        <property name="label" translatable="yes">Do not import the action which UUID already exists</property>
+                        <property name="label" translatable="yes">Do not import the item whose ID already exists</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -1421,7 +1429,7 @@ Defining several profiles lets you have several commands, each applying with a d
                             <property name="xpad">16</property>
                             <property name="label" translatable="yes">This used to be the historical behavior.
 The selected file will be marked as "NOT OK" in the Summary page.
-The existing action will not be modified.</property>
+The existing item will not be modified.</property>
                           </object>
                           <packing>
                             <property name="padding">4</property>
@@ -1444,7 +1452,7 @@ The existing action will not be modified.</property>
                     <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkRadioButton" id="RenumberButton">
-                        <property name="label" translatable="yes">Allocate a new identifiant for the imported action</property>
+                        <property name="label" translatable="yes">Allocate a new identifiant for the imported item</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -1464,7 +1472,7 @@ The existing action will not be modified.</property>
                             <property name="xalign">0</property>
                             <property name="xpad">16</property>
                             <property name="label" translatable="yes">The selected file will be imported with a slightly modified label indicating the renumbering.
-The existing action will not be modified.</property>
+The existing item will not be modified.</property>
                             <property name="wrap">True</property>
                           </object>
                           <packing>
@@ -1488,7 +1496,7 @@ The existing action will not be modified.</property>
                     <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkRadioButton" id="OverrideButton">
-                        <property name="label" translatable="yes">Override the existing action</property>
+                        <property name="label" translatable="yes">Override the existing item</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -1507,7 +1515,7 @@ The existing action will not be modified.</property>
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
                             <property name="xpad">16</property>
-                            <property name="label" translatable="yes">The action found in the selected file will silently override the current action which has the same identifiant.
+                            <property name="label" translatable="yes">The item found in the selected file will silently override the current one which has the same identifiant.
 Be warned: this mode may be dangerous. You will not be prompted another time.</property>
                             <property name="wrap">True</property>
                           </object>
@@ -1551,7 +1559,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
                             <property name="xpad">16</property>
-                            <property name="label" translatable="yes">You will be asked each time an imported UUID already exists.</property>
+                            <property name="label" translatable="yes">You will be asked each time an imported ID already exists.</property>
                             <property name="wrap">True</property>
                           </object>
                           <packing>
@@ -1987,195 +1995,6 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
       </object>
     </child>
   </object>
-  <object class="GtkDialog" id="AssistantImportAsk">
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Already existing action</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox2">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child>
-          <object class="GtkVBox" id="vbox37">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkVBox" id="vbox39">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="ImportAskLabel">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="xpad">6</property>
-                    <property name="wrap">True</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label47">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="xpad">6</property>
-                    <property name="label" translatable="yes">What should I do with this ?</property>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="vbox38">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <object class="GtkRadioButton" id="AskNoImportButton">
-                    <property name="label" translatable="yes">Do _not import the action</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Existing action will remain unchanged.</property>
-                    <property name="use_underline">True</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkRadioButton" id="AskRenumberButton">
-                    <property name="label" translatable="yes">Import the action, _renumbering it</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Existing action will remain unchanged.</property>
-                    <property name="use_underline">True</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">AskNoImportButton</property>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkRadioButton" id="AskOverrideButton">
-                    <property name="label" translatable="yes">_Override the existing action</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">The imported action will override the existing one.
-Be warned: this mode may be dangerous. You will not be prompted another time.</property>
-                    <property name="use_underline">True</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">AskNoImportButton</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkHSeparator" id="hseparator1">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="vbox40">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <object class="GtkCheckButton" id="AskKeepChoiceButton">
-                    <property name="label" translatable="yes">Re_member my choice in future import operations</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area2">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="CancelButton1">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="OKButton1">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="0">CancelButton1</action-widget>
-      <action-widget response="0">OKButton1</action-widget>
-    </action-widgets>
-  </object>
   <object class="GtkImage" id="image2">
     <property name="visible">True</property>
     <property name="stock">gtk-find-and-replace</property>
diff --git a/src/test/test-reader.c b/src/test/test-reader.c
index d4463b6..b06e139 100755
--- a/src/test/test-reader.c
+++ b/src/test/test-reader.c
@@ -77,8 +77,8 @@ main( int argc, char **argv )
 	parms.uri = uri;
 	parms.mode = IMPORTER_MODE_ASK;
 	parms.item = NULL;
-	parms.fn = NULL;
-	parms.fn_data = NULL;
+	parms.check_fn = NULL;
+	parms.check_fn_data = NULL;
 	parms.messages = NULL;
 
 	guint code = na_importer_import_from_uri( pivot, &parms );



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