[nautilus-actions] NADataBoxed now derives from NABoxed class



commit c6316f8f2bebde5dc154e3566217e28a0802aa35
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Feb 14 23:10:00 2011 +0100

    NADataBoxed now derives from NABoxed class

 ChangeLog                     |   16 +
 src/api/na-boxed.h            |   30 +-
 src/api/na-data-boxed.h       |   53 +-
 src/api/na-data-types.h       |    8 +-
 src/core/na-boxed.c           |  931 ++++++++++++++++++++++++--------
 src/core/na-core-utils.c      |    4 +-
 src/core/na-data-boxed.c      | 1208 +++++++++++------------------------------
 src/core/na-data-types.c      |    2 +-
 src/core/na-factory-object.c  |   22 +-
 src/core/na-ifactory-object.c |    2 +-
 src/core/na-settings.c        |    2 +-
 src/io-desktop/nadp-writer.c  |    2 +-
 src/io-gconf/nagp-writer.c    |    2 +-
 src/io-xml/naxml-writer.c     |    2 +-
 14 files changed, 1109 insertions(+), 1175 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ce3c091..99da540 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2011-02-14 Pierre Wieser <pwieser trychlos org>
 
+	NADataBoxed class now derives from NABoxed
+
+	* * src/api/na-boxed.h:
+	* src/api/na-data-boxed.h:
+	* src/api/na-data-types.h:
+	* src/core/na-boxed.c:
+	* src/core/na-core-utils.c:
+	* src/core/na-data-boxed.c:
+	* src/core/na-data-types.c:
+	* src/core/na-factory-object.c:
+	* src/core/na-ifactory-object.c:
+	* src/core/na-settings.c:
+	* src/io-desktop/nadp-writer.c:
+	* src/io-gconf/nagp-writer.c:
+	* src/io-xml/naxml-writer.c: Updated accordingly.
+
 	* src/api/na-boxed.h:
 	* src/core/na-boxed.c: Convert to the NABoxed class.
 
diff --git a/src/api/na-boxed.h b/src/api/na-boxed.h
index 82a619d..a02352c 100644
--- a/src/api/na-boxed.h
+++ b/src/api/na-boxed.h
@@ -72,19 +72,27 @@ typedef struct {
 }
 	NABoxedClass;
 
-GType         na_boxed_get_type                ( void );
+GType         na_boxed_get_type       ( void );
+void          na_boxed_set_type       ( NABoxed *boxed, guint type );
 
-int           na_boxed_compare                 ( const NABoxed *a, const NABoxed *b );
-NABoxed      *na_boxed_copy                    ( const NABoxed *value );
-void          na_boxed_dump                    ( const NABoxed *value );
-NABoxed      *na_boxed_new_from_string         ( guint type, const gchar *string );
+gboolean      na_boxed_are_equal      ( const NABoxed *a, const NABoxed *b );
+NABoxed      *na_boxed_copy           ( const NABoxed *value );
+void          na_boxed_dump           ( const NABoxed *value );
+NABoxed      *na_boxed_new_from_string( guint type, const gchar *string );
 
-gboolean      na_boxed_get_boolean             ( const NABoxed *boxed );
-gconstpointer na_boxed_get_pointer             ( const NABoxed *boxed );
-gchar        *na_boxed_get_string              ( const NABoxed *boxed );
-GSList       *na_boxed_get_string_list         ( const NABoxed *boxed );
-guint         na_boxed_get_uint                ( const NABoxed *boxed );
-GList        *na_boxed_get_uint_list           ( const NABoxed *boxed );
+gboolean      na_boxed_get_boolean    ( const NABoxed *boxed );
+gconstpointer na_boxed_get_pointer    ( const NABoxed *boxed );
+gchar        *na_boxed_get_string     ( const NABoxed *boxed );
+GSList       *na_boxed_get_string_list( const NABoxed *boxed );
+guint         na_boxed_get_uint       ( const NABoxed *boxed );
+GList        *na_boxed_get_uint_list  ( const NABoxed *boxed );
+void          na_boxed_get_as_value   ( const NABoxed *boxed, GValue *value );
+void         *na_boxed_get_as_void    ( const NABoxed *boxed );
+
+void          na_boxed_set_from_boxed ( NABoxed *boxed, const NABoxed *value );
+void          na_boxed_set_from_string( NABoxed *boxed, const gchar *value );
+void          na_boxed_set_from_value ( NABoxed *boxed, const GValue *value );
+void          na_boxed_set_from_void  ( NABoxed *boxed, const void *value );
 
 G_END_DECLS
 
diff --git a/src/api/na-data-boxed.h b/src/api/na-data-boxed.h
index a22900a..dc116b4 100644
--- a/src/api/na-data-boxed.h
+++ b/src/api/na-data-boxed.h
@@ -40,15 +40,19 @@
  * The object which encapsulates an elementary data of #NAIFactoryObject.
  * A #NADataBoxed object has a type and a value.
  *
- * Starting with version 3.1.0, #NAFactoryDataType is deprecated in favour
- * of #NABoxed structure. New code should only use #NABoxed structure and
- * accessors.
+ * #NADataBoxed class is derived from #NABoxed one, and implements the same
+ * types that those defined in na-data-types.h.
  *
- * Deprecated: 3.1.0
+ * Additionally, #NADataBoxed class holds the #NADataDef data definition
+ * suitable for a #NAFactoryObject object. It such provides default value
+ * and validity status.
+ *
+ * Since: 2.30
  */
 
 #include <glib-object.h>
 
+#include "na-boxed.h"
 #include "na-data-def.h"
 
 G_BEGIN_DECLS
@@ -64,7 +68,7 @@ typedef struct _NADataBoxedPrivate        NADataBoxedPrivate;
 
 typedef struct {
 	/*< private >*/
-	GObject             parent;
+	NABoxed             parent;
 	NADataBoxedPrivate *private;
 }
 	NADataBoxed;
@@ -73,33 +77,36 @@ typedef struct _NADataBoxedClassPrivate   NADataBoxedClassPrivate;
 
 typedef struct {
 	/*< private >*/
-	GObjectClass             parent;
+	NABoxedClass             parent;
 	NADataBoxedClassPrivate *private;
 }
 	NADataBoxedClass;
 
-GType        na_data_boxed_get_type( void );
-
-GParamSpec  *na_data_boxed_get_param_spec ( const NADataDef *def );
+GType            na_data_boxed_get_type( void );
 
-NADataBoxed *na_data_boxed_new            ( const NADataDef *def );
+NADataBoxed     *na_data_boxed_new            ( const NADataDef *def );
 
-NADataDef   *na_data_boxed_get_data_def   ( const NADataBoxed *boxed );
-gboolean     na_data_boxed_are_equal      ( const NADataBoxed *a, const NADataBoxed *b );
-gboolean     na_data_boxed_is_default     ( const NADataBoxed *boxed );
-gboolean     na_data_boxed_is_valid       ( const NADataBoxed *boxed );
-void         na_data_boxed_dump           ( const NADataBoxed *boxed );
+const NADataDef *na_data_boxed_get_data_def   ( const NADataBoxed *boxed );
+void             na_data_boxed_set_data_def   ( NADataBoxed *boxed, const NADataDef *def );
 
-void         na_data_boxed_set_data_def   ( NADataBoxed *boxed, const NADataDef *def );
+GParamSpec      *na_data_boxed_get_param_spec ( const NADataDef *def );
 
-gchar       *na_data_boxed_get_as_string  ( const NADataBoxed *boxed );
-void        *na_data_boxed_get_as_void    ( const NADataBoxed *boxed );
-void         na_data_boxed_get_as_value   ( const NADataBoxed *boxed, GValue *value );
+gboolean         na_data_boxed_is_default     ( const NADataBoxed *boxed );
+gboolean         na_data_boxed_is_valid       ( const NADataBoxed *boxed );
 
-void         na_data_boxed_set_from_boxed ( NADataBoxed *boxed, const NADataBoxed *value );
-void         na_data_boxed_set_from_string( NADataBoxed *boxed, const gchar *value );
-void         na_data_boxed_set_from_value ( NADataBoxed *boxed, const GValue *value );
-void         na_data_boxed_set_from_void  ( NADataBoxed *boxed, const void *value );
+/* These functions are deprecated starting with 3.1.0
+ */
+#ifndef NA_DISABLE_DEPRECATED
+gboolean         na_data_boxed_are_equal      ( const NADataBoxed *a, const NADataBoxed *b );
+void             na_data_boxed_dump           ( const NADataBoxed *boxed );
+gchar           *na_data_boxed_get_as_string  ( const NADataBoxed *boxed );
+void            *na_data_boxed_get_as_void    ( const NADataBoxed *boxed );
+void             na_data_boxed_get_as_value   ( const NADataBoxed *boxed, GValue *value );
+void             na_data_boxed_set_from_boxed ( NADataBoxed *boxed, const NADataBoxed *value );
+void             na_data_boxed_set_from_string( NADataBoxed *boxed, const gchar *value );
+void             na_data_boxed_set_from_value ( NADataBoxed *boxed, const GValue *value );
+void             na_data_boxed_set_from_void  ( NADataBoxed *boxed, const void *value );
+#endif /* NA_DISABLE_DEPRECATED */
 
 G_END_DECLS
 
