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



commit c640ccf6eb8a6bdea43f5788c842dad8394ec18b
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Dec 9 10:10:25 2011 +0100

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

 ChangeLog                  |    3 +++
 src/io-gconf/nagp-reader.c |   10 ++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b85757b..7e2944d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-12-09 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-gconf/nagp-reader.c (read_done_action_read_profiles):
+	Make sure we have at least one profile attached to the action.
+
 	* src/io-desktop/nadp-desktop-file.c:
 	* src/io-desktop/nadp-desktop-file.h (nadp_desktop_file_has_profile):
 	New function.
diff --git a/src/io-gconf/nagp-reader.c b/src/io-gconf/nagp-reader.c
index 57ff716..bbd49c8 100644
--- a/src/io-gconf/nagp-reader.c
+++ b/src/io-gconf/nagp-reader.c
@@ -279,12 +279,14 @@ read_done_item_is_writable( const NAIFactoryProvider *provider, NAObjectItem *it
 static void
 read_done_action_read_profiles( const NAIFactoryProvider *provider, NAObjectAction *action, ReaderData *data, GSList **messages )
 {
+	static const gchar *thisfn = "nagp_reader_read_done_action_read_profiles";
 	GSList *order;
 	GSList *list_profiles;
 	GSList *ip;
 	gchar *profile_id;
 	gchar *profile_path;
 	NAObjectId *found;
+	NAObjectProfile *profile;
 
 	data->parent = NA_OBJECT_ITEM( action );
 	order = na_object_get_items_slist( action );
@@ -317,6 +319,14 @@ read_done_action_read_profiles( const NAIFactoryProvider *provider, NAObjectActi
 		}
 		g_free( profile_id );
 	}
+
+	/* make sure we have at least one profile
+	 */
+	if( !na_object_get_items_count( action )){
+		g_warning( "%s: no profile found in GConf backend", thisfn );
+		profile = na_object_profile_new_with_defaults();
+		na_object_attach_profile( action, profile );
+	}
 }
 
 static void



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