[nautilus-actions] Fix 'parent is not an action' error on XML import



commit faf58068ccfa476a990b36d0b38c59c0fe4362fd
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Aug 9 20:00:14 2010 +0200

    Fix 'parent is not an action' error on XML import
    
    Move profile attachment to the action from read_done() to read_start().

 ChangeLog                 |    3 +++
 src/io-xml/naxml-reader.c |   22 +++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 66d4a98..efcdd3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-08-09 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-xml/naxml-reader.c (naxml_reader_read_start):
+	Attach the profile to the action before trying to read it.
+
 	* src/nact/nact-iexecution-tab.c (execution_mode_toggle):
 	Fix sensitivity of startup fields vs. execution mode.
 
diff --git a/src/io-xml/naxml-reader.c b/src/io-xml/naxml-reader.c
index 060395d..6f6e8ae 100644
--- a/src/io-xml/naxml-reader.c
+++ b/src/io-xml/naxml-reader.c
@@ -155,10 +155,10 @@ static RootNodeStr st_root_node_str[] = {
 #define ERR_XMLDOC_UNABLE_TOPARSE	_( "Unable to parse XML file: %s." )
 #define WARN_UNDEALT_NODE			_( "Node %s at line %d has not been dealt with." )
 
+static void          read_start_profile_attach_profile( NAXMLReader *reader, NAObjectProfile *profile );
 static gboolean      read_data_is_path_adhoc_for_object( NAXMLReader *reader, const NAIFactoryObject *object, xmlChar *text );
 static NADataBoxed  *read_data_boxed_from_node( NAXMLReader *reader, xmlChar *text, xmlNode *parent, const NADataDef *def );
 static void          read_done_object_action( NAXMLReader *reader, NAObjectAction *action );
-static void          read_done_object_profile( NAXMLReader *reader, NAObjectProfile *profile );
 static gchar        *read_done_get_next_profile_id( NAXMLReader *reader );
 static void          read_done_load_profile( NAXMLReader *reader, const gchar *profile_id );
 
@@ -587,6 +587,16 @@ naxml_reader_read_start( const NAIFactoryProvider *provider, void *reader_data,
 			( void * ) reader_data,
 			( void * ) object, G_OBJECT_TYPE_NAME( object ),
 			( void * ) messages );
+
+	if( NA_IS_OBJECT_PROFILE( object )){
+		read_start_profile_attach_profile( NAXML_READER( reader_data ), NA_OBJECT_PROFILE( object ));
+	}
+}
+
+static void
+read_start_profile_attach_profile( NAXMLReader *reader, NAObjectProfile *profile )
+{
+	na_object_attach_profile( reader->private->parms->imported, profile );
 }
 
 /*
@@ -739,10 +749,6 @@ naxml_reader_read_done( const NAIFactoryProvider *provider, void *reader_data, c
 		read_done_object_action( NAXML_READER( reader_data ), NA_OBJECT_ACTION( object ));
 	}
 
-	if( NA_IS_OBJECT_PROFILE( object )){
-		read_done_object_profile( NAXML_READER( reader_data ), NA_OBJECT_PROFILE( object ));
-	}
-
 	g_debug( "%s: quitting for %s at %p", thisfn, G_OBJECT_TYPE_NAME( object ), ( void * ) object );
 }
 
@@ -784,12 +790,6 @@ read_done_object_action( NAXMLReader *reader, NAObjectAction *action )
 	}
 }
 
-static void
-read_done_object_profile( NAXMLReader *reader, NAObjectProfile *profile )
-{
-	na_object_attach_profile( reader->private->parms->imported, profile );
-}
-
 /*
  * return the first profile id found in the nodes
  */



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