[nautilus-actions] NAXMLReader: make sure we have at least one profile attached to the action



commit d3613b627c5ea1cbb00831bd79f29fc47db5bed2
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Dec 9 10:20:06 2011 +0100

    NAXMLReader: make sure we have at least one profile attached to the action

 ChangeLog                 |    3 +++
 src/io-xml/naxml-reader.c |   12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7e2944d..c71e201 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-12-09 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-xml/naxml-reader.c (read_done_action_read_profiles):
+	Make sure we have at least one profile attached to the action.
+
 	* src/io-gconf/nagp-reader.c (read_done_action_read_profiles):
 	Make sure we have at least one profile attached to the action.
 
diff --git a/src/io-xml/naxml-reader.c b/src/io-xml/naxml-reader.c
index d3f51db..d5c9673 100644
--- a/src/io-xml/naxml-reader.c
+++ b/src/io-xml/naxml-reader.c
@@ -827,8 +827,10 @@ read_done_item_set_localized_icon( NAXMLReader *reader, NAObjectItem *item )
 static void
 read_done_action_read_profiles( NAXMLReader *reader, NAObjectAction *action )
 {
+	static const gchar *thisfn = "naxml_reader_read_done_action_read_profiles";
 	GSList *order, *ip;
 	gchar *profile_id;
+	NAObjectProfile *profile;
 
 	if( !na_object_get_items_count( reader->private->parms->imported )){
 
@@ -853,6 +855,14 @@ read_done_action_read_profiles( NAXMLReader *reader, NAObjectAction *action )
 			}
 		}
 	}
+
+	/* make sure we have at least one profile attached to the action
+	 */
+	if( !na_object_get_items_count( action )){
+		g_warning( "%s: no profile found in .xml file", thisfn );
+		profile = na_object_profile_new_with_defaults();
+		na_object_attach_profile( action, profile );
+	}
 }
 
 /*
@@ -899,7 +909,7 @@ read_done_action_load_profile( NAXMLReader *reader, const gchar *profile_id )
 {
 	/*g_debug( "naxml_reader_read_done_action_load_profile: profile_id=%s", profile_id );*/
 
-	NAObjectProfile *profile = na_object_profile_new();
+	NAObjectProfile *profile = na_object_profile_new_with_defaults();
 
 	na_object_set_id( profile, profile_id );
 



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