[nautilus-actions] Replace serializable+obsoleted by readable+writable in NADataDef



commit 2b33d7bdf3e6fe35b76bfcda93ce02776514926d
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Mar 3 23:47:42 2010 +0100

    Replace serializable+obsoleted by readable+writable in NADataDef

 ChangeLog                              |   12 ++
 src/api/na-data-def.h                  |   21 +++--
 src/core/na-factory-object.c           |   87 ++++++++++------
 src/core/na-object-action-factory.c    |  172 ++++++++++++++++++--------------
 src/core/na-object-action.c            |    8 +-
 src/core/na-object-id-factory.c        |   15 ++-
 src/core/na-object-item-factory.c      |   82 ++++++++++-----
 src/core/na-object-profile-factory.c   |   55 ++++++----
 src/io-desktop/nadp-desktop-provider.c |    1 -
 9 files changed, 282 insertions(+), 171 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f5b465d..6a8aefe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-03-03 Pierre Wieser <pwieser trychlos org>
 
+	Review the rationales, replacing serializable+obsoleted by
+	readable+writable flags in NADataDef structure.
+
+	* src/api/na-data-def.h:
+	* src/core/na-factory-object.c:
+	* src/core/na-object-action-factory.c:
+	* src/core/na-object-action.c:
+	* src/core/na-object-id-factory.c:
+	* src/core/na-object-item-factory.c:
+	* src/core/na-object-profile-factory.c:
+	* src/io-desktop/nadp-desktop-provider.c: Updated accordingly.
+
 	* src/plugin-tracker/na-tracker-dbus.c (instance_dispose):
 	Release selected items in instance_dispose() rather than in
 	instance_finalize() which caused a FPE in Nautilus terminaison.
