[nautilus-actions] GConf: do not reload already loaded profiles



commit 6d3cd570d9f618bfad559ec10760f5f01163bc4d
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon May 17 06:18:20 2010 +0200

    GConf: do not reload already loaded profiles

 ChangeLog                  |    3 +++
 src/io-gconf/nagp-reader.c |   26 +++++++++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0fd5310..6e862be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-05-17 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-gconf/nagp-reader.c
+	(read_done_action_load_profiles_from_list): Do not reload already loaded profiles.
+
 	* src/utils/nautilus-actions-new.c:
 	Factorize error message to make translation easier.
 
diff --git a/src/io-gconf/nagp-reader.c b/src/io-gconf/nagp-reader.c
index 793c086..489d274 100644
--- a/src/io-gconf/nagp-reader.c
+++ b/src/io-gconf/nagp-reader.c
@@ -248,28 +248,40 @@ read_done_action_load_profiles_from_list( const NAIFactoryProvider *provider, NA
 	GSList *order;
 	GSList *list_profiles;
 	GSList *ip;
+	gchar *profile_id;
 	gchar *profile_path;
+	NAObjectId *found;
 
 	data->parent = NA_OBJECT_ITEM( action );
 	order = na_object_get_items_slist( action );
 	list_profiles = na_gconf_utils_get_subdirs( NAGP_GCONF_PROVIDER( provider )->private->gconf, data->path );
 
 	/* read profiles in the specified order
+	 * as a protection against bugs in NACT, we check that profile has not
+	 * already been loaded
 	 */
 	for( ip = order ; ip ; ip = ip->next ){
-		profile_path = gconf_concat_dir_and_key( data->path, ( gchar * ) ip->data );
-		g_debug( "nagp_reader_read_done_action: loading profile=%s", ( gchar * ) ip->data );
-		read_done_action_load_profile( provider, data, profile_path, messages );
-		list_profiles = na_core_utils_slist_remove_ascii( list_profiles, profile_path );
-		g_free( profile_path );
+		profile_id = ( gchar * ) ip->data;
+		found = na_object_get_item( action, profile_id );
+		if( !found ){
+			g_debug( "nagp_reader_read_done_action: loading profile=%s", profile_id );
+			profile_path = gconf_concat_dir_and_key( data->path, profile_id );
+			read_done_action_load_profile( provider, data, profile_path, messages );
+			g_free( profile_path );
+		}
 	}
 
 	/* append other profiles
 	 * this is mandatory for pre-2.29 actions which introduced order of profiles
 	 */
 	for( ip = list_profiles ; ip ; ip = ip->next ){
-		g_debug( "nagp_reader_read_done_action: loading profile=%s", ( gchar * ) ip->data );
-		read_done_action_load_profile( provider, data, ( const gchar * ) ip->data, messages );
+		profile_id = g_path_get_basename(( const gchar * ) ip->data );
+		found = na_object_get_item( action, profile_id );
+		if( !found ){
+			g_debug( "nagp_reader_read_done_action: loading profile=%s", profile_id );
+			read_done_action_load_profile( provider, data, ( const gchar * ) ip->data, messages );
+		}
+		g_free( profile_id );
 	}
 }
 



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