[nautilus-actions] Fix pre-v3 parameters conversion



commit d0283b137eaf91fa52353c883a30e837afdbdf5f
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Jul 26 06:45:13 2010 +0200

    Fix pre-v3 parameters conversion

 ChangeLog                          |   16 +++
 TODO                               |    3 +-
 src/core/na-object-action.c        |    5 +-
 src/core/na-object-profile.c       |  218 ++++++++++++++++++++++++++++++-
 src/io-desktop/nadp-reader.c       |   23 ++--
 src/io-gconf/nagp-gconf-provider.c |    2 +-
 src/io-gconf/nagp-reader.c         |  256 +++++-------------------------------
 src/io-gconf/nagp-reader.h         |    5 +-
 8 files changed, 283 insertions(+), 245 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7e5890d..83bf69b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2010-07-26 Pierre Wieser <pwieser trychlos org>
 
+	Fix parameters conversion to v3.
+
+	* src/core/na-object-action.c (icontext_is_candidate):
+	Fix comment and minor typo.
+
+	* src/core/na-object-profile.c:
+	* src/io-gconf/nagp-reader.c (convert_pre_v3_parameters):
+	Move pre-v3 parameters conversion from GConf provider to profile class.
+
+	* src/io-desktop/nadp-reader.c
+	(nadp_reader_ifactory_provider_read_start):
+	* src/io-gconf/nagp-reader.c (nagp_reader_read_start):
+	* src/io-gconf/nagp-gconf-provider.c (ifactory_provider_iface_init):
+	* src/io-gconf/nagp-reader.h:
+	Now attach profile to its parent in 'read_start' interface.
+
 	* src/io-desktop/nadp-reader.c
 	(nadp_reader_ifactory_provider_read_done):
 	* src/io-gconf/nagp-reader.c (nagp_reader_read_done):
diff --git a/TODO b/TODO
index bca51d6..ddac290 100644
--- a/TODO
+++ b/TODO
@@ -497,5 +497,4 @@ Parameter 	Description
   the dialog box does not become taller of wider than the screen when there is a lot of
   lines, making it unreadable
 
-- 2010-07-02: bug 'wipe selected' action has a '%M' parameter which should have been converted at import time
-
+- 2010-07-26: bug: is able to ad Local capability twice
diff --git a/src/core/na-object-action.c b/src/core/na-object-action.c
index 026830e..ec5c9f1 100644
--- a/src/core/na-object-action.c
+++ b/src/core/na-object-action.c
@@ -418,9 +418,6 @@ icontext_is_candidate( NAIContext *object, guint target, GList *selection )
  *  it is be identified by an version = "1.x"
  *  or by any data found in data_def_action_v1 (defined in na-object-action-factory.c)
  *  -> move obsoleted data to a new profile, updating the version string
- *
- * This may have been done in nagp_reader_read_done because only GConf has pre-v2
- * actions, but it is easyer to do the conversion before setting defaults
  */
 static void
 convert_v1_to_v2( NAIFactoryObject *instance )
@@ -443,7 +440,7 @@ convert_v1_to_v2( NAIFactoryObject *instance )
 		if( boxed ){
 			g_debug( "%s: boxed=%p (%s) marked to be moved from action body to profile",
 							 thisfn, ( void * ) boxed, def->name );
-			to_move =g_list_prepend( to_move, boxed );
+			to_move = g_list_prepend( to_move, boxed );
 		}
 		def++;
 	}