diff --git a/src/api/na-data-types.h b/src/api/na-data-types.h
index 8a07031..b311753 100644
--- a/src/api/na-data-types.h
+++ b/src/api/na-data-types.h
@@ -44,12 +44,12 @@ G_BEGIN_DECLS
 
 /**
  * NADataType:
+ * @NA_DATA_TYPE_BOOLEAN:       a boolean
+ *                              can be initialized with "true" or "false" (case insensitive)
  * @NA_DATA_TYPE_POINTER:       a ( void * ) pointer
  * @NA_DATA_TYPE_STRING:        an ASCII string
  * @NA_DATA_TYPE_STRING_LIST:   a list of ASCII strings
  * @NA_DATA_TYPE_LOCALE_STRING: a localized UTF-8 string
- * @NA_DATA_TYPE_BOOLEAN:       a boolean
- *                              can be initialized with "true" or "false" (case insensitive)
  * @NA_DATA_TYPE_UINT:          an unsigned integer
  * @NA_DATA_TYPE_UINT_LIST:     a list of unsigned integers
  *
@@ -75,11 +75,11 @@ G_BEGIN_DECLS
  * Since: 2.30
  */
 typedef enum {
-	NA_DATA_TYPE_POINTER = 1,
+	NA_DATA_TYPE_BOOLEAN = 1,
+	NA_DATA_TYPE_POINTER,
 	NA_DATA_TYPE_STRING,
 	NA_DATA_TYPE_STRING_LIST,
 	NA_DATA_TYPE_LOCALE_STRING,
-	NA_DATA_TYPE_BOOLEAN,
 	NA_DATA_TYPE_UINT,
 	NA_DATA_TYPE_UINT_LIST,
 	/*< private >*/
diff --git a/src/core/na-boxed.c b/src/core/na-boxed.c
index 275ecb1..7c3bd1a 100644
--- a/src/core/na-boxed.c
+++ b/src/core/na-boxed.c
@@ -34,7 +34,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 
 #include <api/na-boxed.h>
 #include <api/na-data-types.h>
@@ -47,22 +46,25 @@ struct _NABoxedClassPrivate {
 };
 
 /* BoxedDef:
- * the structure which fully defines the behavior of this data type
+ * This is the structure which fully defines the behavior of this data type.
  */
 typedef struct {
 	guint            type;
 	const gchar     *label;
-	int           ( *compare )        ( const NABoxed *, const NABoxed * );
-	void          ( *copy )           ( NABoxed *, const NABoxed * );
-	gchar       * ( *dump )           ( const NABoxed * );
-	void          ( *free )           ( NABoxed * );
-	void          ( *from_string )    ( NABoxed *, const gchar * );
-	gboolean      ( *get_bool )       ( const NABoxed * );
-	gconstpointer ( *get_pointer )    ( const NABoxed * );
-	gchar       * ( *get_string )     ( const NABoxed * );
-	GSList      * ( *get_string_list )( const NABoxed * );
-	guint         ( *get_uint )       ( const NABoxed * );
-	GList       * ( *get_uint_list )  ( const NABoxed * );
+	gboolean      ( *are_equal )     ( const NABoxed *, const NABoxed * );
+	void          ( *copy )          ( NABoxed *, const NABoxed * );
+	void          ( *free )          ( NABoxed * );
+	void          ( *from_string )   ( NABoxed *, const gchar * );
+	void          ( *from_value )    ( NABoxed *, const GValue * );
+	void          ( *from_void )     ( NABoxed *, const void * );
+	gboolean      ( *to_bool )       ( const NABoxed * );
+	gconstpointer ( *to_pointer )    ( const NABoxed * );
+	gchar       * ( *to_string )     ( const NABoxed * );
+	GSList      * ( *to_string_list )( const NABoxed * );
+	guint         ( *to_uint )       ( const NABoxed * );
+	GList       * ( *to_uint_list )  ( const NABoxed * );
+	void          ( *to_value )      ( const NABoxed *, GValue * );
+	void        * ( *to_void )       ( const NABoxed * );
 }
 	BoxedDef;
 
@@ -74,9 +76,9 @@ struct _NABoxedPrivate {
 	gboolean        is_set;
 	union {
 		gboolean    boolean;
+		void       *pointer;
 		gchar      *string;
 		GSList     *string_list;
-		void       *pointer;
 		guint       uint;
 		GList      *uint_list;
 	} u;
@@ -96,111 +98,198 @@ static NABoxed        *boxed_new( const BoxedDef *def );
 static const BoxedDef *get_boxed_def( guint type );
 static gchar         **string_to_array( const gchar *string );
 
-static int             string_compare( const NABoxed *a, const NABoxed *b );
+static gboolean        bool_are_equal( const NABoxed *a, const NABoxed *b );
+static void            bool_copy( NABoxed *dest, const NABoxed *src );
+static void            bool_free( NABoxed *boxed );
+static void            bool_from_string( NABoxed *boxed, const gchar *string );
+static void            bool_from_value( NABoxed *boxed, const GValue *value );
+static void            bool_from_void( NABoxed *boxed, const void *value );
+static gchar          *bool_to_string( const NABoxed *boxed );
+static gboolean        bool_to_bool( const NABoxed *boxed );
+static gconstpointer   bool_to_pointer( const NABoxed *boxed );
+static gchar          *bool_to_string( const NABoxed *boxed );
+static void            bool_to_value( const NABoxed *boxed, GValue *value );
+static void           *bool_to_void( const NABoxed *boxed );
+
+static gboolean        pointer_are_equal( const NABoxed *a, const NABoxed *b );
+static void            pointer_copy( NABoxed *dest, const NABoxed *src );
+static void            pointer_free( NABoxed *boxed );
+static void            pointer_from_string( NABoxed *boxed, const gchar *string );
+static void            pointer_from_value( NABoxed *boxed, const GValue *value );
+static void            pointer_from_void( NABoxed *boxed, const void *value );
+static gconstpointer   pointer_to_pointer( const NABoxed *boxed );
+static gchar          *pointer_to_string( const NABoxed *boxed );
+static void            pointer_to_value( const NABoxed *boxed, GValue *value );
+static void           *pointer_to_void( const NABoxed *boxed );
+
+static gboolean        string_are_equal( const NABoxed *a, const NABoxed *b );
 static void            string_copy( NABoxed *dest, const NABoxed *src );
-static gchar          *string_dump( const NABoxed *boxed );
 static void            string_free( NABoxed *boxed );
 static void            string_from_string( NABoxed *boxed, const gchar *string );
-static gchar          *string_get_string( const NABoxed *boxed );
-
-static int             string_list_compare( const NABoxed *a, const NABoxed *b );
+static void            string_from_value( NABoxed *boxed, const GValue *value );
+static void            string_from_void( NABoxed *boxed, const void *value );
+static gconstpointer   string_to_pointer( const NABoxed *boxed );
+static gchar          *string_to_string( const NABoxed *boxed );
+static void            string_to_value( const NABoxed *boxed, GValue *value );
+static void           *string_to_void( const NABoxed *boxed );
+
+static gboolean        string_list_are_equal( const NABoxed *a, const NABoxed *b );
 static void            string_list_copy( NABoxed *dest, const NABoxed *src );
-static gchar          *string_list_dump( const NABoxed *boxed );
 static void            string_list_free( NABoxed *boxed );
 static void            string_list_from_string( NABoxed *boxed, const gchar *string );
-static GSList         *string_list_get_string_list( const NABoxed *boxed );
+static void            string_list_from_value( NABoxed *boxed, const GValue *value );
+static void            string_list_from_void( NABoxed *boxed, const void *value );
+static gconstpointer   string_list_to_pointer( const NABoxed *boxed );
+static gchar          *string_list_to_string( const NABoxed *boxed );
+static GSList         *string_list_to_string_list( const NABoxed *boxed );
+static void            string_list_to_value( const NABoxed *boxed, GValue *value );
+static void           *string_list_to_void( const NABoxed *boxed );
 
-static int             bool_compare( const NABoxed *a, const NABoxed *b );
-static void            bool_copy( NABoxed *dest, const NABoxed *src );
-static gchar          *bool_dump( const NABoxed *boxed );
-static void            bool_free( NABoxed *boxed );
-static void            bool_from_string( NABoxed *boxed, const gchar *string );
-static gboolean        bool_get_bool( const NABoxed *boxed );
+static gboolean        locale_are_equal( const NABoxed *a, const NABoxed *b );
 
-static int             uint_compare( const NABoxed *a, const NABoxed *b );
+static gboolean        uint_are_equal( const NABoxed *a, const NABoxed *b );
 static void            uint_copy( NABoxed *dest, const NABoxed *src );
-static gchar          *uint_dump( const NABoxed *boxed );
 static void            uint_free( NABoxed *boxed );
 static void            uint_from_string( NABoxed *boxed, const gchar *string );
-static guint           uint_get_uint( const NABoxed *boxed );
-
-static int             uint_list_compare( const NABoxed *a, const NABoxed *b );
+static void            uint_from_value( NABoxed *boxed, const GValue *value );
+static void            uint_from_void( NABoxed *boxed, const void *value );
+static gconstpointer   uint_to_pointer( const NABoxed *boxed );
+static gchar          *uint_to_string( const NABoxed *boxed );
+static guint           uint_to_uint( const NABoxed *boxed );
+static void            uint_to_value( const NABoxed *boxed, GValue *value );
+static void           *uint_to_void( const NABoxed *boxed );
+
+static gboolean        uint_list_are_equal( const NABoxed *a, const NABoxed *b );
 static void            uint_list_copy( NABoxed *dest, const NABoxed *src );
-static gchar          *uint_list_dump( const NABoxed *boxed );
 static void            uint_list_free( NABoxed *boxed );
 static void            uint_list_from_string( NABoxed *boxed, const gchar *string );
-static GList          *uint_list_get_uint_list( const NABoxed *boxed );
+static void            uint_list_from_value( NABoxed *boxed, const GValue *value );
+static void            uint_list_from_void( NABoxed *boxed, const void *value );
+static gconstpointer   uint_list_to_pointer( const NABoxed *boxed );
+static gchar          *uint_list_to_string( const NABoxed *boxed );
+static GList          *uint_list_to_uint_list( const NABoxed *boxed );
+static void            uint_list_to_value( const NABoxed *boxed, GValue *value );
+static void           *uint_list_to_void( const NABoxed *boxed );
 
 static BoxedDef st_boxed_def[] = {
+		{ NA_DATA_TYPE_BOOLEAN,
+				"boolean",
+				bool_are_equal,
+				bool_copy,
+				bool_free,
+				bool_from_string,
+				bool_from_value,
+				bool_from_void,
+				bool_to_bool,
+				bool_to_pointer,
+				bool_to_string,
+				NULL,
+				NULL,
+				NULL,
+				bool_to_value,
+				bool_to_void
+				},
+		{ NA_DATA_TYPE_POINTER,
+				"pointer",
+				pointer_are_equal,
+				pointer_copy,
+				pointer_free,
+				pointer_from_string,
+				pointer_from_value,
+				pointer_from_void,
+				NULL,
+				pointer_to_pointer,
+				pointer_to_string,
+				NULL,
+				NULL,
+				NULL,
+				pointer_to_value,
+				pointer_to_void
+				},
 		{ NA_DATA_TYPE_STRING,
 				"string",
-				string_compare,
+				string_are_equal,
 				string_copy,
-				string_dump,
 				string_free,
 				string_from_string,
-				NULL,
-				NULL,
-				string_get_string,
-				NULL,
-				NULL,
-				NULL
+				string_from_value,
+				string_from_void,
+				NULL,						/* to_bool */
+				string_to_pointer,
+				string_to_string,
+				NULL,						/* to_string_list */
+				NULL,						/* to_uint */
+				NULL,						/* to_uint_list */
+				string_to_value,
+				string_to_void
 				},
 		{ NA_DATA_TYPE_STRING_LIST,
 				"string_list",
-				string_list_compare,
+				string_list_are_equal,
 				string_list_copy,
-				string_list_dump,
 				string_list_free,
 				string_list_from_string,
+				string_list_from_value,
+				string_list_from_void,
 				NULL,
+				string_list_to_pointer,
+				string_list_to_string,
+				string_list_to_string_list,
 				NULL,
 				NULL,
-				string_list_get_string_list,
-				NULL,
-				NULL
+				string_list_to_value,
+				string_list_to_void
 				},
-		{ NA_DATA_TYPE_BOOLEAN,
-				"boolean",
-				bool_compare,
-				bool_copy,
-				bool_dump,
-				bool_free,
-				bool_from_string,
-				bool_get_bool,
-				NULL,
-				NULL,
-				NULL,
-				NULL,
-				NULL
+		{ NA_DATA_TYPE_LOCALE_STRING,
+				"locale_string",
+				locale_are_equal,
+				string_copy,
+				string_free,
+				string_from_string,
+				string_from_value,
+				string_from_void,
+				NULL,						/* to_bool */
+				string_to_pointer,
+				string_to_string,
+				NULL,						/* to_string_list */
+				NULL,						/* to_uint */
+				NULL,						/* to_uint_list */
+				string_to_value,
+				string_to_void
 				},
 		{ NA_DATA_TYPE_UINT,
 				"uint",
-				uint_compare,
+				uint_are_equal,
 				uint_copy,
-				uint_dump,
 				uint_free,
 				uint_from_string,
+				uint_from_value,
+				uint_from_void,
 				NULL,
+				uint_to_pointer,
+				uint_to_string,
 				NULL,
+				uint_to_uint,
 				NULL,
-				NULL,
-				uint_get_uint,
-				NULL
+				uint_to_value,
+				uint_to_void
 				},
 		{ NA_DATA_TYPE_UINT_LIST,
 				"uint_list",
-				uint_list_compare,
+				uint_list_are_equal,
 				uint_list_copy,
-				uint_list_dump,
 				uint_list_free,
 				uint_list_from_string,
+				uint_list_from_value,
+				uint_list_from_void,
 				NULL,
+				uint_list_to_pointer,
+				uint_list_to_string,
 				NULL,
 				NULL,
-				NULL,
-				NULL,
-				uint_list_get_uint_list
+				uint_list_to_uint_list,
+				uint_list_to_value,
+				uint_list_to_void
 				},
 		{ 0 }
 };
@@ -378,60 +467,56 @@ string_to_array( const gchar *string )
 }
 
 /**
- * na_boxed_compare:
- * @a: the first #NABoxed object.
- * @b: the second #NABoxed object.
+ * na_boxed_set_type:
+ * @boxed: this #NABoxed object.
+ * @type: the required type as defined in na-data-types.h
  *
- * Returns:
- *  <itemizedlist>
- *   <listitem>
- *    <para>
- *     -1 if @a is lesser than @b;
- *    </para>
- *   </listitem>
- *   <listitem>
- *    <para>
- *     0 if @a and @b have the same value;
- *    </para>
- *   </listitem>
- *   <listitem>
- *    <para>
- *     +1 if @a is greater than @b.
- *    </para>
- *   </listitem>
- *  </itemizedlist>
- *
- * Also returns zero as an irrelevant value if @a (resp. @b) is not set, or %NULL,
- * or already disposed, or @a and @b do not have the same elementary data type.
+ * Set the type of the just-allocated @boxed object.
  *
  * Since: 3.1.0
  */
-int
-na_boxed_compare( const NABoxed *a, const NABoxed *b )
+void
+na_boxed_set_type( NABoxed *boxed, guint type )
 {
-	int result;
-
-	g_return_val_if_fail( NA_IS_BOXED( a ), 0 );
-	g_return_val_if_fail( a->private->dispose_has_run == FALSE, 0 );
-	g_return_val_if_fail( NA_IS_BOXED( b ), 0 );
-	g_return_val_if_fail( b->private->dispose_has_run == FALSE, 0 );
-	g_return_val_if_fail( a->private->def, 0 );
-	g_return_val_if_fail( a->private->def == b->private->def, 0 );
-	g_return_val_if_fail( a->private->def->compare, 0 );
-
-	result = 0;
-
-	if( a->private->is_set && b->private->is_set ){
-		result = ( *a->private->def->compare )( a, b );
+	g_return_if_fail( NA_IS_BOXED( boxed ));
+	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
+	g_return_if_fail( boxed->private->def == NULL );
 
-	} else if( a->private->is_set && !b->private->is_set ){
-		result = 1;
+	boxed->private->def = get_boxed_def( type );
+}
 
-	} else if( !a->private->is_set && b->private->is_set ){
-		result = -1;
+/**
+ * na_boxed_are_equal:
+ * @a: the first #NABoxed object.
+ * @b: the second #NABoxed object.
+ *
+ * Returns: %TRUE if @a and @b are equal, %FALSE else.
+ *
+ * Since: 3.1.0
+ */
+gboolean
+na_boxed_are_equal( const NABoxed *a, const NABoxed *b )
+{
+	gboolean are_equal;
+
+	g_return_val_if_fail( NA_IS_BOXED( a ), FALSE );
+	g_return_val_if_fail( a->private->dispose_has_run == FALSE, FALSE );
+	g_return_val_if_fail( NA_IS_BOXED( b ), FALSE );
+	g_return_val_if_fail( b->private->dispose_has_run == FALSE, FALSE );
+	g_return_val_if_fail( a->private->def, FALSE );
+	g_return_val_if_fail( a->private->def == b->private->def, FALSE );
+	g_return_val_if_fail( a->private->def->are_equal, FALSE );
+
+	are_equal = FALSE;
+
+	if( a->private->is_set == b->private->is_set ){
+		are_equal = TRUE;
+		if( a->private->is_set ){
+			are_equal = ( *a->private->def->are_equal )( a, b );
+		}
 	}
 
-	return( result );
+	return( are_equal );
 }
 
 /**
@@ -478,9 +563,9 @@ na_boxed_dump( const NABoxed *boxed )
 	g_return_if_fail( NA_IS_BOXED( boxed ));
 	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
 	g_return_if_fail( boxed->private->def );
-	g_return_if_fail( boxed->private->def->dump );
+	g_return_if_fail( boxed->private->def->to_string );
 
-	str = ( boxed->private->is_set ) ? ( *boxed->private->def->dump )( boxed ) : NULL;
+	str = ( boxed->private->is_set ) ? ( *boxed->private->def->to_string )( boxed ) : NULL;
 	g_debug( "%s: boxed=%p, type=%u, is_set=%s, value=%s",
 			thisfn, ( void * ) boxed, boxed->private->def->type,
 			boxed->private->is_set ? "True":"False", str );
@@ -538,9 +623,9 @@ na_boxed_get_boolean( const NABoxed *boxed )
 	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, FALSE );
 	g_return_val_if_fail( boxed->private->def, FALSE );
 	g_return_val_if_fail( boxed->private->def->type == NA_DATA_TYPE_BOOLEAN, FALSE );
-	g_return_val_if_fail( boxed->private->def->get_bool, FALSE );
+	g_return_val_if_fail( boxed->private->def->to_bool, FALSE );
 
-	value = ( *boxed->private->def->get_bool )( boxed );
+	value = ( *boxed->private->def->to_bool )( boxed );
 
 	return( value );
 }
@@ -562,12 +647,11 @@ na_boxed_get_pointer( const NABoxed *boxed )
 	g_return_val_if_fail( NA_IS_BOXED( boxed ), NULL );
 	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, NULL );
 	g_return_val_if_fail( boxed->private->def, NULL );
-	g_return_val_if_fail( boxed->private->def->type == NA_DATA_TYPE_POINTER, NULL );
-	g_return_val_if_fail( boxed->private->def->get_pointer, NULL );
+	g_return_val_if_fail( boxed->private->def->to_pointer, NULL );
 
-	value = ( *boxed->private->def->get_pointer )( boxed );
+	value = ( *boxed->private->def->to_pointer )( boxed );
 
-	return(( gconstpointer ) value );
+	return( value );
 }
 
 /**
@@ -587,10 +671,9 @@ na_boxed_get_string( const NABoxed *boxed )
 	g_return_val_if_fail( NA_IS_BOXED( boxed ), NULL );
 	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, NULL );
 	g_return_val_if_fail( boxed->private->def, NULL );
-	g_return_val_if_fail( boxed->private->def->type == NA_DATA_TYPE_STRING, NULL );
-	g_return_val_if_fail( boxed->private->def->get_string, NULL );
+	g_return_val_if_fail( boxed->private->def->to_string, NULL );
 
-	value = ( *boxed->private->def->get_string )( boxed );
+	value = ( *boxed->private->def->to_string )( boxed );
 
 	return( value );
 }
@@ -613,9 +696,9 @@ na_boxed_get_string_list( const NABoxed *boxed )
 	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, NULL );
 	g_return_val_if_fail( boxed->private->def, NULL );
 	g_return_val_if_fail( boxed->private->def->type == NA_DATA_TYPE_STRING_LIST, NULL );
-	g_return_val_if_fail( boxed->private->def->get_string_list, NULL );
+	g_return_val_if_fail( boxed->private->def->to_string_list, NULL );
 
-	value = ( *boxed->private->def->get_string_list )( boxed );
+	value = ( *boxed->private->def->to_string_list )( boxed );
 
 	return( value );
 }
@@ -638,9 +721,9 @@ na_boxed_get_uint( const NABoxed *boxed )
 	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, 0 );
 	g_return_val_if_fail( boxed->private->def, 0 );
 	g_return_val_if_fail( boxed->private->def->type == NA_DATA_TYPE_UINT, 0 );
-	g_return_val_if_fail( boxed->private->def->get_uint, 0 );
+	g_return_val_if_fail( boxed->private->def->to_uint, 0 );
 
-	value = ( *boxed->private->def->get_uint )( boxed );
+	value = ( *boxed->private->def->to_uint )( boxed );
 
 	return( value );
 }
@@ -663,17 +746,280 @@ na_boxed_get_uint_list( const NABoxed *boxed )
 	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, NULL );
 	g_return_val_if_fail( boxed->private->def, NULL );
 	g_return_val_if_fail( boxed->private->def->type == NA_DATA_TYPE_UINT_LIST, NULL );
-	g_return_val_if_fail( boxed->private->def->get_uint_list, NULL );
+	g_return_val_if_fail( boxed->private->def->to_uint_list, NULL );
 
-	value = ( *boxed->private->def->get_uint_list )( boxed );
+	value = ( *boxed->private->def->to_uint_list )( boxed );
 
 	return( value );
 }
 
-static int
-string_compare( const NABoxed *a, const NABoxed *b )
+/**
+ * na_boxed_get_as_value:
+ * @boxed: the #NABoxed whose value is to be got.
+ * @value: the #GValue which holds the string to be set.
+ *
+ * Setup @value with the content of the @boxed.
+ *
+ * Since: 3.1.0
+ */
+void
+na_boxed_get_as_value( const NABoxed *boxed, GValue *value )
+{
+	g_return_if_fail( NA_IS_BOXED( boxed ));
+	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
+	g_return_if_fail( boxed->private->def );
+	g_return_if_fail( boxed->private->def->to_value );
+
+	( *boxed->private->def->to_value )( boxed, value );
+}
+
+/**
+ * na_boxed_get_as_void:
+ * @boxed: the #NABoxed whose value is to be got.
+ *
+ * Returns: the content of the @boxed.
+ *
+ * If of type NA_DATA_TYPE_STRING (resp. NA_DATA_TYPE_LOCALE_STRING,
+ * NA_DATA_TYPE_STRING_LIST or NA_DATA_TYPE_UINT_LIST), then the content
+ * is returned in a newly allocated value, which should be g_free() (resp.
+ * g_free(), na_core_utils_slist_free(), g_list_free()) by the caller.
+ *
+ * Since: 3.1.0
+ */
+void *
+na_boxed_get_as_void( const NABoxed *boxed )
+{
+	g_return_val_if_fail( NA_IS_BOXED( boxed ), NULL );
+	g_return_val_if_fail( boxed->private->dispose_has_run == FALSE, NULL );
+	g_return_val_if_fail( boxed->private->def, NULL );
+	g_return_val_if_fail( boxed->private->def->to_void, NULL );
+
+	return(( *boxed->private->def->to_void )( boxed ));
+}
+
+/**
+ * na_boxed_set_from_boxed:
+ * @boxed: the #NABoxed whose value is to be set.
+ * @value: the source #NABoxed.
+ *
+ * Copy value from @value to @boxed.
+ *
+ * Since: 3.1.0
+ */
+void
+na_boxed_set_from_boxed( NABoxed *boxed, const NABoxed *value )
+{
+	g_return_if_fail( NA_IS_BOXED( boxed ));
+	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
+	g_return_if_fail( NA_IS_BOXED( value ));
+	g_return_if_fail( value->private->dispose_has_run == FALSE );
+	g_return_if_fail( boxed->private->def );
+	g_return_if_fail( boxed->private->def == value->private->def );
+	g_return_if_fail( boxed->private->def->copy );
+
+	( *boxed->private->def->copy )( boxed, value );
+}
+
+/**
+ * na_boxed_set_from_string:
+ * @boxed: the #NABoxed whose value is to be set.
+ * @value: the string to be set.
+ *
+ * Evaluates the @value and set it to the @boxed.
+ *
+ * Since: 3.1.0
+ */
+void
+na_boxed_set_from_string( NABoxed *boxed, const gchar *value )
+{
+	g_return_if_fail( NA_IS_BOXED( boxed ));
+	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
+	g_return_if_fail( boxed->private->def );
+	g_return_if_fail( boxed->private->def->from_string );
+
+	( *boxed->private->def->from_string )( boxed, value );
+}
+
+/**
+ * na_boxed_set_from_value:
+ * @boxed: the #NABoxed whose value is to be set.
+ * @value: the value whose content is to be got.
+ *
+ * Evaluates the @value and set it to the @boxed.
+ *
+ * Since: 3.1.0
+ */
+void
+na_boxed_set_from_value( NABoxed *boxed, const GValue *value )
+{
+	g_return_if_fail( NA_IS_BOXED( boxed ));
+	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
+	g_return_if_fail( boxed->private->def );
+	g_return_if_fail( boxed->private->def->from_string );
+
+	( *boxed->private->def->from_value )( boxed, value );
+}
+
+/**
+ * na_boxed_set_from_void:
+ * @boxed: the #NABoxed whose value is to be set.
+ * @value: the value whose content is to be got.
+ *
+ * Evaluates the @value and set it to the @boxed.
+ *
+ * Since: 3.1.0
+ */
+void
+na_boxed_set_from_void( NABoxed *boxed, const void *value )
+{
+	g_return_if_fail( NA_IS_BOXED( boxed ));
+	g_return_if_fail( boxed->private->dispose_has_run == FALSE );
+	g_return_if_fail( boxed->private->def );
+	g_return_if_fail( boxed->private->def->from_string );
+
+	( *boxed->private->def->from_void )( boxed, value );
+}
+
+static gboolean
+bool_are_equal( const NABoxed *a, const NABoxed *b )
+{
+	return( a->private->u.boolean == b->private->u.boolean );
+}
+
+static void
+bool_copy( NABoxed *dest, const NABoxed *src )
+{
+	dest->private->u.boolean = src->private->u.boolean;
+	dest->private->is_set = TRUE;
+}
+
+static void
+bool_free( NABoxed *boxed )
+{
+	boxed->private->u.boolean = FALSE;
+	boxed->private->is_set = FALSE;
+}
+
+static void
+bool_from_string( NABoxed *boxed, const gchar *string )
+{
+	if( boxed->private->is_set ){
+		bool_free( boxed );
+	}
+	boxed->private->u.boolean = na_core_utils_boolean_from_string( string );
+	boxed->private->is_set = TRUE;
+}
+
+static void
+bool_from_value( NABoxed *boxed, const GValue *value )
+{
+	boxed->private->u.boolean = g_value_get_boolean( value );
+}
+
+static void
+bool_from_void( NABoxed *boxed, const void *value )
+{
+	boxed->private->u.boolean = GPOINTER_TO_UINT( value );
+}
+
+static gboolean
+bool_to_bool( const NABoxed *boxed )
+{
+	return( boxed->private->u.boolean );
+}
+
+static gconstpointer
+bool_to_pointer( const NABoxed *boxed )
+{
+	return(( gconstpointer ) GUINT_TO_POINTER( boxed->private->u.boolean ));
+}
+
+static gchar *
+bool_to_string( const NABoxed *boxed )
+{
+	return( g_strdup_printf( "%s", boxed->private->u.boolean ? "true":"false" ));
+}
+
+static void
+bool_to_value( const NABoxed *boxed, GValue *value )
+{
+	g_value_set_boolean( value, boxed->private->u.boolean );
+}
+
+static void *
+bool_to_void( const NABoxed *boxed )
+{
+	return( GUINT_TO_POINTER( boxed->private->u.boolean ));
+}
+
+static gboolean
+pointer_are_equal( const NABoxed *a, const NABoxed *b )
+{
+	return( a->private->u.pointer == b->private->u.pointer );
+}
+
+/*
+ * note that copying a pointer is not safe
+ */
+static void
+pointer_copy( NABoxed *dest, const NABoxed *src )
+{
+	dest->private->u.pointer = src->private->u.pointer;
+}
+
+static void
+pointer_free( NABoxed *boxed )
+{
+	boxed->private->u.pointer = NULL;
+	boxed->private->is_set = FALSE;
+}
+
+static void
+pointer_from_string( NABoxed *boxed, const gchar *pointer )
+{
+	g_warning( "na_boxed_pointer_from_string: unrelevant function call" );
+}
+
+static void
+pointer_from_value( NABoxed *boxed, const GValue *value )
+{
+	boxed->private->u.pointer = g_value_get_pointer( value );
+}
+
+static void
+pointer_from_void( NABoxed *boxed, const void *value )
+{
+	boxed->private->u.pointer = ( void * ) value;
+}
+
+static gconstpointer
+pointer_to_pointer( const NABoxed *boxed )
+{
+	return( boxed->private->u.pointer );
+}
+
+static gchar *
+pointer_to_string( const NABoxed *boxed )
+{
+	return( g_strdup_printf( "%p", boxed->private->u.pointer ));
+}
+
+static void
+pointer_to_value( const NABoxed *boxed, GValue *value )
+{
+	g_value_set_pointer( value, boxed->private->u.pointer );
+}
+
+static void *
+pointer_to_void( const NABoxed *boxed )
 {
-	return( strcmp( a->private->u.string, b->private->u.string ));
+	return( boxed->private->u.pointer );
+}
+
+static gboolean
+string_are_equal( const NABoxed *a, const NABoxed *b )
+{
+	return( strcmp( a->private->u.string, b->private->u.string ) == 0 );
 }
 
 static void
@@ -686,12 +1032,6 @@ string_copy( NABoxed *dest, const NABoxed *src )
 	dest->private->is_set = TRUE;
 }
 
-static gchar *
-string_dump( const NABoxed *boxed )
-{
-	return( g_strdup( boxed->private->u.string ));
-}
-
 static void
 string_free( NABoxed *boxed )
 {
@@ -710,21 +1050,63 @@ string_from_string( NABoxed *boxed, const gchar *string )
 	boxed->private->is_set = TRUE;
 }
 
+static void
+string_from_value( NABoxed *boxed, const GValue *value )
+{
+	if( boxed->private->is_set ){
+		string_free( boxed );
+	}
+	if( g_value_get_string( value )){
+		boxed->private->u.string = g_value_dup_string( value );
+	}
+	boxed->private->is_set = TRUE;
+}
+
+static void
+string_from_void( NABoxed *boxed, const void *value )
+{
+	if( boxed->private->is_set ){
+		string_free( boxed );
+	}
+	if( value ){
+		boxed->private->u.string = g_strdup(( const gchar * ) value );
+	}
+	boxed->private->is_set = TRUE;
+}
+
+static gconstpointer
+string_to_pointer( const NABoxed *boxed )
+{
+	return(( gconstpointer ) boxed->private->u.string );
+}
+
 static gchar *
-string_get_string( const NABoxed *boxed )
+string_to_string( const NABoxed *boxed )
 {
 	return( g_strdup( boxed->private->u.string ));
 }
 
+static void
+string_to_value( const NABoxed *boxed, GValue *value )
+{
+	gchar *str;
+
+	str = string_to_string( boxed );
+	g_value_set_string( value, str );
+	g_free( str );
+}
+
+static void *
+string_to_void( const NABoxed *boxed )
+{
+	return(( void * ) string_to_string( boxed ));
+}
+
 /* the two string lists are equal if they have the same elements in the
  * same order
- * if not, we compare the length of the lists
- *
- * don't know what to say for two lists which have the same count of elements,
- * but different contents; just arbitrarily return -1
  */
-static int
-string_list_compare( const NABoxed *a, const NABoxed *b )
+static gboolean
+string_list_are_equal( const NABoxed *a, const NABoxed *b )
 {
 	GSList *ia, *ib;
 	gboolean diff = FALSE;
@@ -732,8 +1114,7 @@ string_list_compare( const NABoxed *a, const NABoxed *b )
 	guint na = g_slist_length( a->private->u.string_list );
 	guint nb = g_slist_length( b->private->u.string_list );
 
-	if( na < nb ) return -1;
-	if( na > nb ) return  1;
+	if( na != nb ) return( FALSE );
 
 	for( ia=a->private->u.string_list, ib=b->private->u.string_list ; ia && ib && !diff ; ia=ia->next, ib=ib->next ){
 		if( strcmp( ia->data, ib->data ) != 0 ){
@@ -741,7 +1122,7 @@ string_list_compare( const NABoxed *a, const NABoxed *b )
 		}
 	}
 
-	return( diff ? -1 : 0 );
+	return( !diff );
 }
 
 static void
@@ -754,12 +1135,6 @@ string_list_copy( NABoxed *dest, const NABoxed *src )
 	dest->private->is_set = TRUE;
 }
 
-static gchar *
-string_list_dump( const NABoxed *boxed )
-{
-	return( na_core_utils_slist_join_at_end( boxed->private->u.string_list, LIST_SEPARATOR ));
-}
-
 static void
 string_list_free( NABoxed *boxed )
 {
@@ -795,68 +1170,95 @@ string_list_from_string( NABoxed *boxed, const gchar *string )
 	boxed->private->is_set = TRUE;
 }
 
-static GSList *
-string_list_get_string_list( const NABoxed *boxed )
+static void
+string_list_from_value( NABoxed *boxed, const GValue *value )
 {
-	return( na_core_utils_slist_duplicate( boxed->private->u.string_list ));
+	if( boxed->private->is_set ){
+		string_list_free( boxed );
+	}
+	if( g_value_get_pointer( value )){
+		boxed->private->u.string_list = na_core_utils_slist_duplicate( g_value_get_pointer( value ));
+	}
+	boxed->private->is_set = TRUE;
 }
 
-/* assume that FALSE < TRUE
- */
-static int
-bool_compare( const NABoxed *a, const NABoxed *b )
+static void
+string_list_from_void( NABoxed *boxed, const void *value )
 {
-	if( a->private->u.boolean == b->private->u.boolean ){
-		return( 0 );
+	if( boxed->private->is_set ){
+		string_list_free( boxed );
 	}
-	if( !a->private->u.boolean ){
-		return( -1 );
+	if( value ){
+		boxed->private->u.string_list = na_core_utils_slist_duplicate(( GSList * ) value );
 	}
-	return( 1 );
+	boxed->private->is_set = TRUE;
 }
 
-static void
-bool_copy( NABoxed *dest, const NABoxed *src )
+static gconstpointer
+string_list_to_pointer( const NABoxed *boxed )
 {
-	dest->private->u.boolean = src->private->u.boolean;
-	dest->private->is_set = TRUE;
+	return(( gconstpointer ) boxed->private->u.string_list );
 }
 
 static gchar *
-bool_dump( const NABoxed *boxed )
+string_list_to_string( const NABoxed *boxed )
 {
-	return( g_strdup( boxed->private->u.boolean ? "True":"False" ));
+	GSList *is;
+	GString *str = g_string_new( "" );
+	gboolean first;
+
+	first = TRUE;
+	for( is = boxed->private->u.string_list ; is ; is = is->next ){
+		if( !first ){
+			str = g_string_append( str, LIST_SEPARATOR );
+		}
+		str = g_string_append( str, ( const gchar * ) is->data );
+		first = FALSE;
+	}
+
+	return( g_string_free( str, FALSE ));
 }
 
-static void
-bool_free( NABoxed *boxed )
+static GSList *
+string_list_to_string_list( const NABoxed *boxed )
 {
-	boxed->private->u.boolean = FALSE;
-	boxed->private->is_set = FALSE;
+	return( na_core_utils_slist_duplicate( boxed->private->u.string_list ));
 }
 
 static void
-bool_from_string( NABoxed *boxed, const gchar *string )
+string_list_to_value( const NABoxed *boxed, GValue *value )
 {
-	if( boxed->private->is_set ){
-		bool_free( boxed );
+	g_value_set_pointer( value, na_core_utils_slist_duplicate( boxed->private->u.string_list ));
+}
+
+static void *
+string_list_to_void( const NABoxed *boxed )
+{
+	void *value = NULL;
+
+	if( boxed->private->u.string_list ){
+		value = na_core_utils_slist_duplicate( boxed->private->u.string_list );
 	}
-	boxed->private->u.boolean = ( string ? ( strcasecmp( string, "true" ) == 0 || atoi( string ) != 0 ) : FALSE );
-	boxed->private->is_set = TRUE;
+
+	return( value );
 }
 
 static gboolean
-bool_get_bool( const NABoxed *boxed )
+locale_are_equal( const NABoxed *a, const NABoxed *b )
 {
-	return( boxed->private->u.boolean );
+	if( !a->private->u.string && !b->private->u.string ){
+		return( TRUE );
+	}
+	if( !a->private->u.string || !b->private->u.string ){
+		return( FALSE );
+	}
+	return( na_core_utils_str_collate( a->private->u.string, b->private->u.string ) == 0 );
 }
 
-static int
-uint_compare( const NABoxed *a, const NABoxed *b )
+static gboolean
+uint_are_equal( const NABoxed *a, const NABoxed *b )
 {
-	if( a->private->u.uint < b->private->u.uint ) return -1;
-	if( a->private->u.uint > b->private->u.uint ) return  1;
-	return( 0 );
+	return( a->private->u.uint == b->private->u.uint );
 }
 
 static void
@@ -866,12 +1268,6 @@ uint_copy( NABoxed *dest, const NABoxed *src )
 	dest->private->is_set = TRUE;
 }
 
-static gchar *
-uint_dump( const NABoxed *boxed )
-{
-	return( g_strdup_printf( "%u", boxed->private->u.uint ));
-}
-
 static void
 uint_free( NABoxed *boxed )
 {
@@ -889,19 +1285,63 @@ uint_from_string( NABoxed *boxed, const gchar *string )
 	boxed->private->is_set = TRUE;
 }
 
+static void
+uint_from_value( NABoxed *boxed, const GValue *value )
+{
+	if( boxed->private->is_set ){
+		uint_free( boxed );
+	}
+	boxed->private->u.uint = g_value_get_uint( value );
+	boxed->private->is_set = TRUE;
+}
+
+static void
+uint_from_void( NABoxed *boxed, const void *value )
+{
+	if( boxed->private->is_set ){
+		uint_free( boxed );
+	}
+	boxed->private->u.uint = GPOINTER_TO_UINT( value );
+	boxed->private->is_set = TRUE;
+}
+
+static gconstpointer
+uint_to_pointer( const NABoxed *boxed )
+{
+	return(( gconstpointer ) GUINT_TO_POINTER( boxed->private->u.uint ));
+}
+
+static gchar *
+uint_to_string( const NABoxed *boxed )
+{
+	return( g_strdup_printf( "%u", boxed->private->u.uint ));
+}
+
 static guint
-uint_get_uint( const NABoxed *boxed )
+uint_to_uint( const NABoxed *boxed )
 {
 	return( boxed->private->u.uint );
 }
 
+static void
+uint_to_value( const NABoxed *boxed, GValue *value )
+{
+	g_value_set_uint( value, boxed->private->u.uint );
+}
+
+static void *
+uint_to_void( const NABoxed *boxed )
+{
+	return( GUINT_TO_POINTER( boxed->private->u.uint ));
+}
+
 /* compare uint list as string list:
  * if the two list do not have the same count, then one is lesser than the other
  * if they have same count and same elements in same order, they are equal
  * else just arbitrarily return -1
  */
-static int
-uint_list_compare( const NABoxed *a, const NABoxed *b )
+static gboolean
+uint_list_are_equal( const NABoxed *a, const NABoxed *b )
 {
 	GList *ia, *ib;
 	gboolean diff = FALSE;
@@ -909,8 +1349,7 @@ uint_list_compare( const NABoxed *a, const NABoxed *b )
 	guint na = g_list_length( a->private->u.uint_list );
 	guint nb = g_list_length( b->private->u.uint_list );
 
-	if( na < nb ) return -1;
-	if( na > nb ) return  1;
+	if( na != nb ) return( FALSE );
 
 	for( ia=a->private->u.uint_list, ib=b->private->u.uint_list ; ia && ib && !diff ; ia=ia->next, ib=ib->next ){
 		if( GPOINTER_TO_UINT( ia->data ) != GPOINTER_TO_UINT( ib->data )){
@@ -918,7 +1357,7 @@ uint_list_compare( const NABoxed *a, const NABoxed *b )
 		}
 	}
 
-	return( diff ? -1 : 0 );
+	return( !diff );
 }
 
 static void
@@ -937,23 +1376,6 @@ uint_list_copy( NABoxed *dest, const NABoxed *src )
 	dest->private->is_set = TRUE;
 }
 
-static gchar *
-uint_list_dump( const NABoxed *boxed )
-{
-	GString *str;
-	GList *i;
-
-	str = g_string_new( "" );
-	for( i = boxed->private->u.uint_list ; i ; i = i->next ){
-		if( strlen( str->str )){
-			str = g_string_append( str, LIST_SEPARATOR );
-		}
-		g_string_append_printf( str, "%u", GPOINTER_TO_UINT( i->data ));
-	}
-
-	return( g_string_free( str, FALSE ));
-}
-
 static void
 uint_list_free( NABoxed *boxed )
 {
@@ -989,8 +1411,75 @@ uint_list_from_string( NABoxed *boxed, const gchar *string )
 	boxed->private->is_set = TRUE;
 }
 
+static void
+uint_list_from_value( NABoxed *boxed, const GValue *value )
+{
+	if( boxed->private->is_set ){
+		uint_list_free( boxed );
+	}
+	if( g_value_get_pointer( value )){
+		boxed->private->u.uint_list = g_list_copy( g_value_get_pointer( value ));
+	}
+	boxed->private->is_set = TRUE;
+}
+
+static void
+uint_list_from_void( NABoxed *boxed, const void *value )
+{
+	if( boxed->private->is_set ){
+		uint_list_free( boxed );
+	}
+	if( value ){
+		boxed->private->u.uint_list = g_list_copy(( GList * ) value );
+	}
+	boxed->private->is_set = TRUE;
+}
+
+static gconstpointer
+uint_list_to_pointer( const NABoxed *boxed )
+{
+	return(( gconstpointer ) boxed->private->u.uint_list );
+}
+
+static gchar *
+uint_list_to_string( const NABoxed *boxed )
+{
+	GList *is;
+	GString *str = g_string_new( "" );
+	gboolean first;
+
+	first = TRUE;
+	for( is = boxed->private->u.uint_list ; is ; is = is->next ){
+		if( !first ){
+			str = g_string_append( str, LIST_SEPARATOR );
+		}
+		g_string_append_printf( str, "%u", GPOINTER_TO_UINT( is->data ));
+		first = FALSE;
+	}
+
+	return( g_string_free( str, FALSE ));
+}
+
 static GList *
-uint_list_get_uint_list( const NABoxed *boxed )
+uint_list_to_uint_list( const NABoxed *boxed )
 {
 	return( g_list_copy( boxed->private->u.uint_list ));
 }
+
+static void
+uint_list_to_value( const NABoxed *boxed, GValue *value )
+{
+	g_value_set_pointer( value, g_list_copy( boxed->private->u.uint_list ));
+}
+
+static void *
+uint_list_to_void( const NABoxed *boxed )
+{
+	void *value = NULL;
+
+	if( boxed->private->u.uint_list ){
+		value = g_list_copy( boxed->private->u.uint_list );
+	}
+
+	return( value );
+}
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index 7a8953c..4817544 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -58,7 +58,9 @@ static gboolean info_dir_is_writable( GFile *file, const gchar *path );
 gboolean
 na_core_utils_boolean_from_string( const gchar *string )
 {
-	return( g_ascii_strcasecmp( string, "true" ) == 0 );
+	if( !string ) return( FALSE );
+
+	return( g_ascii_strcasecmp( string, "true" ) == 0 || atoi( string ) != 0 );
 }
 
 /**
diff --git a/src/core/na-data-boxed.c b/src/core/na-data-boxed.c
index ec91c95..517215d 100644
--- a/src/core/na-data-boxed.c
+++ b/src/core/na-data-boxed.c
@@ -48,212 +48,97 @@ struct _NADataBoxedClassPrivate {
 	void *empty;						/* so that gcc -pedantic is happy */
 };
 
-/* private instance data
+/* additional features of our data types
+ * (see NABoxed class for primary features)
  */
-struct _NADataBoxedPrivate {
-	gboolean      dispose_has_run;
-	NADataDef    *def ;
-	union {
-		gboolean  boolean;
-		gchar    *string;
-		GSList   *slist;
-		void     *pointer;
-		guint     uint;
-	} u;
-};
-
 typedef struct {
 	guint           type;
-	GParamSpec * ( *spec )           ( const NADataDef * );
-	void         ( *free )           ( const NADataBoxed * );
-	void         ( *dump )           ( const NADataBoxed * );
-	gboolean     ( *are_equal )      ( const NADataBoxed *, const NADataBoxed * );
-	gboolean     ( *is_default )     ( const NADataBoxed * );
-	gboolean     ( *is_valid )       ( const NADataBoxed * );
-	gchar *      ( *get_as_string )  ( const NADataBoxed * );
-	void *       ( *get_as_void )    ( const NADataBoxed * );
-	void         ( *get_as_value )   ( const NADataBoxed *, GValue *value );
-	void         ( *set_from_boxed ) ( NADataBoxed *, const NADataBoxed * );
-	void         ( *set_from_string )( NADataBoxed *, const gchar *string );
-	void         ( *set_from_value ) ( NADataBoxed *, const GValue *value );
-	void         ( *set_from_void )  ( NADataBoxed *, const void *value );
+	GParamSpec * ( *spec )      ( const NADataDef * );
+	gboolean     ( *is_default )( const NADataBoxed * );
+	gboolean     ( *is_valid )  ( const NADataBoxed * );
 }
-	DataBoxedFn;
+	DataBoxedDef;
+
+/* private instance data
+ */
+struct _NADataBoxedPrivate {
+	gboolean            dispose_has_run;
+	const NADataDef    *data_def ;
+	const DataBoxedDef *boxed_def;
+};
 
 static GObjectClass *st_parent_class   = NULL;
 
-static GType register_type( void );
-static void  class_init( NADataBoxedClass *klass );
-static void  instance_init( GTypeInstance *instance, gpointer klass );
-static void  instance_dispose( GObject *object );
-static void  instance_finalize( GObject *object );
-
-static DataBoxedFn *get_data_boxed_fn( guint type );
-
-static GParamSpec *string_spec( const NADataDef *idtype );
-static void        string_free( const NADataBoxed *boxed );
-static void        string_dump( const NADataBoxed *boxed );
-static gboolean    string_are_equal( const NADataBoxed *a, const NADataBoxed *b );
-static gboolean    string_is_default( const NADataBoxed *boxed );
-static gboolean    string_is_valid( const NADataBoxed *boxed );
-static gchar      *string_get_as_string( const NADataBoxed *boxed );
-static void       *string_get_as_void( const NADataBoxed *boxed );
-static void        string_get_as_value( const NADataBoxed *boxed, GValue *value );
-static void        string_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source );
-static void        string_set_from_string( NADataBoxed *boxed, const gchar *string );
-static void        string_set_from_value( NADataBoxed *boxed, const GValue *value );
-static void        string_set_from_void( NADataBoxed *boxed, const void *value );
-
-static gboolean    locale_are_equal( const NADataBoxed *a, const NADataBoxed *b );
-static gboolean    locale_is_default( const NADataBoxed *boxed );
-static gboolean    locale_is_valid( const NADataBoxed *boxed );
-
-static GParamSpec *slist_spec( const NADataDef *idtype );
-static void        slist_free( const NADataBoxed *boxed );
-static void        slist_dump( const NADataBoxed *boxed );
-static gboolean    slist_are_equal( const NADataBoxed *a, const NADataBoxed *b );
-static gboolean    slist_is_default( const NADataBoxed *boxed );
-static gboolean    slist_is_valid( const NADataBoxed *boxed );
-static gchar      *slist_get_as_string( const NADataBoxed *boxed );
-static void       *slist_get_as_void( const NADataBoxed *boxed );
-static void        slist_get_as_value( const NADataBoxed *boxed, GValue *value );
-static void        slist_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source );
-static void        slist_set_from_string( NADataBoxed *boxed, const gchar *string );
-static void        slist_set_from_value( NADataBoxed *boxed, const GValue *value );
-static void        slist_set_from_void( NADataBoxed *boxed, const void *value );
-
-static GParamSpec *bool_spec( const NADataDef *idtype );
-static void        bool_free( const NADataBoxed *boxed );
-static void        bool_dump( const NADataBoxed *boxed );
-static gboolean    bool_are_equal( const NADataBoxed *a, const NADataBoxed *b );
-static gboolean    bool_is_default( const NADataBoxed *boxed );
-static gboolean    bool_is_valid( const NADataBoxed *boxed );
-static gchar      *bool_get_as_string( const NADataBoxed *boxed );
-static void       *bool_get_as_void( const NADataBoxed *boxed );
-static void        bool_get_as_value( const NADataBoxed *boxed, GValue *value );
-static void        bool_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source );
-static void        bool_set_from_string( NADataBoxed *boxed, const gchar *string );
-static void        bool_set_from_value( NADataBoxed *boxed, const GValue *value );
-static void        bool_set_from_void( NADataBoxed *boxed, const void *value );
-
-static GParamSpec *pointer_spec( const NADataDef *idtype );
-static void        pointer_free( const NADataBoxed *boxed );
-static void        pointer_dump( const NADataBoxed *boxed );
-static gboolean    pointer_are_equal( const NADataBoxed *a, const NADataBoxed *b );
-static gboolean    pointer_is_default( const NADataBoxed *boxed );
-static gboolean    pointer_is_valid( const NADataBoxed *boxed );
-static gchar      *pointer_get_as_string( const NADataBoxed *boxed );
-static void       *pointer_get_as_void( const NADataBoxed *boxed );
-static void        pointer_get_as_value( const NADataBoxed *boxed, GValue *value );
-static void        pointer_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source );
-static void        pointer_set_from_string( NADataBoxed *boxed, const gchar *string );
-static void        pointer_set_from_value( NADataBoxed *boxed, const GValue *value );
-static void        pointer_set_from_void( NADataBoxed *boxed, const void *value );
-
-static GParamSpec *uint_spec( const NADataDef *idtype );
-static void        uint_free( const NADataBoxed *boxed );
-static void        uint_dump( const NADataBoxed *boxed );
-static gboolean    uint_are_equal( const NADataBoxed *a, const NADataBoxed *b );
-static gboolean    uint_is_default( const NADataBoxed *boxed );
-static gboolean    uint_is_valid( const NADataBoxed *boxed );
-static gchar      *uint_get_as_string( const NADataBoxed *boxed );
-static void       *uint_get_as_void( const NADataBoxed *boxed );
-static void        uint_get_as_value( const NADataBoxed *boxed, GValue *value );
-static void        uint_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source );
-static void        uint_set_from_string( NADataBoxed *boxed, const gchar *string );
-static void        uint_set_from_value( NADataBoxed *boxed, const GValue *value );
-static void        uint_set_from_void( NADataBoxed *boxed, const void *value );
-
-static DataBoxedFn st_data_boxed_fn[] = {
-		{ NA_DATA_TYPE_STRING,
-				string_spec,
-				string_free,
-				string_dump,
-				string_are_equal,
-				string_is_default,
-				string_is_valid,
-				string_get_as_string,
-				string_get_as_void,
-				string_get_as_value,
-				string_set_from_boxed,
-				string_set_from_string,
-				string_set_from_value,
-				string_set_from_void
-				},
-		{ NA_DATA_TYPE_LOCALE_STRING,
-				string_spec,
-				string_free,
-				string_dump,
-				locale_are_equal,
-				locale_is_default,
-				locale_is_valid,
-				string_get_as_string,
-				string_get_as_void,
-				string_get_as_value,
-				string_set_from_boxed,
-				string_set_from_string,
-				string_set_from_value,
-				string_set_from_void
-				},
-		{ NA_DATA_TYPE_STRING_LIST,
-				slist_spec,
-				slist_free,
-				slist_dump,
-				slist_are_equal,
-				slist_is_default,
-				slist_is_valid,
-				slist_get_as_string,
-				slist_get_as_void,
-				slist_get_as_value,
-				slist_set_from_boxed,
-				slist_set_from_string,
-				slist_set_from_value,
-				slist_set_from_void
-				},
+static GType               register_type( void );
+static void                class_init( NADataBoxedClass *klass );
+static void                instance_init( GTypeInstance *instance, gpointer klass );
+static void                instance_dispose( GObject *object );
+static void                instance_finalize( GObject *object );
+
+static const DataBoxedDef *get_data_boxed_def( guint type );
+
+static GParamSpec         *bool_spec( const NADataDef *idtype );
+static gboolean            bool_is_default( const NADataBoxed *boxed );
+static gboolean            bool_is_valid( const NADataBoxed *boxed );
+
+static GParamSpec         *pointer_spec( const NADataDef *idtype );
+static gboolean            pointer_is_default( const NADataBoxed *boxed );
+static gboolean            pointer_is_valid( const NADataBoxed *boxed );
+
+static GParamSpec         *string_spec( const NADataDef *idtype );
+static gboolean            string_is_default( const NADataBoxed *boxed );
+static gboolean            string_is_valid( const NADataBoxed *boxed );
+
+static GParamSpec         *string_list_spec( const NADataDef *idtype );
+static gboolean            string_list_is_default( const NADataBoxed *boxed );
+static gboolean            string_list_is_valid( const NADataBoxed *boxed );
+
+static gboolean            locale_is_default( const NADataBoxed *boxed );
+static gboolean            locale_is_valid( const NADataBoxed *boxed );
+
+static GParamSpec         *uint_spec( const NADataDef *idtype );
+static gboolean            uint_is_default( const NADataBoxed *boxed );
+static gboolean            uint_is_valid( const NADataBoxed *boxed );
+
+static GParamSpec         *uint_list_spec( const NADataDef *idtype );
+static gboolean            uint_list_is_default( const NADataBoxed *boxed );
+static gboolean            uint_list_is_valid( const NADataBoxed *boxed );
+
+static DataBoxedDef st_data_boxed_def[] = {
 		{ NA_DATA_TYPE_BOOLEAN,
 				bool_spec,
-				bool_free,
-				bool_dump,
-				bool_are_equal,
 				bool_is_default,
-				bool_is_valid,
-				bool_get_as_string,
-				bool_get_as_void,
-				bool_get_as_value,
-				bool_set_from_boxed,
-				bool_set_from_string,
-				bool_set_from_value,
-				bool_set_from_void
+				bool_is_valid
 				},
 		{ NA_DATA_TYPE_POINTER,
 				pointer_spec,
-				pointer_free,
-				pointer_dump,
-				pointer_are_equal,
 				pointer_is_default,
-				pointer_is_valid,
-				pointer_get_as_string,
-				pointer_get_as_void,
-				pointer_get_as_value,
-				pointer_set_from_boxed,
-				pointer_set_from_string,
-				pointer_set_from_value,
-				pointer_set_from_void
+				pointer_is_valid
+				},
+		{ NA_DATA_TYPE_STRING,
+				string_spec,
+				string_is_default,
+				string_is_valid
+				},
+		{ NA_DATA_TYPE_STRING_LIST,
+				string_list_spec,
+				string_list_is_default,
+				string_list_is_valid
+				},
+		{ NA_DATA_TYPE_LOCALE_STRING,
+				string_spec,
+				locale_is_default,
+				locale_is_valid
 				},
 		{ NA_DATA_TYPE_UINT,
 				uint_spec,
-				uint_free,
-				uint_dump,
-				uint_are_equal,
 				uint_is_default,
-				uint_is_valid,
-				uint_get_as_string,
-				uint_get_as_void,
-				uint_get_as_value,
-				uint_set_from_boxed,
-				uint_set_from_string,
-				uint_set_from_value,
-				uint_set_from_void
+				uint_is_valid
+				},
+		{ NA_DATA_TYPE_UINT_LIST,
+				uint_list_spec,
+				uint_list_is_default,
+				uint_list_is_valid
 				},
 		{ 0 }
 };
@@ -290,7 +175,7 @@ register_type( void )
 
 	g_debug( "%s", thisfn );
 
-	type = g_type_register_static( G_TYPE_OBJECT, "NADataBoxed", &info, 0 );
+	type = g_type_register_static( NA_BOXED_TYPE, "NADataBoxed", &info, 0 );
 
 	return( type );
 }
