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



commit a5e34aff8ce263939a3e98d53207d16b773e8f47
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon May 17 06:28:21 2010 +0200

    Desktop: do not reload already loaded profiles

 ChangeLog                    |    4 ++++
 src/io-desktop/nadp-reader.c |   25 ++++++++++++-------------
 2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6e862be..e95ba5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-05-17 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-desktop/nadp-reader.c (read_done_load_profiles):
+	Do not reload already loaded profiles.
+	Just ignore non-referenced profiles.
+
 	* src/io-gconf/nagp-reader.c
 	(read_done_action_load_profiles_from_list): Do not reload already loaded profiles.
 
diff --git a/src/io-desktop/nadp-reader.c b/src/io-desktop/nadp-reader.c
index 8a13ff5..a90353e 100644
--- a/src/io-desktop/nadp-reader.c
+++ b/src/io-desktop/nadp-reader.c
@@ -506,29 +506,28 @@ read_subitems_key( const NAIFactoryProvider *provider, NAObjectItem *item, NadpR
 	na_core_utils_slist_free( subitems );
 }
 
+/*
+ * read and attach profiles in the specified order
+ * profiles which may exist in .desktop files, but are not referenced
+ * in the 'Profiles' string list are just ignored
+ */
 static void
 read_done_load_profiles( const NAIFactoryProvider *provider, NAObjectAction *action, NadpReaderData *reader_data, GSList **messages )
 {
 	GSList *order;
-	GSList *list_profiles;
 	GSList *ip;
+	gchar *profile_id;
+	NAObjectId *found;
 
 	reader_data->action = action;
 	order = na_object_get_items_slist( action );
-	list_profiles = nadp_desktop_file_get_profiles( reader_data->ndf );
 
-	/* read profiles in the specified order
-	 */
 	for( ip = order ; ip ; ip = ip->next ){
-		read_done_action_load_profile( provider, reader_data, ( const gchar * ) ip->data, messages );
-		list_profiles = na_core_utils_slist_remove_ascii( list_profiles, ( const gchar * ) ip->data );
-	}
-
-	/* append other profiles
-	 * this is mandatory for pre-2.29 actions which introduced order of profiles
-	 */
-	for( ip = list_profiles ; ip ; ip = ip->next ){
-		read_done_action_load_profile( provider, reader_data, ( const gchar * ) ip->data, messages );
+		profile_id = ( gchar * ) ip->data;
+		found = na_object_get_item( action, profile_id );
+		if( !found ){
+			read_done_action_load_profile( provider, reader_data, profile_id, messages );
+		}
 	}
 }
 



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