diff --git a/src/core/na-object-profile.c b/src/core/na-object-profile.c
index b37833a..cd4d1ee 100644
--- a/src/core/na-object-profile.c
+++ b/src/core/na-object-profile.c
@@ -86,6 +86,10 @@ static guint        ifactory_object_write_done( NAIFactoryObject *instance, cons
 static void         icontext_iface_init( NAIContextInterface *iface );
 static gboolean     icontext_is_candidate( NAIContext *object, guint target, GList *selection );
 
+static gboolean     convert_pre_v3_parameters( NAObjectProfile *profile );
+static gboolean     convert_pre_v3_parameters_str( gchar *str );
+static gboolean     convert_pre_v3_multiple( NAObjectProfile *profile );
+static gboolean     convert_pre_v3_isfiledir( NAObjectProfile *profile );
 static gboolean     profile_is_valid( const NAObjectProfile *profile );
 static gboolean     is_valid_path_parameters( const NAObjectProfile *profile );
 
@@ -328,7 +332,27 @@ ifactory_object_is_valid( const NAIFactoryObject *object )
 static void
 ifactory_object_read_done( NAIFactoryObject *instance, const NAIFactoryProvider *reader, void *reader_data, GSList **messages )
 {
-	g_debug( "na_object_profile_ifactory_object_read_done: profile=%p", ( void * ) instance );
+	static const gchar *thisfn = "na_object_profile_ifactory_object_read_done";
+	NAObjectAction *action;
+	guint iversion;
+
+	g_debug( "%s: profile=%p", thisfn, ( void * ) instance );
+
+	/* converts pre-v3 data
+	 */
+	action = NA_OBJECT_ACTION( na_object_get_parent( instance ));
+	iversion = na_object_get_iversion( action );
+	g_debug( "%s: iversion=%d", thisfn, iversion );
+
+	if( iversion < 3 ){
+
+		if( convert_pre_v3_parameters( NA_OBJECT_PROFILE( instance )) ||
+			convert_pre_v3_multiple( NA_OBJECT_PROFILE( instance )) ||
+			convert_pre_v3_isfiledir( NA_OBJECT_PROFILE( instance ))){
+
+				na_object_set_iversion( action, 3 );
+		}
+	}
 
 	/* prepare the context after the reading
 	 */
@@ -361,6 +385,198 @@ icontext_is_candidate( NAIContext *object, guint target, GList *selection )
 	return( TRUE );
 }
 
+/*
+ * starting wih v3, parameters are relabeled
+ *   pre-v3 parameters					post-v3 parameters
+ *   ----------------------------		-----------------------------------
+ *   									%b: (first) basename	(new)
+ *   									%B: list of basenames	(was %m)
+ *   									%c: count				(new)
+ * 	 %d: (first) base directory			...................		(unchanged)
+ * 										%D: list of base dir	(new)
+ *   %f: (first) pathname				...................		(unchanged)
+ *   									%F: list of pathnames	(was %M)
+ *   %h: (first) hostname				...................		(unchanged)
+ *   %m: list of basenames	-> %B		-						(removed)
+ *   %M: list of pathnames	-> %F		-						(removed)
+ *   									%n: (first) username	(was %U)
+ *   %p: (first) port number			...................		(unchanged)
+ *   %R: list of URIs		-> %U		-						(removed)
+ *   %s: (first) scheme					...................		(unchanged)
+ *   %u: (first) URI					...................		(unchanged)
+ *   %U: (first) username	-> %n		%U: list of URIs		(was %R)
+ *   									%w: (first) basename w/o ext.	(new)
+ *   									%W: list of basenames w/o ext.	(new)
+ *   									%x: (first) extension	(new)
+ *   									%X: list of extensions	(new)
+ *   %%: %								...................		(unchanged)
+ *
+ * For pre-v3 items,
+ * - substitute %m with %B
+ * - substitute %M with %F
+ * - substitute %U with %n
+ * - substitute %R with %U
+ *
+ * Note that pre-v3 items only have parameters in the command and path fields.
+ * Are only located in 'profile' objects.
+ * Are only found in GConf or XML providers, as .desktop files have been
+ * simultaneously introduced.
+ *
+ * As a recall of the dynamics of the reading when loading an action:
+ *  - na_object_action_read_done: set action defaults
+ *  - nagp_reader_read_done: read profiles
+ *     > nagp_reader_read_start: attach profile to its parent
+ *     >  na_object_profile_read_done: convert old parameters
+ *
+ * So, when converting v2 to v3 parameters in a v2 profile,
+ * action already has its default values (including iversion=3)
+ */
+static gboolean
+convert_pre_v3_parameters( NAObjectProfile *profile )
+{
+	gboolean path_changed, parms_changed;
+
+	gchar *path = na_object_get_path( profile );
+	path_changed = convert_pre_v3_parameters_str( path );
+	if( path_changed ){
+		na_object_set_path( profile, path );
+	}
+	g_free( path );
+
+	gchar *parms = na_object_get_parameters( profile );
+	parms_changed = convert_pre_v3_parameters_str( parms );
+	if( parms_changed ){
+		na_object_set_parameters( profile, parms );
+	}
+	g_free( parms );
+
+	return( path_changed || parms_changed );
+}
+
+static gboolean
+convert_pre_v3_parameters_str( gchar *str )
+{
+	gboolean changed;
+	gchar *iter = str;
+
+	changed = FALSE;
+	while( iter != NULL &&
+			strlen( iter ) > 0 &&
+			( iter = g_strstr_len( iter, strlen( iter ), "%" )) != NULL ){
+
+		g_debug( "convert_pre_v3_parameters_str: iter[1]='%c'", iter[1] );
+		switch( iter[1] ){
+
+			/* %m (list of basenames) becomes %B
+			 */
+			case 'm':
+				iter[1] = 'B';
+				changed = TRUE;
+				break;
+
+			/* %M (list of filenames) becomes %F
+			 */
+			case 'M':
+				iter[1] = 'F';
+				changed = TRUE;
+				break;
+
+			/* %U ((first) username) becomes %n
+			 */
+			case 'U':
+				iter[1] = 'n';
+				changed = TRUE;
+				break;
+
+			/* %R (list of URIs) becomes %U
+			 */
+			case 'R':
+				iter[1] = 'U';
+				changed = TRUE;
+				break;
+		}
+
+		iter += 2;
+	}
+
+	return( changed );
+}
+
+/*
+ * default changes from accept_multiple=false
+ *                   to selection_count>0
+ */
+static gboolean
+convert_pre_v3_multiple( NAObjectProfile *profile )
+{
+	gboolean accept_multiple;
+	gchar *selection_count;
+
+	accept_multiple = na_object_is_multiple( profile );
+	selection_count = g_strdup( accept_multiple ? ">0" : "=1" );
+	na_object_set_selection_count( profile, selection_count );
+	g_free( selection_count );
+
+	return( TRUE );
+}
+
+/*
+ * we may have file=true  and dir=false -> only files          -> all/allfiles
+ *             file=false and dir=true  -> only dirs           -> inode/directory
+ *             file=true  and dir=true  -> both files and dirs -> all/all
+ *
+ * we try to replace this with the corresponding mimetype, but only if
+ * current mimetype is '*' (or * / * or all/all)
+ */
+static gboolean
+convert_pre_v3_isfiledir( NAObjectProfile *profile )
+{
+	gboolean converted;
+	gboolean isfile, isdir;
+	GSList *mimetypes;
+
+	converted = FALSE;
+
+	if( na_icontext_is_all_mimetypes( NA_ICONTEXT( profile ))){
+		converted = TRUE;
+		mimetypes = NULL;
+
+		isfile = na_object_is_file( profile );
+		isdir = na_object_is_dir( profile );
+
+		if( isfile ){
+			if( isdir ){
+				/* both file and dir -> do not modify mimetypes
+				 */
+				converted = FALSE;
+			} else {
+				/* files only
+				 */
+				mimetypes = g_slist_prepend( NULL, g_strdup( "all/allfiles" ));
+			}
+		} else {
+			if( isdir ){
+				/* dir only
+				 */
+				mimetypes = g_slist_prepend( NULL, g_strdup( "inode/directory" ));
+			} else {
+				/* not files nor dir: this is an invalid case -> do not modify
+				 * mimetypes
+				 */
+				converted = FALSE;
+			}
+		}
+
+		if( converted ){
+			na_object_set_mimetypes( profile, mimetypes );
+		}
+
+		na_core_utils_slist_free( mimetypes );
+	}
+
+	return( converted );
+}
+
 static gboolean
 profile_is_valid( const NAObjectProfile *profile )
 {
diff --git a/src/io-desktop/nadp-reader.c b/src/io-desktop/nadp-reader.c
index 6531c2f..fa79767 100644
--- a/src/io-desktop/nadp-reader.c
+++ b/src/io-desktop/nadp-reader.c
@@ -70,11 +70,11 @@ static void              desktop_weak_notify( NadpDesktopFile *ndf, GObject *ite
 static void              free_desktop_paths( GList *paths );
 
 static void              read_start_read_subitems_key( const NAIFactoryProvider *provider, NAObjectItem *item, NadpReaderData *reader_data, GSList **messages );
+static void              read_start_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, NadpReaderData *reader_data, GSList **messages );
 
 static gboolean          read_done_item_is_writable( const NAIFactoryProvider *provider, NAObjectItem *item, NadpReaderData *reader_data, GSList **messages );
 static void              read_done_action_read_profiles( const NAIFactoryProvider *provider, NAObjectAction *action, NadpReaderData *data, GSList **messages );
 static void              read_done_action_load_profile( const NAIFactoryProvider *provider, NadpReaderData *reader_data, const gchar *profile_id, GSList **messages );
-static void              read_done_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, NadpReaderData *reader_data, GSList **messages );
 
 /*
  * Returns an unordered list of NAIFactoryObject-derived objects
@@ -349,6 +349,10 @@ nadp_reader_ifactory_provider_read_start( const NAIFactoryProvider *reader, void
 		if( NA_IS_OBJECT_ITEM( serializable )){
 			read_start_read_subitems_key( reader, NA_OBJECT_ITEM( serializable ), ( NadpReaderData * ) reader_data, messages );
 		}
+
+		if( NA_IS_OBJECT_PROFILE( serializable )){
+			read_start_profile_attach_profile( reader, NA_OBJECT_PROFILE( serializable ), ( NadpReaderData * ) reader_data, messages );
+		}
 	}
 }
 
@@ -371,6 +375,12 @@ read_start_read_subitems_key( const NAIFactoryProvider *provider, NAObjectItem *
 	na_core_utils_slist_free( subitems );
 }
 
+static void
+read_start_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, NadpReaderData *reader_data, GSList **messages )
+{
+	na_object_attach_profile( reader_data->action, profile );
+}
+
 /*
  * reading any data from a desktop file requires:
  * - a NadpDesktopFile object which has been initialized with the .desktop file
@@ -515,10 +525,7 @@ nadp_reader_ifactory_provider_read_done( const NAIFactoryProvider *reader, void
 			read_done_action_read_profiles( reader, NA_OBJECT_ACTION( serializable ), ( NadpReaderData * ) reader_data, messages );
 		}
 
-		if( NA_IS_OBJECT_PROFILE( serializable )){
-			read_done_profile_attach_profile( reader, NA_OBJECT_PROFILE( serializable ), ( NadpReaderData * ) reader_data, messages );
-		}
-
+		g_debug( "%s: quitting for %s at %p", thisfn, G_OBJECT_TYPE_NAME( serializable ), ( void * ) serializable );
 	}
 }
 
@@ -580,9 +587,3 @@ read_done_action_load_profile( const NAIFactoryProvider *provider, NadpReaderDat
 			NA_IFACTORY_OBJECT( profile ),
 			messages );
 }
-
-static void
-read_done_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, NadpReaderData *reader_data, GSList **messages )
-{
-	na_object_attach_profile( reader_data->action, profile );
-}
diff --git a/src/io-gconf/nagp-gconf-provider.c b/src/io-gconf/nagp-gconf-provider.c
index d18cd36..4022b8f 100644
--- a/src/io-gconf/nagp-gconf-provider.c
+++ b/src/io-gconf/nagp-gconf-provider.c
@@ -240,7 +240,7 @@ ifactory_provider_iface_init( NAIFactoryProviderInterface *iface )
 	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
 
 	iface->get_version = ifactory_provider_get_version;
-	iface->read_start = NULL;
+	iface->read_start = nagp_reader_read_start;
 	iface->read_data = nagp_reader_read_data;
 	iface->read_done = nagp_reader_read_done;
 	iface->write_start = nagp_writer_write_start;
diff --git a/src/io-gconf/nagp-reader.c b/src/io-gconf/nagp-reader.c
index 24e3cba..a788252 100644
--- a/src/io-gconf/nagp-reader.c
+++ b/src/io-gconf/nagp-reader.c
@@ -55,15 +55,12 @@ typedef struct {
 
 static NAObjectItem *read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages );
 
+static void          read_start_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, ReaderData *data, GSList **messages );
+
 static gboolean      read_done_item_is_writable( const NAIFactoryProvider *provider, NAObjectItem *item, ReaderData *data, GSList **messages );
 static void          read_done_action_read_profiles( const NAIFactoryProvider *provider, NAObjectAction *action, ReaderData *data, GSList **messages );
 static void          read_done_action_load_profile( const NAIFactoryProvider *provider, ReaderData *data, const gchar *path, GSList **messages );
-static void          read_done_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, ReaderData *data, GSList **messages );
 
-static gboolean      convert_pre_v3_parameters( NAObjectProfile *profile );
-static gboolean      convert_pre_v3_parameters_str( gchar *str );
-static gboolean      convert_pre_v3_multiple( NAObjectProfile *profile );
-static gboolean      convert_pre_v3_isfiledir( NAObjectProfile *profile );
 static NADataBoxed  *get_boxed_from_path( const NagpGConfProvider *provider, const gchar *path, ReaderData *reader_data, const NADataDef *def );
 static gboolean      is_key_writable( NagpGConfProvider *gconf, const gchar *key );
 
@@ -168,6 +165,36 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
 	return( item );
 }
 
+void
+nagp_reader_read_start( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages  )
+{
+	static const gchar *thisfn = "nagp_reader_read_start";
+
+	g_return_if_fail( NA_IS_IFACTORY_PROVIDER( provider ));
+	g_return_if_fail( NAGP_IS_GCONF_PROVIDER( provider ));
+	g_return_if_fail( NA_IS_IFACTORY_OBJECT( object ));
+
+	if( !NAGP_GCONF_PROVIDER( provider )->private->dispose_has_run ){
+
+		g_debug( "%s: provider=%p (%s), reader_data=%p, object=%p (%s), messages=%p",
+				thisfn,
+				( void * ) provider, G_OBJECT_TYPE_NAME( provider ),
+				( void * ) reader_data,
+				( void * ) object, G_OBJECT_TYPE_NAME( object ),
+				( void * ) messages );
+
+		if( NA_IS_OBJECT_PROFILE( object )){
+			read_start_profile_attach_profile( provider, NA_OBJECT_PROFILE( object ), ( ReaderData * ) reader_data, messages );
+		}
+	}
+}
+
+static void
+read_start_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, ReaderData *data, GSList **messages )
+{
+	na_object_attach_profile( data->parent, profile );
+}
+
 NADataBoxed *
 nagp_reader_read_data( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, const NADataDef *def, GSList **messages )
 {
@@ -222,10 +249,6 @@ nagp_reader_read_done( const NAIFactoryProvider *provider, void *reader_data, co
 			read_done_action_read_profiles( provider, NA_OBJECT_ACTION( object ), ( ReaderData * ) reader_data, messages );
 		}
 
-		if( NA_IS_OBJECT_PROFILE( object )){
-			read_done_profile_attach_profile( provider, NA_OBJECT_PROFILE( object ), ( ReaderData * ) reader_data, messages );
-		}
-
 		g_debug( "%s: quitting for %s at %p", thisfn, G_OBJECT_TYPE_NAME( object ), ( void * ) object );
 	}
 }
@@ -322,221 +345,6 @@ read_done_action_load_profile( const NAIFactoryProvider *provider, ReaderData *d
 	g_free( profile_data );
 }
 
-static void
-read_done_profile_attach_profile( const NAIFactoryProvider *provider, NAObjectProfile *profile, ReaderData *data, GSList **messages )
-{
-	static const gchar *thisfn = "nagp_reader_read_done_attach_profile";
-	guint iversion;
-
-	g_debug( "%s: profile=%p", thisfn, ( void * ) profile );
-
-	na_object_attach_profile( data->parent, profile );
-
-	/* converts pre-v3 data
-	 */
-	iversion = na_object_get_iversion( data->parent );
-	g_debug( "%s: iversion=%d", thisfn, iversion );
-
-	if( iversion < 3 ){
-
-		if( convert_pre_v3_parameters( profile ) ||
-			convert_pre_v3_multiple( profile ) ||
-			convert_pre_v3_isfiledir( profile )){
-
-				na_object_set_iversion( data->parent, 3 );
-		}
-	}
-}
-
-/*
- * starting wih v3, parameters are relabeled
- *   pre-v3 parameters					post-v3 parameters
- *   ----------------------------		-----------------------------------
- *   									%b: (first) basename	(new)
- *   									%B: list of basenames	(was %m)
- *   									%c: count				(new)
- * 	 %d: (first) base directory			...................		(unchanged)
- * 										%D: list of base dir	(new)
- *   %f: (first) pathname				...................		(unchanged)
- *   									%F: list of pathnames	(was %M)
- *   %h: (first) hostname				...................		(unchanged)
- *   %m: list of basenames	-> %B		-						(removed)
- *   %M: list of pathnames	-> %F		-						(removed)
- *   									%n: (first) username	(was %U)
- *   %p: (first) port number			...................		(unchanged)
- *   %R: list of URIs		-> %U		-						(removed)
- *   %s: (first) scheme					...................		(unchanged)
- *   %u: (first) URI					...................		(unchanged)
- *   %U: (first) username	-> %n		%U: list of URIs		(was %R)
- *   									%w: (first) basename w/o ext.	(new)
- *   									%W: list of basenames w/o ext.	(new)
- *   									%x: (first) extension	(new)
- *   									%X: list of extensions	(new)
- *   %%: %								...................		(unchanged)
- *
- * For pre-v3 items,
- * - substitute %m with %B
- * - substitute %M with %F
- * - substitute %U with %n
- * - substitute %R with %U
- *
- * Note that pre-v3 items only have parameters in the command and path fields.
- * Are only located in 'profile' objects.
- * Are only found in GConf provider, as .desktop files have been simultaneously
- * introduced.
- *
- * As a recall of the dynamics of the reading when loading an action:
- *  - na_object_action_read_done: set action defaults
- *  - nagp_reader_read_done: read profiles
- *     >  na_object_profile_read_done: convert old parameters
- *
- * So, when converting v2 to v3 parameters in a v2 profile,
- * action already has its default values (including iversion=3)
- */
-static gboolean
-convert_pre_v3_parameters( NAObjectProfile *profile )
-{
-	gboolean path_changed, parms_changed;
-
-	gchar *path = na_object_get_path( profile );
-	path_changed = convert_pre_v3_parameters_str( path );
-	if( path_changed ){
-		na_object_set_path( profile, path );
-	}
-	g_free( path );
-
-	gchar *parms = na_object_get_parameters( profile );
-	parms_changed = convert_pre_v3_parameters_str( parms );
-	if( parms_changed ){
-		na_object_set_parameters( profile, parms );
-	}
-	g_free( parms );
-
-	return( path_changed || parms_changed );
-}
-
-static gboolean
-convert_pre_v3_parameters_str( gchar *str )
-{
-	gboolean changed;
-	gchar *iter = str;
-
-	changed = FALSE;
-	while(( iter = g_strstr_len( iter, strlen( iter ), "%" )) != NULL ){
-
-		g_debug( "convert_pre_v3_parameters_str: iter[1]='%c'", iter[1] );
-		switch( iter[1] ){
-
-			/* %m (list of basenames) becomes %B
-			 */
-			case 'm':
-				iter[1] = 'B';
-				changed = TRUE;
-				break;
-
-			/* %M (list of filenames) becomes %F
-			 */
-			case 'M':
-				iter[1] = 'F';
-				changed = TRUE;
-				break;
-
-			/* %U ((first) username) becomes %n
-			 */
-			case 'U':
-				iter[1] = 'n';
-				changed = TRUE;
-				break;
-
-			/* %R (list of URIs) becomes %U
-			 */
-			case 'R':
-				iter[1] = 'U';
-				changed = TRUE;
-				break;
-		}
-
-		iter += 2;
-	}
-
-	return( changed );
-}
-
-/*
- * default changes from accept_multiple=false
- *                   to selection_count>0
- */
-static gboolean
-convert_pre_v3_multiple( NAObjectProfile *profile )
-{
-	gboolean accept_multiple;
-	gchar *selection_count;
-
-	accept_multiple = na_object_is_multiple( profile );
-	selection_count = g_strdup( accept_multiple ? ">0" : "=1" );
-	na_object_set_selection_count( profile, selection_count );
-	g_free( selection_count );
-
-	return( TRUE );
-}
-
-/*
- * we may have file=true  and dir=false -> only files          -> all/allfiles
- *             file=false and dir=true  -> only dirs           -> inode/directory
- *             file=true  and dir=true  -> both files and dirs -> all/all
- *
- * we try to replace this with the corresponding mimetype, but only if
- * current mimetype is '*' (or * / * or all/all)
- */
-static gboolean
-convert_pre_v3_isfiledir( NAObjectProfile *profile )
-{
-	gboolean converted;
-	gboolean isfile, isdir;
-	GSList *mimetypes;
-
-	converted = FALSE;
-
-	if( na_icontext_is_all_mimetypes( NA_ICONTEXT( profile ))){
-		converted = TRUE;
-		mimetypes = NULL;
-
-		isfile = na_object_is_file( profile );
-		isdir = na_object_is_dir( profile );
-
-		if( isfile ){
-			if( isdir ){
-				/* both file and dir -> do not modify mimetypes
-				 */
-				converted = FALSE;
-			} else {
-				/* files only
-				 */
-				mimetypes = g_slist_prepend( NULL, g_strdup( "all/allfiles" ));
-			}
-		} else {
-			if( isdir ){
-				/* dir only
-				 */
-				mimetypes = g_slist_prepend( NULL, g_strdup( "inode/directory" ));
-			} else {
-				/* not files nor dir: this is an invalid case -> do not modify
-				 * mimetypes
-				 */
-				converted = FALSE;
-			}
-		}
-
-		if( converted ){
-			na_object_set_mimetypes( profile, mimetypes );
-		}
-
-		na_core_utils_slist_free( mimetypes );
-	}
-
-	return( converted );
-}
-
 static NADataBoxed *
 get_boxed_from_path( const NagpGConfProvider *provider, const gchar *path, ReaderData *reader_data, const NADataDef *def )
 {
diff --git a/src/io-gconf/nagp-reader.h b/src/io-gconf/nagp-reader.h
index fc3693e..33d629d 100644
--- a/src/io-gconf/nagp-reader.h
+++ b/src/io-gconf/nagp-reader.h
@@ -37,8 +37,9 @@ G_BEGIN_DECLS
 
 GList       *nagp_iio_provider_read_items( const NAIIOProvider *provider, GSList **messages );
 
-NADataBoxed *nagp_reader_read_data( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, const NADataDef *def, GSList **messages );
-void         nagp_reader_read_done( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages  );
+void         nagp_reader_read_start( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages  );
+NADataBoxed *nagp_reader_read_data ( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, const NADataDef *def, GSList **messages );
+void         nagp_reader_read_done ( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages  );
 
 G_END_DECLS
 



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