diff --git a/src/api/na-data-def.h b/src/api/na-data-def.h
index 5723f91..32f616e 100644
--- a/src/api/na-data-def.h
+++ b/src/api/na-data-def.h
@@ -52,12 +52,21 @@ typedef struct {
 										 * must be globally unique
 										 * must also be an invariant as it is known from plugin extensions */
 
-	gboolean  serializable;				/* whether the data is serializable
-										 * if FALSE, then no attempt will be made to read/write it
-										 * and the data will must be set dynamically
-										 * when a data has been set serializable once, it remains so
+	gboolean  readable;					/* whether the data should be read on unserialization ops.
+										 * if FALSE, then no attempt will be made to read it
+										 * and the data will has to be set dynamically
+										 * when a data has been written once (see below), and unless
+										 * special cases (see e.g. type), it should remain readable
 										 * even if it has becomen obsolete (for backward compatibility) */
 
+	gboolean  writable;					/* whether the data is to be written on serialization ops.
+										 * if FALSE, then no attempt will be made to write it
+										 * mainly set to FALSE to dynamically set variables and
+										 * obsoleted ones */
+
+	gboolean  has_property;				/* whether a property should be set for this variable ?
+										 * set to FALSE for obsolete variables */
+
 	gchar    *short_label;				/* short descriptive name
 										 * used in GParamSpec and in schemas */
 
@@ -85,10 +94,6 @@ typedef struct {
 										 * when serializing or exporting */
 
 	gchar    *gconf_entry;				/* same entry is also used for GConf-based XML docs */
-
-	gboolean  obsoleted;				/* whether this data has been obsoleted ?
-										 * if TRUE, then no property will be defined for it
-										 * and the data will not be written when serializing */
 }
 	NADataDef;
 
diff --git a/src/core/na-factory-object.c b/src/core/na-factory-object.c
index 1fdf15d..906acde 100644
--- a/src/core/na-factory-object.c
+++ b/src/core/na-factory-object.c
@@ -47,6 +47,13 @@
 
 typedef gboolean ( *NADataDefIterFunc )( NADataDef *def, void *user_data );
 
+enum {
+	DATA_DEF_ITER_SET_PROPERTIES = 1,
+	DATA_DEF_ITER_SET_DEFAULTS,
+	DATA_DEF_ITER_IS_VALID,
+	DATA_DEF_ITER_READ_ITEM,
+};
+
 /* while iterating on read item
  */
 typedef struct {
@@ -102,7 +109,7 @@ static guint        v_write_done( NAIFactoryObject *serializable, const NAIFacto
 
 static void         attach_boxed_to_object( NAIFactoryObject *object, NADataBoxed *boxed );
 static void         free_data_boxed_list( NAIFactoryObject *object );
-static void         iter_on_data_defs( const NADataGroup *idgroups, gboolean serializable_only, NADataDefIterFunc pfn, void *user_data );
+static void         iter_on_data_defs( const NADataGroup *idgroups, guint mode, NADataDefIterFunc pfn, void *user_data );
 
 /**
  * na_factory_object_define_properties:
@@ -125,7 +132,7 @@ na_factory_object_define_properties( GObjectClass *class, const NADataGroup *gro
 
 		/* define class properties
 		 */
-		iter_on_data_defs( groups, FALSE, ( NADataDefIterFunc ) define_class_properties_iter, class );
+		iter_on_data_defs( groups, DATA_DEF_ITER_SET_PROPERTIES, ( NADataDefIterFunc ) define_class_properties_iter, class );
 	}
 }
 
@@ -140,15 +147,13 @@ define_class_properties_iter( const NADataDef *def, GObjectClass *class )
 
 	stop = FALSE;
 
-	if( !def->obsoleted ){
-		spec = na_data_boxed_get_param_spec( def );
+	spec = na_data_boxed_get_param_spec( def );
 
-		if( spec ){
-			g_object_class_install_property( class, g_quark_from_string( def->name ), spec );
+	if( spec ){
+		g_object_class_install_property( class, g_quark_from_string( def->name ), spec );
 
-		} else {
-			g_warning( "%s: type=%d: unable to get a spec", thisfn, def->type );
-		}
+	} else {
+		g_warning( "%s: type=%d: unable to get a spec", thisfn, def->type );
 	}
 
 	return( stop );
@@ -272,7 +277,7 @@ na_factory_object_set_defaults( NAIFactoryObject *object )
 			iter_data = g_new0( NafoDefaultIter, 1 );
 			iter_data->object = object;
 
-			iter_on_data_defs( groups, FALSE, ( NADataDefIterFunc ) set_defaults_iter, iter_data );
+			iter_on_data_defs( groups, DATA_DEF_ITER_SET_DEFAULTS, ( NADataDefIterFunc ) set_defaults_iter, iter_data );
 
 			g_free( iter_data );
 		}
@@ -285,21 +290,17 @@ set_defaults_iter( NADataDef *def, NafoDefaultIter *data )
 	NADataBoxed *boxed;
 	gboolean is_null;
 
-	if( !def->obsoleted ){
-		if( def->default_value ){
-			is_null = TRUE;
-			boxed = na_ifactory_object_get_data_boxed( data->object, def->name );
-			if( boxed ){
-				is_null = ( na_data_boxed_get_as_void( boxed ) == NULL );
-			}
-			if( is_null ){
-				if( !boxed ){
-					boxed = na_data_boxed_new( def );
-					attach_boxed_to_object( data->object, boxed );
-				}
-				na_data_boxed_set_from_string( boxed, def->default_value );
-			}
+	is_null = TRUE;
+	boxed = na_ifactory_object_get_data_boxed( data->object, def->name );
+	if( boxed ){
+		is_null = ( na_data_boxed_get_as_void( boxed ) == NULL );
+	}
+	if( is_null ){
+		if( !boxed ){
+			boxed = na_data_boxed_new( def );
+			attach_boxed_to_object( data->object, boxed );
 		}
+		na_data_boxed_set_from_string( boxed, def->default_value );
 	}
 
 	/* do not stop */
@@ -472,7 +473,7 @@ na_factory_object_is_valid( const NAIFactoryObject *object )
 
 	groups = v_get_groups( object );
 	if( groups ){
-		iter_on_data_defs( groups, FALSE, ( NADataDefIterFunc ) is_valid_mandatory_iter, &iter_data );
+		iter_on_data_defs( groups, DATA_DEF_ITER_IS_VALID, ( NADataDefIterFunc ) is_valid_mandatory_iter, &iter_data );
 	}
 	is_valid = iter_data.is_valid;
 
@@ -492,7 +493,7 @@ is_valid_mandatory_iter( const NADataDef *def, NafoValidIter *data )
 {
 	NADataBoxed *boxed;
 
-	if( def->mandatory && !def->obsoleted ){
+	if( def->mandatory ){
 		boxed = na_ifactory_object_get_data_boxed( data->object, def->name );
 		if( !boxed ){
 			g_debug( "na_factory_object_is_valid_mandatory_iter: invalid %s: mandatory but not set", def->name );
@@ -585,7 +586,7 @@ na_factory_object_read_item( NAIFactoryObject *serializable, const NAIFactoryPro
 			iter->reader_data = reader_data;
 			iter->messages = messages;
 
-			iter_on_data_defs( groups, TRUE, ( NADataDefIterFunc ) read_data_iter, iter );
+			iter_on_data_defs( groups, DATA_DEF_ITER_READ_ITEM, ( NADataDefIterFunc ) read_data_iter, iter );
 
 			g_free( iter );
 
@@ -685,7 +686,7 @@ write_data_iter( const NAIFactoryObject *object, NADataBoxed *boxed, NafoWriteIt
 {
 	NADataDef *def = na_data_boxed_get_data_def( boxed );
 
-	if( def->serializable && !def->obsoleted ){
+	if( def->writable ){
 		iter->code = na_factory_provider_write_data( iter->writer, iter->writer_data, object, boxed, iter->messages );
 	}
 
@@ -930,8 +931,9 @@ free_data_boxed_list( NAIFactoryObject *object )
  * the iter function must return TRUE to stops the enumeration
  */
 static void
-iter_on_data_defs( const NADataGroup *groups, gboolean serializable_only, NADataDefIterFunc pfn, void *user_data )
+iter_on_data_defs( const NADataGroup *groups, guint mode, NADataDefIterFunc pfn, void *user_data )
 {
+	static const gchar *thisfn = "na_factory_object_iter_on_data_defs";
 	NADataDef *def;
 	gboolean stop;
 
@@ -947,8 +949,31 @@ iter_on_data_defs( const NADataGroup *groups, gboolean serializable_only, NAData
 				/*g_debug( "serializable_only=%s, def->serializable=%s",
 						serializable_only ? "True":"False", def->serializable ? "True":"False" );*/
 
-				if( !serializable_only || def->serializable ){
-					stop = ( *pfn )( def, user_data );
+				switch( mode ){
+					case DATA_DEF_ITER_SET_PROPERTIES:
+						if( def->has_property ){
+							stop = ( *pfn )( def, user_data );
+						}
+						break;
+
+					case DATA_DEF_ITER_SET_DEFAULTS:
+						if( def->default_value ){
+							stop = ( *pfn )( def, user_data );
+						}
+						break;
+
+					case DATA_DEF_ITER_IS_VALID:
+						stop = ( *pfn )( def, user_data );
+						break;
+
+					case DATA_DEF_ITER_READ_ITEM:
+						if( def->readable ){
+							stop = ( *pfn )( def, user_data );
+						}
+						break;
+
+					default:
+						g_warning( "%s: unknown mode=%d", thisfn, mode );
 				}
 
 				def++;
diff --git a/src/core/na-object-action-factory.c b/src/core/na-object-action-factory.c
index 72493c2..24aa605 100644
--- a/src/core/na-object-action-factory.c
+++ b/src/core/na-object-action-factory.c
@@ -45,6 +45,8 @@ static NADataDef data_def_action [] = {
 
 	{ NAFO_DATA_VERSION,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Version of the format" ),
 				N_( "The version of the configuration format that will be used to manage " \
 					"backward compatibility." ),
@@ -54,11 +56,12 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"version",
-				FALSE },
+				"version" },
 
 	{ NAFO_DATA_TARGET_SELECTION,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Targets the context menu" ),
 				N_( "Whether the action of the menu targets the selection file manager " \
 					"context menus.\n" \
@@ -69,11 +72,12 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"target-selection",
-				FALSE },
+				"target-selection" },
 
 	{ NAFO_DATA_TARGET_BACKGROUND,
 				TRUE,
+				TRUE,
+				TRUE,
 				"Target the folder context menu",
 				"Does the action target the context menu when there is no selection ?",
 				NAFD_TYPE_BOOLEAN,
@@ -82,11 +86,12 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"target-background",
-				FALSE },
+				"target-background" },
 
 	{ NAFO_DATA_TARGET_TOOLBAR,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Targets the toolbar" ),
 				N_( "Whether the action is candidate to be displayed in file manager toolbar.\n" \
 					"Note, that as of Nautilus 2.26, menus can not be candidate to toolbar display." ),
@@ -96,11 +101,12 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"target-toolbar",
-				FALSE },
+				"target-toolbar" },
 
 	{ NAFO_DATA_TOOLBAR_LABEL,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Label of the toolbar item" ),
 				N_( "The label displayed besides of the icon in the file manager toolbar.\n" \
 					"Note that actual display may depend of your own Desktop Environment preferences.\n" \
@@ -111,11 +117,17 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				FALSE,
 				TRUE,
-				"toolbar-label",
-				FALSE },
+				"toolbar-label" },
 
+	/* this data has been introduced in 2.29.1 and has been left up to 2.29.4
+	 * it has been removed starting with 2.29.5
+	 * it is now only used in the NACT user interface
+	 * it is so left readable, but no more writable (obsolete)
+	 */
 	{ NAFO_DATA_TOOLBAR_SAME_LABEL,
+				TRUE,
 				FALSE,
+				TRUE,
 				"Does the toolbar label is the same than the main one ?",
 				"Does the toolbar label is the same than the main one ?",
 				NAFD_TYPE_BOOLEAN,
@@ -124,11 +136,14 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"toolbar-same-label",
-				FALSE },
+				"toolbar-same-label" },
 
+	/* dynamic data, so non readable / non writable
+	 */
 	{ NAFO_DATA_LAST_ALLOCATED,
 				FALSE,
+				FALSE,
+				TRUE,
 				"Last allocated profile",
 				"Last allocated profile number in na_object_action_get_new_profile_name(), " \
 				"reset to zero when saving the action.",
@@ -138,137 +153,142 @@ static NADataDef data_def_action [] = {
 				FALSE,
 				FALSE,
 				FALSE,
-				NULL,
-				FALSE },
+				NULL },
 
 	{ NULL },
 };
 
+/* all these data are pre-profiles data
+ * these are obsoleted since 1.9 (which was a non-official version)
+ * readable but non writable, no default
+ */
 static NADataDef data_def_obsoleted_action [] = {
 
 	{ NAFO_DATA_PATH,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Command path",
-				"The path to the command.",
+				NULL,
 				NAFD_TYPE_STRING,
-				"",
-				TRUE,
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
+				FALSE,
 				FALSE,
-				"path",
-				TRUE },
+				FALSE,
+				"path" },
 
 	{ NAFO_DATA_PARAMETERS,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Command parameters",
-				"The parameters of the command.",
+				NULL,
 				NAFD_TYPE_STRING,
-				"",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
 				FALSE,
 				FALSE,
-				"parameters",
-				TRUE },
+				FALSE,
+				"parameters" },
 
 	{ NAFO_DATA_BASENAMES,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Basenames",
-				"The basenames the selection must match. " \
-				"Defaults to '*'.",
+				NULL,
 				NAFD_TYPE_STRING_LIST,
-				"*",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
+				FALSE,
 				FALSE,
 				FALSE,
-				"basenames",
-				TRUE },
+				"basenames" },
 
 	{ NAFO_DATA_MATCHCASE,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Case sensitive",
-				"Whether the specified basenames are case sensitive." \
-				"Defaults to 'true'.",
+				NULL,
 				NAFD_TYPE_BOOLEAN,
-				"TRUE",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
+				FALSE,
 				FALSE,
 				FALSE,
-				"matchcase",
-				TRUE },
+				"matchcase" },
 
 	{ NAFO_DATA_MIMETYPES,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Mimetypes",
-				"The mimetypes the selection must match." \
-				"Defaults to '*'.",
+				NULL,
 				NAFD_TYPE_STRING_LIST,
-				"*",
-				TRUE,
-				TRUE,
+				NULL,
 				FALSE,
 				FALSE,
-				"mimetypes",
-				TRUE },
+				FALSE,
+				FALSE,
+				"mimetypes" },
 
 	{ NAFO_DATA_ISFILE,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Applies to files only",
-				"Whether the profile only applies to files." \
-				"Defaults to 'true'",
+				NULL,
 				NAFD_TYPE_BOOLEAN,
-				"TRUE",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
 				FALSE,
 				FALSE,
-				"isfile",
-				TRUE },
+				FALSE,
+				"isfile" },
 
 	{ NAFO_DATA_ISDIR,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Applies to directories only",
-				"Whether the profile applies to directories only." \
-				"Defaults to 'false'",
+				NULL,
 				NAFD_TYPE_BOOLEAN,
-				"FALSE",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
 				FALSE,
 				FALSE,
-				"isdir",
-				TRUE },
+				FALSE,
+				"isdir" },
 
 	{ NAFO_DATA_MULTIPLE,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Multiple selection",
-				"Whether the selection may be multiple." \
-				"Defaults to 'false'.",
+				NULL,
 				NAFD_TYPE_BOOLEAN,
-				"FALSE",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
+				FALSE,
 				FALSE,
 				FALSE,
-				"accept-multiple-files",
-				TRUE },
+				"accept-multiple-files" },
 
 	{ NAFO_DATA_SCHEMES,
 				TRUE,
+				FALSE,
+				FALSE,
 				"Schemes",
-				"The list of schemes the selection must match." \
-				"Defaults to 'file'.",
+				NULL,
 				NAFD_TYPE_STRING_LIST,
-				"file",
-				TRUE,
-				TRUE,
+				NULL,
+				FALSE,
+				FALSE,
 				FALSE,
 				FALSE,
-				"schemes",
-				TRUE },
+				"schemes" },
 
 	{ NULL },
 };
diff --git a/src/core/na-object-action.c b/src/core/na-object-action.c
index 9dfabb9..35d374b 100644
--- a/src/core/na-object-action.c
+++ b/src/core/na-object-action.c
@@ -388,10 +388,14 @@ check_for_obsoleted_iter( const NAIFactoryObject *object, NADataBoxed *boxed, It
 {
 	NADataDef *action_def = na_data_boxed_get_data_def( boxed );
 
-	if( action_def->obsoleted ){
+	/* if property is obsoleted in an action
+	 */
+	if( action_def->readable && !action_def->writable ){
 		NADataDef *profile_def = na_factory_object_get_data_def( NA_IFACTORY_OBJECT( parms->profile ), action_def->name );
 
-		if( profile_def && !profile_def->obsoleted ){
+		/* but the property exists in the profile
+		 */
+		if( profile_def && profile_def->readable && profile_def->writable){
 			g_debug( "na_object_action_check_for_obsoleted_iter: " \
 					 "boxed=%p (%s) marked to be moved from action body to profile",
 							 ( void * ) boxed, action_def->name );
diff --git a/src/core/na-object-id-factory.c b/src/core/na-object-id-factory.c
index 44adaf0..80f52f6 100644
--- a/src/core/na-object-id-factory.c
+++ b/src/core/na-object-id-factory.c
@@ -38,8 +38,13 @@
 
 NADataDef data_def_id [] = {
 
+	/* this data is marked non readable / non writable as it has to be readen
+	 * written specifically when serializing / unserializing items
+	 */
 	{ NAFO_DATA_ID,
 				FALSE,
+				FALSE,
+				TRUE,
 				"NAObjectId identifiant",
 				"Internal identifiant of the NAObjectId object. " \
 				"Historically a UUID used as a GConf directory (thus ASCII, case insensitive), " \
@@ -50,11 +55,14 @@ NADataDef data_def_id [] = {
 				TRUE,
 				TRUE,
 				FALSE,
-				NULL,
-				FALSE },
+				NULL },
 
+	/* dynamic data, so not readable / not writable
+	 */
 	{ NAFO_DATA_PARENT,
 				FALSE,
+				FALSE,
+				TRUE,
 				"NAObjectId Parent",
 				"The NAObjectItem which is the parent of this object.",
 				NAFD_TYPE_POINTER,
@@ -63,8 +71,7 @@ NADataDef data_def_id [] = {
 				FALSE,
 				FALSE,
 				FALSE,
-				NULL,
-				FALSE },
+				NULL },
 
 	{ NULL },
 };
diff --git a/src/core/na-object-item-factory.c b/src/core/na-object-item-factory.c
index 8cdd5ed..ba7a38d 100644
--- a/src/core/na-object-item-factory.c
+++ b/src/core/na-object-item-factory.c
@@ -40,28 +40,35 @@
 
 NADataDef data_def_item [] = {
 
-	/* this data is marked as 'non-serializable'
-	 * this means it will not be automatically readen/written or imported/exported
-	 * the corresponding NADataBoxed is created at read_start() time
+	/* this data is marked as non readable as it has to be readen specifically
+	 * in order to be able to create the corresponding NAObjectItem-derived object
+	 * it is nonetheless marked writable
 	 */
 	{ NAFO_DATA_TYPE,
 				FALSE,
+				TRUE,
+				TRUE,
 				N_( "Type of the item" ),
 				N_( "Defines if the item is an action or a menu. Possible values are :\n" \
 					"- 'Action',\n" \
 					"- 'Menu'.\n" \
 					"The value is case sensitive and must not be localized." ),
-				NAFD_TYPE_LOCALE_STRING,
-				NULL,
+				NAFD_TYPE_STRING,
+				"Action",
 				TRUE,
 				FALSE,
 				FALSE,
 				FALSE,
-				"type",
-				FALSE },
+				"type" },
 
+	/* this data is common between actions and menus
+	 * so default value is directly set in na_object_action_new_with_defaults()
+	 * and na_object_menu_new_with_defaults()
+	 */
 	{ NAFO_DATA_LABEL,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Label of the context menu item" ),
 				N_( "The label of the menu item that will appear in the file manager context " \
 					"menu when the selection matches the appearance condition settings.\n" \
@@ -72,11 +79,12 @@ NADataDef data_def_item [] = {
 				TRUE,
 				FALSE,
 				TRUE,
-				"label",
-				FALSE },
+				"label" },
 
 	{ NAFO_DATA_TOOLTIP,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Tooltip of the context menu item" ),
 				N_( "The tooltip of the menu item that will appear in the file manager " \
 					"statusbar when the user points to the file manager context menu item " \
@@ -87,11 +95,12 @@ NADataDef data_def_item [] = {
 				TRUE,
 				FALSE,
 				TRUE,
-				"tooltip",
-				FALSE },
+				"tooltip" },
 
 	{ NAFO_DATA_ICON,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Icon of the context menu item" ),
 				N_( "The icon of the menu item that will appear next to the label " \
 					"in the file manager context menu when the selection matches the appearance " \
@@ -103,11 +112,12 @@ NADataDef data_def_item [] = {
 				TRUE,
 				FALSE,
 				TRUE,
-				"icon",
-				FALSE },
+				"icon" },
 
 	{ NAFO_DATA_DESCRIPTION,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Description relative to the item" ),
 				N_( "Some text which explains the goal of the menu or the action.\n" \
 					"May be used, e.g. when displaying available items on a web site." ),
@@ -117,11 +127,14 @@ NADataDef data_def_item [] = {
 				TRUE,
 				FALSE,
 				TRUE,
-				"description",
-				FALSE },
+				"description" },
 
+	/* dynamic data, so not readable / not writable
+	 */
 	{ NAFO_DATA_SUBITEMS,
 				FALSE,			/* not serializable */
+				FALSE,
+				TRUE,
 				"Subitems",
 				"List of subitems objects",
 				NAFD_TYPE_POINTER,
@@ -130,11 +143,15 @@ NADataDef data_def_item [] = {
 				FALSE,			/* not comparable */
 				FALSE,			/* not mandatory */
 				FALSE,			/* not localized */
-				NULL,
-				FALSE },
+				NULL },
 
+	/* list of subitems as a string list
+	 * dynamically rebuilt on write_start()
+	 */
 	{ NAFO_DATA_SUBITEMS_SLIST,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "List of subitem ids" ),
 				N_( "Ordered list of the IDs of the subitems. This may be actions or menus " \
 					"if the item is a menu, or profiles if the item is an action.\n" \
@@ -146,11 +163,12 @@ NADataDef data_def_item [] = {
 				FALSE,
 				FALSE,
 				FALSE,
-				"items",
-				FALSE },
+				"items" },
 
 	{ NAFO_DATA_ENABLED,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Whether the action or the menu is enabled" ),
 				N_( "If the or the menu action is disabled, it will never appear in the " \
 					"file manager context menu." ),
@@ -160,11 +178,15 @@ NADataDef data_def_item [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"enabled",
-				FALSE },
+				"enabled" },
 
+	/* dynamic data, so non readable / non writable
+	 * must be set by the NAIIOProvider when reading the item
+	 */
 	{ NAFO_DATA_READONLY,
 				FALSE,
+				FALSE,
+				TRUE,
 				"Read-only",
 				"Is the item only readable ? " \
 				"This is an intrinsic property, dynamically set when the item is unserialized. " \
@@ -178,11 +200,14 @@ NADataDef data_def_item [] = {
 				FALSE,
 				FALSE,
 				FALSE,
-				NULL,
-				FALSE },
+				NULL },
 
+	/* dynamic data, so non readable / non writable
+	 */
 	{ NAFO_DATA_PROVIDER,
 				FALSE,
+				FALSE,
+				TRUE,
 				"I/O provider",
 				"A pointer to the NAIOProvider object.",
 				NAFD_TYPE_POINTER,
@@ -191,11 +216,15 @@ NADataDef data_def_item [] = {
 				FALSE,
 				FALSE,
 				FALSE,
-				NULL,
-				FALSE },
+				NULL },
 
+	/* dynamic data, so non readable / non writable
+	 * is left at the NAIIOProvider disposition
+	 */
 	{ NAFO_DATA_PROVIDER_DATA,
 				FALSE,
+				FALSE,
+				TRUE,
 				"I/O provider data",
 				"A pointer to some NAIOProvider specific data.",
 				NAFD_TYPE_POINTER,
@@ -204,8 +233,7 @@ NADataDef data_def_item [] = {
 				FALSE,
 				FALSE,
 				FALSE,
-				NULL,
-				FALSE },
+				NULL },
 
 	{ NULL },
 };
diff --git a/src/core/na-object-profile-factory.c b/src/core/na-object-profile-factory.c
index 6183105..41c8bf7 100644
--- a/src/core/na-object-profile-factory.c
+++ b/src/core/na-object-profile-factory.c
@@ -44,6 +44,8 @@ static NADataDef data_def_profile [] = {
 
 	{ NAFO_DATA_DESCNAME,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Name of the profile" ),
 				N_( "May be used as a description for the function of the profile.\n" \
 					"If not set, it defaults to an auto-generated name." ),
@@ -53,11 +55,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				TRUE,
-				"desc-name",
-				FALSE },
+				"desc-name" },
 
 	{ NAFO_DATA_PATH,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Path of the command" ),
 				N_( "The path of the command to be executed when the user select the menu item " \
 					"in the file manager context menu or in the toolbar." ),
@@ -67,11 +70,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				TRUE,
 				FALSE,
-				"path",
-				FALSE },
+				"path" },
 
 	{ NAFO_DATA_PARAMETERS,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Parameters of the command" ),
 										/* too long string for iso c: 665 (max=509) */
 				N_( "The parameters of the command to be executed when the user selects the menu " \
@@ -95,11 +99,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"parameters",
-				FALSE },
+				"parameters" },
 
 	{ NAFO_DATA_BASENAMES,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "List of pattern to match the selected file(s)/folder(s)" ),
 				N_( "A list of strings with joker '*' or '?' to be matched against the name(s) " \
 					"of the selected file(s)/folder(s). Each selected items must match at least " \
@@ -113,11 +118,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"basenames",
-				FALSE },
+				"basenames", },
 
 	{ NAFO_DATA_MATCHCASE,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Whether the specified basenames are case sensitive" ),
 				N_( "Must be set to 'true' if the filename patterns are case sensitive, to 'false' " \
 					"otherwise. E.g., if you need to match a filename in a case-sensitive manner, " \
@@ -131,11 +137,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"matchcase",
-				FALSE },
+				"matchcase" },
 
 	{ NAFO_DATA_MIMETYPES,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "List of patterns to match the mimetypes of the selected file(s)/folder(s)" ),
 				N_( "A list of strings with joker '*' to be matched against the mimetypes of the " \
 					"selected file(s)/folder(s). Each selected items must match at least one of " \
@@ -148,11 +155,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"mimetypes",
-				FALSE },
+				"mimetypes" },
 
 	{ NAFO_DATA_ISFILE,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Whether the profile applies to files" ),
 				N_( "Set to 'true' if the selection can have files, to 'false' otherwise.\n" \
 					"This setting is tied in with the 'isdir' setting. The valid combinations are: \n" \
@@ -169,11 +177,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"isfile",
-				FALSE },
+				"isfile" },
 
 	{ NAFO_DATA_ISDIR,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Whether the profile applies to folders" ),
 				N_( "Set to 'true' if the selection can have folders, to 'false' otherwise.\n" \
 					"This setting is tied in with the 'isfile' setting. The valid combinations are: \n" \
@@ -190,11 +199,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"isdir",
-				FALSE },
+				"isdir" },
 
 	{ NAFO_DATA_MULTIPLE,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "Whether the selection may be multiple" ),
 				N_( "If you need more than one files or folders to be selected, set this " \
 					"key to 'true'. If you want just one file or folder, set it to 'false'.\n" \
@@ -206,11 +216,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"accept-multiple-files",
-				FALSE },
+				"accept-multiple-files" },
 
 	{ NAFO_DATA_SCHEMES,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "List of schemes" ),
 										/* too long string for iso c: 510 (max=509) */
 				N_( "Defines the list of valid schemes to be matched against the selected " \
@@ -234,11 +245,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"schemes",
-				FALSE },
+				"schemes" },
 
 	{ NAFO_DATA_FOLDERS,
 				TRUE,
+				TRUE,
+				TRUE,
 				N_( "List of folders" ),
 				N_( "Defines the list of valid paths to be matched against the current folder.\n " \
 					"All folders 'under' the specified path are considered valid.\n" \
@@ -250,8 +262,7 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				FALSE,
-				"folders",
-				FALSE },
+				"folders" },
 
 	{ NULL },
 };
diff --git a/src/io-desktop/nadp-desktop-provider.c b/src/io-desktop/nadp-desktop-provider.c
index 8b2bca7..bc5ba44 100644
--- a/src/io-desktop/nadp-desktop-provider.c
+++ b/src/io-desktop/nadp-desktop-provider.c
@@ -300,7 +300,6 @@ ifactory_provider_read_data( const NAIFactoryProvider *reader, void *reader_data
 	g_return_val_if_fail( NA_IS_IFACTORY_PROVIDER( reader ), NULL );
 	g_return_val_if_fail( NADP_IS_DESKTOP_PROVIDER( reader ), NULL );
 	g_return_val_if_fail( NA_IS_IFACTORY_OBJECT( object ), NULL );
-	g_return_val_if_fail( def->serializable, NULL );
 
 	boxed = NULL;
 



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