@@ -328,6 +213,8 @@ instance_init( GTypeInstance *instance, gpointer klass )
 	self->private = g_new0( NADataBoxedPrivate, 1 );
 
 	self->private->dispose_has_run = FALSE;
+	self->private->data_def = NULL;
+	self->private->boxed_def = NULL;
 }
 
 static void
@@ -361,15 +248,10 @@ instance_finalize( GObject *object )
 	g_debug( "%s: object=%p (%s), name=%s",
 			thisfn,
 			( void * ) object, G_OBJECT_TYPE_NAME( object ),
-			NA_DATA_BOXED( object )->private->def->name );
+			NA_DATA_BOXED( object )->private->data_def->name );
 
 	self = NA_DATA_BOXED( object );
 
-	DataBoxedFn *fn = get_data_boxed_fn( self->private->def->type );
-	if( fn->free ){
-		( *fn->free )( self );
-	}
-
 	g_free( self->private );
 
 	/* chain call to parent class */
@@ -378,54 +260,20 @@ instance_finalize( GObject *object )
 	}
 }
 
-static DataBoxedFn *
-get_data_boxed_fn( guint type )
+static const DataBoxedDef *
+get_data_boxed_def( guint type )
 {
-	static const gchar *thisfn = "na_data_boxed_get_data_boxed_fn";
+	static const gchar *thisfn = "na_data_boxed_get_data_boxed_def";
 	int i;
-	DataBoxedFn *fn;
-
-	fn = NULL;
-
-	for( i = 0 ; st_data_boxed_fn[i].type && !fn ; ++i ){
-		if( st_data_boxed_fn[i].type == type ){
-			fn = st_data_boxed_fn+i;
-		}
-	}
-
-	if( !fn ){
-		g_warning( "%s: unmanaged type=%d", thisfn, type );
-	}
-
-	return( fn );
-}
-
-/**
- * na_data_boxed_get_param_spec:
- * @def: a #NADataDef definition structure.
- *
- * Returns: a #GParamSpec structure.
- *
- * Since: 2.30
- */
-GParamSpec *
-na_data_boxed_get_param_spec( const NADataDef *def )
-{
-	GParamSpec *spec;
-	DataBoxedFn *fn;
-
-	g_return_val_if_fail( def != NULL, NULL );
-
-	spec = NULL;
-	fn = get_data_boxed_fn( def->type );
 
-	if( fn ){
-		if( fn->spec ){
-			spec = ( *fn->spec )( def );
+	for( i = 0 ; st_data_boxed_def[i].type ; ++i ){
+		if( st_data_boxed_def[i].type == type ){
+			return(( const DataBoxedDef * ) st_data_boxed_def+i );
 		}
 	}
 
-	return( spec );
+	g_warning( "%s: unmanaged data type=%d", thisfn, type );
+	return( NULL );
 }
 
 /**
@@ -444,8 +292,9 @@ na_data_boxed_new( const NADataDef *def )
 	g_return_val_if_fail( def != NULL, NULL );
 
 	boxed = g_object_new( NA_DATA_BOXED_TYPE, NULL );
-
-	boxed->private->def = ( NADataDef * ) def;
+	na_boxed_set_type( NA_BOXED( boxed ), def->type );
+	boxed->private->data_def = def;
+	boxed->private->boxed_def = get_data_boxed_def( def->type );
 
 	return( boxed );
 }
@@ -459,10 +308,10 @@ na_data_boxed_new( const NADataDef *def )
  *
  * Since: 2.30
  */
-NADataDef *
+const NADataDef *
 na_data_boxed_get_data_def( const NADataBoxed *boxed )
 {
-	NADataDef *def;
+	const NADataDef *def;
 
 	g_return_val_if_fail( NA_IS_DATA_BOXED( boxed ), NULL );
 
@@ -470,48 +319,83 @@ na_data_boxed_get_data_def( const NADataBoxed *boxed )
 
 	if( !boxed->private->dispose_has_run ){
 
-		def = boxed->private->def;
+		def = boxed->private->data_def;
 	}
 
 	return( def );
 }
 
 /**
- * na_data_boxed_are_equal:
- * @a: the first #NADataBoxed object.
- * @b: the second #NADataBoxed object.
+ * na_data_boxed_set_data_def:
+ * @boxed: this #NADataBoxed object.
+ * @def: the new #NADataDef to be set.
  *
- * Returns: %TRUE if the two boxeds are equal, %FALSE else.
+ * Changes the #NADataDef a @boxed points to:
+ * -> the new type must be the same that the previous one.
+ * -> value is unchanged.
  *
  * Since: 2.30
  */
-gboolean
-na_data_boxed_are_equal( const NADataBoxed *a, const NADataBoxed *b )
+void
+na_data_boxed_set_data_def( NADataBoxed *boxed, const NADataDef *new_def )
 {
-	DataBoxedFn *fn;
-	gboolean are_equal;
+	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
+	g_return_if_fail( boxed->private->data_def );
+	g_return_if_fail( new_def );
+	g_return_if_fail( new_def->type == boxed->private->data_def->type );
 
-	g_return_val_if_fail( NA_IS_DATA_BOXED( a ), FALSE );
-	g_return_val_if_fail( NA_IS_DATA_BOXED( b ), FALSE );
+	if( !boxed->private->dispose_has_run ){
 
-	are_equal = FALSE;
+		boxed->private->data_def = ( NADataDef * ) new_def;
+	}
+}
 
-	if( !a->private->dispose_has_run &&
-		!b->private->dispose_has_run ){
+/**
+ * na_data_boxed_get_param_spec:
+ * @def: a #NADataDef definition structure.
+ *
+ * Returns: a #GParamSpec structure.
+ *
+ * Since: 2.30
+ */
+GParamSpec *
+na_data_boxed_get_param_spec( const NADataDef *def )
+{
+	GParamSpec *spec;
+	const DataBoxedDef *fn;
 
-		if( a->private->def->type == b->private->def->type ){
+	g_return_val_if_fail( def != NULL, NULL );
 
-			fn = get_data_boxed_fn( a->private->def->type );
+	spec = NULL;
+	fn = get_data_boxed_def( def->type );
 
-			if( fn ){
-				if( fn->are_equal ){
-					are_equal = ( *fn->are_equal )( a, b );
-				}
-			}
+	if( fn ){
+		if( fn->spec ){
+			spec = ( *fn->spec )( def );
 		}
 	}
 
-	return( are_equal );
+	return( spec );
+}
+
+/**
+ * na_data_boxed_are_equal:
+ * @a: the first #NADataBoxed object.
+ * @b: the second #NADataBoxed object.
+ *
+ * Returns: %TRUE if the two boxeds are equal, %FALSE else.
+ *
+ * Since: 2.30
+ *
+ * Deprecated: 3.1.0
+ */
+gboolean
+na_data_boxed_are_equal( const NADataBoxed *a, const NADataBoxed *b )
+{
+	g_return_val_if_fail( NA_IS_DATA_BOXED( a ), FALSE );
+	g_return_val_if_fail( NA_IS_DATA_BOXED( b ), FALSE );
+
+	return( na_boxed_are_equal( NA_BOXED( a ), NA_BOXED( b )));
 }
 
 /**
@@ -527,21 +411,16 @@ gboolean
 na_data_boxed_is_default( const NADataBoxed *boxed )
 {
 	gboolean is_default;
-	DataBoxedFn *fn;
 
 	g_return_val_if_fail( NA_IS_DATA_BOXED( boxed ), FALSE );
+	g_return_val_if_fail( boxed->private->boxed_def, FALSE );
+	g_return_val_if_fail( boxed->private->boxed_def->is_default, FALSE );
 
 	is_default = FALSE;
 
 	if( !boxed->private->dispose_has_run ){
 
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->is_default ){
-				is_default = ( *fn->is_default )( boxed );
-			}
-		}
+		is_default = ( *boxed->private->boxed_def->is_default )( boxed );
 	}
 
 	return( is_default );
@@ -558,27 +437,21 @@ na_data_boxed_is_default( const NADataBoxed *boxed )
 gboolean
 na_data_boxed_is_valid( const NADataBoxed *boxed )
 {
-	DataBoxedFn *fn;
 	gboolean is_valid;
 
 	g_return_val_if_fail( NA_IS_DATA_BOXED( boxed ), FALSE );
+	g_return_val_if_fail( boxed->private->boxed_def, FALSE );
+	g_return_val_if_fail( boxed->private->boxed_def->is_valid, FALSE );
 
 	is_valid = FALSE;
 
 	if( !boxed->private->dispose_has_run ){
 
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->is_valid ){
-				is_valid = ( *fn->is_valid )( boxed );
-			}
-		}
+		is_valid = ( *boxed->private->boxed_def->is_valid )( boxed );
 	}
 
 	return( is_valid );
 }
-
 /**
  * na_data_boxed_dump:
  * @boxed: this #NADataBoxed object.
@@ -586,43 +459,13 @@ na_data_boxed_is_valid( const NADataBoxed *boxed )
  * Dump the content of @boxed.
  *
  * Since: 2.30
- */
-void
-na_data_boxed_dump( const NADataBoxed *boxed )
-{
-	DataBoxedFn *fn;
-
-	fn = get_data_boxed_fn( boxed->private->def->type );
-
-	if( fn ){
-		if( fn->dump ){
-			( *fn->dump )( boxed );
-		}
-	}
-}
-
-/**
- * na_data_boxed_set_data_def:
- * @boxed: this #NADataBoxed object.
- * @def: the new #NADataDef to be set.
  *
- * Changes the #NADataDef a @boxed points to:
- * -> the new type must be the same that the previous one.
- * -> value is unchanged.
- *
- * Since: 2.30
+ * Deprecated: 3.1.0
  */
 void
-na_data_boxed_set_data_def( NADataBoxed *boxed, const NADataDef *new_def )
+na_data_boxed_dump( const NADataBoxed *boxed )
 {
-	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
-	g_return_if_fail( new_def != NULL );
-	g_return_if_fail( new_def->type == boxed->private->def->type );
-
-	if( !boxed->private->dispose_has_run ){
-
-		boxed->private->def = ( NADataDef * ) new_def;
-	}
+	na_boxed_dump( NA_BOXED( boxed ));
 }
 
 /**
@@ -633,93 +476,50 @@ na_data_boxed_set_data_def( NADataBoxed *boxed, const NADataDef *new_def )
  * should be g_free() by the caller.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
 gchar *
 na_data_boxed_get_as_string( const NADataBoxed *boxed )
 {
-	DataBoxedFn *fn;
-	gchar *value;
-
-	g_return_val_if_fail( NA_IS_DATA_BOXED( boxed ), NULL );
-
-	value = NULL;
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->get_as_string ){
-				value = ( *fn->get_as_string )( boxed );
-			}
-		}
-	}
-
-	return( value );
+	return( na_boxed_get_string( NA_BOXED( boxed )));
 }
 
 /**
- * na_data_boxed_get_as_void:
+ * na_data_boxed_get_as_value:
  * @boxed: the #NADataBoxed whose value is to be set.
+ * @value: the string to be set.
  *
- * Returns: the content of the @boxed.
- *
- * If of type NA_DATA_TYPE_STRING, NA_DATA_TYPE_LOCALE_STRING OR
- * NA_DATA_TYPE_STRING_LIST, then the content is returned in a newly
- * allocated value, which should be released by the caller.
+ * Setup @value with the content of the @boxed.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
-void *
-na_data_boxed_get_as_void( const NADataBoxed *boxed )
+void
+na_data_boxed_get_as_value( const NADataBoxed *boxed, GValue *value )
 {
-	DataBoxedFn *fn;
-	void *value;
-
-	g_return_val_if_fail( NA_IS_DATA_BOXED( boxed ), NULL );
-
-	value = NULL;
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->get_as_void ){
-				value = ( *fn->get_as_void )( boxed );
-			}
-		}
-	}
-
-	return( value );
+	na_boxed_get_as_value( NA_BOXED( boxed ), value );
 }
 
 /**
- * na_data_boxed_get_as_value:
+ * na_data_boxed_get_as_void:
  * @boxed: the #NADataBoxed whose value is to be set.
- * @value: the string to be set.
  *
- * Setup @value with the content of the @boxed.
+ * Returns: the content of the @boxed.
+ *
+ * If of type NAFD_TYPE_STRING, NAFD_TYPE_LOCALE_STRING OR
+ * NAFD_TYPE_STRING_LIST, then the content is returned in a newly
+ * allocated value, which should be released by the caller.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
-void
-na_data_boxed_get_as_value( const NADataBoxed *boxed, GValue *value )
+void *
+na_data_boxed_get_as_void( const NADataBoxed *boxed )
 {
-	DataBoxedFn *fn;
-
-	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->get_as_value ){
-				( *fn->get_as_value )( boxed, value );
-			}
-		}
-	}
+	return( na_boxed_get_as_void( NA_BOXED( boxed )));
 }
 
 /**
@@ -730,29 +530,13 @@ na_data_boxed_get_as_value( const NADataBoxed *boxed, GValue *value )
  * Copy value from @value to @boxed.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
 void
 na_data_boxed_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *value )
 {
-	DataBoxedFn *fn;
-
-	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
-	g_return_if_fail( NA_IS_DATA_BOXED( value ));
-	g_return_if_fail( boxed->private->def->type == value->private->def->type );
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->free ){
-				( *fn->free )( boxed );
-			}
-			if( fn->set_from_boxed ){
-				( *fn->set_from_boxed )( boxed, value );
-			}
-		}
-	}
+	na_boxed_set_from_boxed( NA_BOXED( boxed ), NA_BOXED( value ));
 }
 
 /**
@@ -763,27 +547,13 @@ na_data_boxed_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *value )
  * Evaluates the @value and set it to the @boxed.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
 void
 na_data_boxed_set_from_string( NADataBoxed *boxed, const gchar *value )
 {
-	DataBoxedFn *fn;
-
-	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->free ){
-				( *fn->free )( boxed );
-			}
-			if( fn->set_from_string ){
-				( *fn->set_from_string )( boxed, value );
-			}
-		}
-	}
+	na_boxed_set_from_string( NA_BOXED( boxed ), value );
 }
 
 /**
@@ -794,27 +564,13 @@ na_data_boxed_set_from_string( NADataBoxed *boxed, const gchar *value )
  * Evaluates the @value and set it to the @boxed.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
 void
 na_data_boxed_set_from_value( NADataBoxed *boxed, const GValue *value )
 {
-	DataBoxedFn *fn;
-
-	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->free ){
-				( *fn->free )( boxed );
-			}
-			if( fn->set_from_value ){
-				( *fn->set_from_value )( boxed, value );
-			}
-		}
-	}
+	na_boxed_set_from_value( NA_BOXED( boxed ), value );
 }
 
 /**
@@ -825,192 +581,112 @@ na_data_boxed_set_from_value( NADataBoxed *boxed, const GValue *value )
  * Evaluates the @value and set it to the @boxed.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.1.0
  */
 void
 na_data_boxed_set_from_void( NADataBoxed *boxed, const void *value )
 {
-	DataBoxedFn *fn;
-
-	g_return_if_fail( NA_IS_DATA_BOXED( boxed ));
-
-	if( !boxed->private->dispose_has_run ){
-
-		fn = get_data_boxed_fn( boxed->private->def->type );
-
-		if( fn ){
-			if( fn->free ){
-				( *fn->free )( boxed );
-			}
-			if( fn->set_from_void ){
-				( *fn->set_from_void )( boxed, value );
-			}
-		}
-	}
+	na_boxed_set_from_void( NA_BOXED( boxed ), value );
 }
 
 static GParamSpec *
-string_spec( const NADataDef *def )
+bool_spec( const NADataDef *def )
 {
-	return( g_param_spec_string(
+	return( g_param_spec_boolean(
 			def->name,
 			gettext( def->short_label ),
 			gettext( def->long_label ),
-			def->default_value,
+			na_core_utils_boolean_from_string( def->default_value ),
 			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 }
 
-static void
-string_free( const NADataBoxed *boxed )
-{
-	g_free( boxed->private->u.string );
-	boxed->private->u.string = NULL;
-}
-
-static void
-string_dump( const NADataBoxed *boxed )
-{
-	g_debug( "na-data-boxed: %s=%s", boxed->private->def->name, boxed->private->u.string );
-}
-
 static gboolean
-string_are_equal( const NADataBoxed *a, const NADataBoxed *b )
-{
-	if( !a->private->u.string && !b->private->u.string ){
-		return( TRUE );
-	}
-	if( !a->private->u.string || !b->private->u.string ){
-		return( FALSE );
-	}
-	if( strcmp( a->private->u.string, b->private->u.string ) == 0 ){
-		return( TRUE );
-	}
-	return( FALSE );
-}
-
-static gboolean
-string_is_default( const NADataBoxed *boxed )
+bool_is_default( const NADataBoxed *boxed )
 {
 	gboolean is_default = FALSE;
+	gboolean default_value;
 
-	if( boxed->private->def->default_value ){
-		if( boxed->private->u.string ){
-			/* default value is not null and string has something */
-			is_default = ( strcmp( boxed->private->u.string, boxed->private->def->default_value ) == 0 );
-
-		} else {
-			/* default value is not null, but string is null */
-			is_default = FALSE;
-		}
-	} else if( boxed->private->u.string ){
-		/* default value is null, but string has something */
-		is_default = FALSE;
-
-	} else {
-		/* default value and string are both null */
-		is_default = TRUE;
+	if( boxed->private->data_def->default_value && strlen( boxed->private->data_def->default_value )){
+		default_value = na_core_utils_boolean_from_string( boxed->private->data_def->default_value );
+		is_default = ( default_value == na_boxed_get_boolean( NA_BOXED( boxed )));
 	}
 
 	return( is_default );
 }
 
 static gboolean
-string_is_valid( const NADataBoxed *boxed )
-{
-	gboolean is_valid = TRUE;
-
-	if( boxed->private->def->mandatory ){
-		if( !boxed->private->u.string || !strlen( boxed->private->u.string )){
-			g_debug( "na_data_boxed_string_is_valid: invalid %s: mandatory but empty or null", boxed->private->def->name );
-			is_valid = FALSE;
-		}
-	}
-
-	return( is_valid );
-}
-
-static gchar *
-string_get_as_string( const NADataBoxed *boxed )
-{
-	return( boxed->private->u.string ? g_strdup( boxed->private->u.string ) : g_strdup( "" ));
-}
-
-static void *
-string_get_as_void( const NADataBoxed *boxed )
+bool_is_valid( const NADataBoxed *boxed )
 {
-	void *value;
-
-	value = ( void * ) string_get_as_string( boxed );
-
-	return( value );
+	return( TRUE );
 }
 
-static void
-string_get_as_value( const NADataBoxed *boxed, GValue *value )
+static GParamSpec *
+pointer_spec( const NADataDef *def )
 {
-	gchar *str;
-
-	str = string_get_as_string( boxed );
-	g_value_set_string( value, str );
-	g_free( str );
+	return( g_param_spec_pointer(
+			def->name,
+			gettext( def->short_label ),
+			gettext( def->long_label ),
+			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 }
 
-static void
-string_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source )
+/*
+ * say that a pointer never has its default value
+ * (essentially because there cannot be / one cannot set any relevant
+ *  default value for a pointer)
+ */
+static gboolean
+pointer_is_default( const NADataBoxed *boxed )
 {
-	boxed->private->u.string = g_strdup( source->private->u.string );
+	return( FALSE );
 }
 
-static void
-string_set_from_string( NADataBoxed *boxed, const gchar *string )
+static gboolean
+pointer_is_valid( const NADataBoxed *boxed )
 {
-	if( string ){
-		boxed->private->u.string = g_strdup( string );
-	}
-}
+	gboolean is_valid = TRUE;
+	gconstpointer pointer;
 
-static void
-string_set_from_value( NADataBoxed *boxed, const GValue *value )
-{
-	if( g_value_get_string( value )){
-		boxed->private->u.string = g_value_dup_string( value );
+	if( boxed->private->data_def->mandatory ){
+		pointer = na_boxed_get_pointer( NA_BOXED( boxed ));
+		if( !pointer ){
+			g_debug( "na_data_boxed_pointer_is_valid: invalid %s: mandatory but null", boxed->private->data_def->name );
+			is_valid = FALSE;
+		}
 	}
-}
 
-static void
-string_set_from_void( NADataBoxed *boxed, const void *value )
-{
-	if( value ){
-		boxed->private->u.string = g_strdup(( const gchar * ) value );
-	}
+	return( is_valid );
 }
 
-static gboolean
-locale_are_equal( const NADataBoxed *a, const NADataBoxed *b )
+static GParamSpec *
+string_spec( const NADataDef *def )
 {
-	if( !a->private->u.string && !b->private->u.string ){
-		return( TRUE );
-	}
-	if( !a->private->u.string || !b->private->u.string ){
-		return( FALSE );
-	}
-	return( na_core_utils_str_collate( a->private->u.string, b->private->u.string ) == 0 );
+	return( g_param_spec_string(
+			def->name,
+			gettext( def->short_label ),
+			gettext( def->long_label ),
+			def->default_value,
+			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 }
 
 static gboolean
-locale_is_default( const NADataBoxed *boxed )
+string_is_default( const NADataBoxed *boxed )
 {
 	gboolean is_default = FALSE;
+	gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
 
-	if( boxed->private->def->default_value ){
-		if( boxed->private->u.string ){
+	if( boxed->private->data_def->default_value ){
+		if( value && strlen( value )){
 			/* default value is not null and string has something */
-			is_default = ( na_core_utils_str_collate( boxed->private->u.string, boxed->private->def->default_value ) == 0 );
+			is_default = ( strcmp( value, boxed->private->data_def->default_value ) == 0 );
 
 		} else {
 			/* default value is not null, but string is null */
 			is_default = FALSE;
 		}
-	} else if( boxed->private->u.string ){
+
+	} else if( value ){
 		/* default value is null, but string has something */
 		is_default = FALSE;
 
@@ -1018,27 +694,30 @@ locale_is_default( const NADataBoxed *boxed )
 		/* default value and string are both null */
 		is_default = TRUE;
 	}
+	g_free( value );
 
 	return( is_default );
 }
 
 static gboolean
-locale_is_valid( const NADataBoxed *boxed )
+string_is_valid( const NADataBoxed *boxed )
 {
 	gboolean is_valid = TRUE;
 
-	if( boxed->private->def->mandatory ){
-		if( !boxed->private->u.string || !g_utf8_strlen( boxed->private->u.string, -1 )){
-			g_debug( "na_data_boxed_string_is_valid: invalid %s: mandatory but empty or null", boxed->private->def->name );
+	if( boxed->private->data_def->mandatory ){
+		gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
+		if( !value || !strlen( value )){
+			g_debug( "na_data_boxed_string_is_valid: invalid %s: mandatory but empty or null", boxed->private->data_def->name );
 			is_valid = FALSE;
 		}
+		g_free( value );
 	}
 
 	return( is_valid );
 }
 
 static GParamSpec *
-slist_spec( const NADataDef *def )
+string_list_spec( const NADataDef *def )
 {
 	return( g_param_spec_pointer(
 			def->name,
@@ -1047,67 +726,38 @@ slist_spec( const NADataDef *def )
 			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 }
 
-static void
-slist_free( const NADataBoxed *boxed )
-{
-	na_core_utils_slist_free( boxed->private->u.slist );
-	boxed->private->u.slist = NULL;
-}
-
-static void
-slist_dump( const NADataBoxed *boxed )
-{
-	static const gchar *thisfn = "na_data_boxed_slist_dump";
-
-	g_debug( "%s: %s is", thisfn, boxed->private->def->name );
-	na_core_utils_slist_dump( thisfn, boxed->private->u.slist );
-}
-
 static gboolean
-slist_are_equal( const NADataBoxed *a, const NADataBoxed *b )
-{
-	if( !a->private->u.slist && !b->private->u.slist ){
-		return( TRUE );
-	}
-	if( !a->private->u.slist || !b->private->u.slist ){
-		return( FALSE );
-	}
-	return( na_core_utils_slist_are_equal( a->private->u.slist, b->private->u.slist ));
-}
-
-static gboolean
-slist_is_default( const NADataBoxed *boxed )
+string_list_is_default( const NADataBoxed *boxed )
 {
 	gboolean is_default = FALSE;
-	GSList *default_value;
-
-	if( boxed->private->def->default_value ){
-		if( boxed->private->u.slist ){
-			default_value = na_gconf_utils_slist_from_string( boxed->private->def->default_value );
-			is_default = na_core_utils_slist_are_equal( default_value, boxed->private->u.slist );
-			na_core_utils_slist_free( default_value );
+	gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
 
+	if( boxed->private->data_def->default_value ){
+		if( value && strlen( value )){
+			is_default = ( strcmp( value, boxed->private->data_def->default_value ) == 0 );
 		} else {
 			is_default = FALSE;
 		}
-	} else if( boxed->private->u.slist ){
+	} else if( value && strlen( value )){
 		is_default = FALSE;
 
 	} else {
 		is_default = TRUE;
 	}
+	g_free( value );
 
 	return( is_default );
 }
 
 static gboolean
-slist_is_valid( const NADataBoxed *boxed )
+string_list_is_valid( const NADataBoxed *boxed )
 {
 	gboolean is_valid = TRUE;
 
-	if( boxed->private->def->mandatory ){
-		if( !boxed->private->u.slist || !g_slist_length( boxed->private->u.slist )){
-			g_debug( "na_data_boxed_string_is_valid: invalid %s: mandatory but empty or null", boxed->private->def->name );
+	if( boxed->private->data_def->mandatory ){
+		gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
+		if( !value || !strlen( value )){
+			g_debug( "na_data_boxed_string_list_is_valid: invalid %s: mandatory but empty or null", boxed->private->data_def->name );
 			is_valid = FALSE;
 		}
 	}
@@ -1115,260 +765,51 @@ slist_is_valid( const NADataBoxed *boxed )
 	return( is_valid );
 }
 
-static gchar *
-slist_get_as_string( const NADataBoxed *boxed )
-{
-	return( na_gconf_utils_slist_to_string( boxed->private->u.slist ));
-}
-
-static void *
-slist_get_as_void( const NADataBoxed *boxed )
-{
-	void *value = NULL;
-
-	if( boxed->private->u.slist ){
-		value = na_core_utils_slist_duplicate( boxed->private->u.slist );
-	}
-
-	return( value );
-}
-
-static void
-slist_get_as_value( const NADataBoxed *boxed, GValue *value )
-{
-	g_value_set_pointer( value, na_core_utils_slist_duplicate( boxed->private->u.slist ));
-}
-
-static void
-slist_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source )
-{
-	boxed->private->u.slist = na_core_utils_slist_duplicate( source->private->u.slist );
-}
-
-static void
-slist_set_from_string( NADataBoxed *boxed, const gchar *string )
+static gboolean
+locale_is_default( const NADataBoxed *boxed )
 {
-	GSList *slist;
-
-	if( string ){
-
-		/* if it is a string list which comes from GConf
-		 */
-		slist = na_gconf_utils_slist_from_string( string );
+	gboolean is_default = FALSE;
+	gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
 
-		if( slist ){
-			boxed->private->u.slist = slist;
+	if( boxed->private->data_def->default_value ){
+		if( value && strlen( value )){
+			/* default value is not null and string has something */
+			is_default = ( na_core_utils_str_collate( value, boxed->private->data_def->default_value ) == 0 );
 
 		} else {
-			boxed->private->u.slist = g_slist_append( NULL, g_strdup( string ));
+			/* default value is not null, but string is null */
+			is_default = FALSE;
 		}
-	}
-}
-
-static void
-slist_set_from_value( NADataBoxed *boxed, const GValue *value )
-{
-	if( g_value_get_pointer( value )){
-		boxed->private->u.slist = na_core_utils_slist_duplicate( g_value_get_pointer( value ));
-	}
-}
-
-static void
-slist_set_from_void( NADataBoxed *boxed, const void *value )
-{
-	if( value ){
-		boxed->private->u.slist = na_core_utils_slist_duplicate(( GSList * ) value );
-	}
-}
-
-static GParamSpec *
-bool_spec( const NADataDef *def )
-{
-	return( g_param_spec_boolean(
-			def->name,
-			gettext( def->short_label ),
-			gettext( def->long_label ),
-			na_core_utils_boolean_from_string( def->default_value ),
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
-}
-
-static void
-bool_free( const NADataBoxed *boxed )
-{
-	/* n/a */
-}
-
-static void
-bool_dump( const NADataBoxed *boxed )
-{
-	g_debug( "na-data-boxed: %s=%s",
-			boxed->private->def->name, boxed->private->u.boolean ? "True":"False" );
-}
-
-static gboolean
-bool_are_equal( const NADataBoxed *a, const NADataBoxed *b )
-{
-	return( a->private->u.boolean == b->private->u.boolean );
-}
-
-static gboolean
-bool_is_default( const NADataBoxed *boxed )
-{
-	gboolean is_default = FALSE;
-	gboolean default_value;
+	} else if( value ){
+		/* default value is null, but string has something */
+		is_default = FALSE;
 
-	if( boxed->private->def->default_value && strlen( boxed->private->def->default_value )){
-		default_value = na_core_utils_boolean_from_string( boxed->private->def->default_value );
-		is_default = ( default_value == boxed->private->u.boolean );
+	} else {
+		/* default value and string are both null */
+		is_default = TRUE;
 	}
+	g_free( value );
 
 	return( is_default );
 }
 
 static gboolean
-bool_is_valid( const NADataBoxed *boxed )
-{
-	return( TRUE );
-}
-
-static gchar *
-bool_get_as_string( const NADataBoxed *boxed )
-{
-	return( g_strdup_printf( "%s", boxed->private->u.boolean ? "True":"False" ));
-}
-
-static void *
-bool_get_as_void( const NADataBoxed *boxed )
-{
-	return( GUINT_TO_POINTER( boxed->private->u.boolean ));
-}
-
-static void
-bool_get_as_value( const NADataBoxed *boxed, GValue *value )
-{
-	g_value_set_boolean( value, boxed->private->u.boolean );
-}
-
-static void
-bool_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source )
-{
-	boxed->private->u.boolean = source->private->u.boolean;
-}
-
-static void
-bool_set_from_string( NADataBoxed *boxed, const gchar *string )
-{
-	boxed->private->u.boolean = na_core_utils_boolean_from_string( string );
-}
-
-static void
-bool_set_from_value( NADataBoxed *boxed, const GValue *value )
-{
-	boxed->private->u.boolean = g_value_get_boolean( value );
-}
-
-static void
-bool_set_from_void( NADataBoxed *boxed, const void *value )
-{
-	boxed->private->u.boolean = GPOINTER_TO_UINT( value );
-}
-
-static GParamSpec *
-pointer_spec( const NADataDef *def )
-{
-	return( g_param_spec_pointer(
-			def->name,
-			gettext( def->short_label ),
-			gettext( def->long_label ),
-			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
-}
-
-static void
-pointer_free( const NADataBoxed *boxed )
-{
-	boxed->private->u.pointer = NULL;
-}
-
-static void
-pointer_dump( const NADataBoxed *boxed )
-{
-	g_debug( "na-data-boxed: %s=%p",
-			boxed->private->def->name, ( void * ) boxed->private->u.pointer );
-}
-
-static gboolean
-pointer_are_equal( const NADataBoxed *a, const NADataBoxed *b )
-{
-	return( a->private->u.pointer == b->private->u.pointer );
-}
-
-/*
- * say that a pointer never has its default value
- * (essentially because there cannot be any relevant default value for a pointer)
- */
-static gboolean
-pointer_is_default( const NADataBoxed *boxed )
-{
-	return( FALSE );
-}
-
-static gboolean
-pointer_is_valid( const NADataBoxed *boxed )
+locale_is_valid( const NADataBoxed *boxed )
 {
 	gboolean is_valid = TRUE;
 
-	if( boxed->private->def->mandatory ){
-		if( !boxed->private->u.pointer ){
-			g_debug( "na_data_boxed_string_is_valid: invalid %s: mandatory but null", boxed->private->def->name );
+	if( boxed->private->data_def->mandatory ){
+		gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
+		if( !value || !g_utf8_strlen( value, -1 )){
+			g_debug( "na_data_boxed_locale_is_valid: invalid %s: mandatory but empty or null", boxed->private->data_def->name );
 			is_valid = FALSE;
 		}
+		g_free( value );
 	}
 
 	return( is_valid );
 }
 
-static gchar *
-pointer_get_as_string( const NADataBoxed *boxed )
-{
-	return( g_strdup_printf( "%p", boxed->private->u.pointer ));
-}
-
-static void *
-pointer_get_as_void( const NADataBoxed *boxed )
-{
-	return( boxed->private->u.pointer );
-}
-
-static void
-pointer_get_as_value( const NADataBoxed *boxed, GValue *value )
-{
-	g_value_set_pointer( value, boxed->private->u.pointer );
-}
-
-static void
-pointer_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source )
-{
-	boxed->private->u.pointer = source->private->u.pointer;
-}
-
-static void
-pointer_set_from_string( NADataBoxed *boxed, const gchar *pointer )
-{
-	g_warning( "na_data_boxed_pointer_set_from_string: unrelevant function call" );
-}
-
-static void
-pointer_set_from_value( NADataBoxed *boxed, const GValue *value )
-{
-	boxed->private->u.pointer = g_value_get_pointer( value );
-}
-
-static void
-pointer_set_from_void( NADataBoxed *boxed, const void *value )
-{
-	boxed->private->u.pointer = ( void * ) value;
-}
-
 static GParamSpec *
 uint_spec( const NADataDef *def )
 {
@@ -1382,34 +823,15 @@ uint_spec( const NADataDef *def )
 			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 }
 
-static void
-uint_free( const NADataBoxed *boxed )
-{
-	boxed->private->u.uint = 0;
-}
-
-static void
-uint_dump( const NADataBoxed *boxed )
-{
-	g_debug( "na-data-boxed: %s=%d",
-			boxed->private->def->name, boxed->private->u.uint );
-}
-
-static gboolean
-uint_are_equal( const NADataBoxed *a, const NADataBoxed *b )
-{
-	return( a->private->u.uint == b->private->u.uint );
-}
-
 static gboolean
 uint_is_default( const NADataBoxed *boxed )
 {
 	gboolean is_default = FALSE;
 	guint default_value;
 
-	if( boxed->private->def->default_value ){
-		default_value = atoi( boxed->private->def->default_value );
-		is_default = ( boxed->private->u.uint == default_value );
+	if( boxed->private->data_def->default_value ){
+		default_value = atoi( boxed->private->data_def->default_value );
+		is_default = ( na_boxed_get_uint( NA_BOXED( boxed )) == default_value );
 	}
 
 	return( is_default );
@@ -1421,44 +843,38 @@ uint_is_valid( const NADataBoxed *boxed )
 	return( TRUE );
 }
 
-static gchar *
-uint_get_as_string( const NADataBoxed *boxed )
-{
-	return( g_strdup_printf( "%u", boxed->private->u.uint ));
-}
-
-static void *
-uint_get_as_void( const NADataBoxed *boxed )
-{
-	return( GUINT_TO_POINTER( boxed->private->u.uint ));
-}
-
-static void
-uint_get_as_value( const NADataBoxed *boxed, GValue *value )
+static GParamSpec *
+uint_list_spec( const NADataDef *def )
 {
-	g_value_set_uint( value, boxed->private->u.uint );
+	return( g_param_spec_pointer(
+			def->name,
+			gettext( def->short_label ),
+			gettext( def->long_label ),
+			G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE ));
 }
 
-static void
-uint_set_from_boxed( NADataBoxed *boxed, const NADataBoxed *source )
+/*
+ * we assume no default for uint list
+ */
+static gboolean
+uint_list_is_default( const NADataBoxed *boxed )
 {
-	boxed->private->u.uint = source->private->u.uint;
+	return( FALSE );
 }
 
-static void
-uint_set_from_string( NADataBoxed *boxed, const gchar *string )
+static gboolean
+uint_list_is_valid( const NADataBoxed *boxed )
 {
-	boxed->private->u.uint = string ? atoi( string ) : 0;
-}
+	gboolean is_valid = TRUE;
 
-static void
-uint_set_from_value( NADataBoxed *boxed, const GValue *value )
-{
-	boxed->private->u.uint = g_value_get_uint( value );
-}
+	if( boxed->private->data_def->mandatory ){
+		gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
+		if( !value || !strlen( value )){
+			g_debug( "na_data_boxed_uint_list_is_valid: invalid %s: mandatory but empty or null", boxed->private->data_def->name );
+			is_valid = FALSE;
+		}
+		g_free( value );
+	}
 
-static void
-uint_set_from_void( NADataBoxed *boxed, const void *value )
-{
-	boxed->private->u.uint = GPOINTER_TO_UINT( value );
+	return( is_valid );
 }
diff --git a/src/core/na-data-types.c b/src/core/na-data-types.c
index 6fdaa0e..d451dba 100644
--- a/src/core/na-data-types.c
+++ b/src/core/na-data-types.c
@@ -43,11 +43,11 @@ typedef struct {
 	FactoryType;
 
 static FactoryType st_factory_type[] = {
+		{ NA_DATA_TYPE_BOOLEAN,       "bool",   NULL },
 		{ NA_DATA_TYPE_POINTER,        NULL,    NULL },
 		{ NA_DATA_TYPE_STRING,        "string", NULL },
 		{ NA_DATA_TYPE_STRING_LIST,   "list",   "string" },
 		{ NA_DATA_TYPE_LOCALE_STRING, "string", NULL },
-		{ NA_DATA_TYPE_BOOLEAN,       "bool",   NULL },
 		{ NA_DATA_TYPE_UINT,          "int",    NULL },
 		{ NA_DATA_TYPE_UINT_LIST,     "list",   "int" },
 		{ 0 }
diff --git a/src/core/na-factory-object.c b/src/core/na-factory-object.c
index 8100e12..70f186a 100644
--- a/src/core/na-factory-object.c
+++ b/src/core/na-factory-object.c
@@ -365,7 +365,7 @@ na_factory_object_move_boxed( NAIFactoryObject *target, const NAIFactoryObject *
 
 			attach_boxed_to_object( target, boxed );
 
-			NADataDef *src_def = na_data_boxed_get_data_def( boxed );
+			const NADataDef *src_def = na_data_boxed_get_data_def( boxed );
 			NADataDef *tgt_def = na_factory_object_get_data_def( target, src_def->name );
 			na_data_boxed_set_data_def( boxed, tgt_def );
 		}
@@ -398,7 +398,7 @@ na_factory_object_copy( NAIFactoryObject *target, const NAIFactoryObject *source
 	for( isrc = src_list ; isrc ; isrc = isrc->next ){
 
 		NADataBoxed *src_boxed = NA_DATA_BOXED( isrc->data );
-		NADataDef *def = na_data_boxed_get_data_def( src_boxed );
+		const NADataDef *def = na_data_boxed_get_data_def( src_boxed );
 
 		if( def->copyable ){
 			NADataBoxed *tgt_boxed = na_ifactory_object_get_data_boxed( target, def->name );
@@ -436,18 +436,14 @@ na_factory_object_are_equal( const NAIFactoryObject *a, const NAIFactoryObject *
 	for( ia = a_list ; ia && are_equal ; ia = ia->next ){
 
 		NADataBoxed *a_boxed = NA_DATA_BOXED( ia->data );
-		NADataDef *a_def = na_data_boxed_get_data_def( a_boxed );
+		const NADataDef *a_def = na_data_boxed_get_data_def( a_boxed );
 		if( a_def->comparable ){
 
 			NADataBoxed *b_boxed = na_ifactory_object_get_data_boxed( b, a_def->name );
 			if( b_boxed ){
-				are_equal = na_data_boxed_are_equal( a_boxed, b_boxed );
+				are_equal = na_boxed_are_equal( NA_BOXED( a_boxed ), NA_BOXED( b_boxed ));
 				if( !are_equal ){
 					g_debug( "%s: %s not equal as %s different", thisfn, G_OBJECT_TYPE_NAME( a ), a_def->name );
-					g_debug( "%s: a=", thisfn );
-					na_data_boxed_dump( a_boxed );
-					g_debug( "%s: b=", thisfn );
-					na_data_boxed_dump( b_boxed );
 				}
 
 			} else {
@@ -460,12 +456,12 @@ na_factory_object_are_equal( const NAIFactoryObject *a, const NAIFactoryObject *
 	for( ib = b_list ; ib && are_equal ; ib = ib->next ){
 
 		NADataBoxed *b_boxed = NA_DATA_BOXED( ib->data );
-		NADataDef *b_def = na_data_boxed_get_data_def( b_boxed );
+		const NADataDef *b_def = na_data_boxed_get_data_def( b_boxed );
 		if( b_def->comparable ){
 
 			NADataBoxed *a_boxed = na_ifactory_object_get_data_boxed( a, b_def->name );
 			if( a_boxed ){
-				are_equal = na_data_boxed_are_equal( a_boxed, b_boxed );
+				are_equal = na_boxed_are_equal( NA_BOXED( a_boxed ), NA_BOXED( b_boxed ));
 				if( !are_equal ){
 					g_debug( "%s: %s not equal as %s different", thisfn, G_OBJECT_TYPE_NAME( a ), b_def->name );
 				}
@@ -566,7 +562,7 @@ na_factory_object_dump( const NAIFactoryObject *object )
 
 	for( it = list ; it ; it = it->next ){
 		NADataBoxed *boxed = NA_DATA_BOXED( it->data );
-		NADataDef *def = na_data_boxed_get_data_def( boxed );
+		const NADataDef *def = na_data_boxed_get_data_def( boxed );
 		length = MAX( length, strlen( def->name ));
 	}
 
@@ -575,7 +571,7 @@ na_factory_object_dump( const NAIFactoryObject *object )
 
 	for( it = list ; it ; it = it->next ){
 		NADataBoxed *boxed = NA_DATA_BOXED( it->data );
-		NADataDef *def = na_data_boxed_get_data_def( boxed );
+		const NADataDef *def = na_data_boxed_get_data_def( boxed );
 		gchar *value = na_data_boxed_get_as_string( boxed );
 		g_debug( "| %s: %*s=%s", thisfn, length, def->name+l_prefix, value );
 		g_free( value );
@@ -723,7 +719,7 @@ na_factory_object_write_item( NAIFactoryObject *object, const NAIFactoryProvider
 static gboolean
 write_data_iter( const NAIFactoryObject *object, NADataBoxed *boxed, NafoWriteIter *iter )
 {
-	NADataDef *def = na_data_boxed_get_data_def( boxed );
+	const NADataDef *def = na_data_boxed_get_data_def( boxed );
 
 	if( def->writable ){
 		iter->code = na_factory_provider_write_data( iter->writer, iter->writer_data, object, boxed, iter->messages );
diff --git a/src/core/na-ifactory-object.c b/src/core/na-ifactory-object.c
index 94dab89..791091f 100644
--- a/src/core/na-ifactory-object.c
+++ b/src/core/na-ifactory-object.c
@@ -168,7 +168,7 @@ na_ifactory_object_get_data_boxed( const NAIFactoryObject *object, const gchar *
 
 		for( ip = list ; ip ; ip = ip->next ){
 			NADataBoxed *boxed = NA_DATA_BOXED( ip->data );
-			NADataDef *def = na_data_boxed_get_data_def( boxed );
+			const NADataDef *def = na_data_boxed_get_data_def( boxed );
 
 			if( !strcmp( def->name, name )){
 				return( boxed );
diff --git a/src/core/na-settings.c b/src/core/na-settings.c
index a9d36b5..92676ec 100644
--- a/src/core/na-settings.c
+++ b/src/core/na-settings.c
@@ -907,7 +907,7 @@ content_diff( GList *old, GList *new )
 			knew = ( KeyValue * ) in->data;
 			if( !strcmp( kold->group, knew->group ) && ( gpointer ) kold->def == ( gpointer ) knew->def ){
 				found = TRUE;
-				if( na_boxed_compare( kold->boxed, knew->boxed ) != 0 ){
+				if( !na_boxed_are_equal( kold->boxed, knew->boxed )){
 					/* a key has been modified */
 					kdiff = g_new0( KeyValue, 1 );
 					kdiff->group = g_strdup( knew->group );
diff --git a/src/io-desktop/nadp-writer.c b/src/io-desktop/nadp-writer.c
index d3e2751..a460b84 100644
--- a/src/io-desktop/nadp-writer.c
+++ b/src/io-desktop/nadp-writer.c
@@ -483,7 +483,7 @@ nadp_writer_ifactory_provider_write_data(
 	static const gchar *thisfn = "nadp_writer_ifactory_provider_write_data";
 	NadpDesktopFile *ndf;
 	guint code;
-	NADataDef *def;
+	const NADataDef *def;
 	gchar *profile_id;
 	gchar *group_name;
 	gchar *str_value;
diff --git a/src/io-gconf/nagp-writer.c b/src/io-gconf/nagp-writer.c
index 0029f3f..718c6ff 100644
--- a/src/io-gconf/nagp-writer.c
+++ b/src/io-gconf/nagp-writer.c
@@ -275,7 +275,7 @@ nagp_writer_write_data( const NAIFactoryProvider *provider, void *writer_data,
 {
 	static const gchar *thisfn = "nagp_writer_write_data";
 	guint code;
-	NADataDef *def;
+	const NADataDef *def;
 	gchar *this_id;
 	gchar *this_path, *path;
 	gchar *msg;
diff --git a/src/io-xml/naxml-writer.c b/src/io-xml/naxml-writer.c
index 32129b7..bee67c1 100644
--- a/src/io-xml/naxml-writer.c
+++ b/src/io-xml/naxml-writer.c
@@ -449,7 +449,7 @@ guint
 naxml_writer_write_data( const NAIFactoryProvider *provider, void *writer_data, const NAIFactoryObject *object, const NADataBoxed *boxed, GSList **messages )
 {
 	NAXMLWriter *writer;
-	NADataDef *def;
+	const NADataDef *def;
 
 	/*NADataDef *def = na_data_boxed_get_data_def( boxed );
 	g_debug( "naxml_writer_write_data: def=%s", def->name );*/



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