[nautilus-actions] nagp_reader_get_boxed_from_path: only allocate a new box for a non-null value



commit 8f23575699dcedadc6d797200a9d82bb68ccb5f5
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jun 10 20:36:07 2011 +0200

    nagp_reader_get_boxed_from_path: only allocate a new box for a non-null value
    
    This fix the error when importing a item from GConf.

 ChangeLog                  |    3 +++
 src/io-gconf/nagp-reader.c |    9 ++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a00ccad..bdb9234 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-06-10 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-gconf/nagp-reader.c (get_boxed_from_path):
+	Only allocate a new box when a non-null value has been read.
+
 	* src/core/na-settings.c (read_key_value_from_key_file):
 	Also dump the value read from a key file.
 
diff --git a/src/io-gconf/nagp-reader.c b/src/io-gconf/nagp-reader.c
index f8fdc23..57ff716 100644
--- a/src/io-gconf/nagp-reader.c
+++ b/src/io-gconf/nagp-reader.c
@@ -74,7 +74,7 @@ static gboolean      is_key_writable( NagpGConfProvider *gconf, const gchar *key
 GList *
 nagp_iio_provider_read_items( const NAIIOProvider *provider, GSList **messages )
 {
-	static const gchar *thisfn = "nagp_gconf_provider_iio_provider_read_items";
+	static const gchar *thisfn = "nagp_reader_nagp_iio_provider_read_items";
 	NagpGConfProvider *self;
 	GList *items_list = NULL;
 	GSList *listpath, *ip;
@@ -112,7 +112,7 @@ nagp_iio_provider_read_items( const NAIIOProvider *provider, GSList **messages )
 static NAObjectItem *
 read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
 {
-	static const gchar *thisfn = "nagp_gconf_provider_read_item";
+	static const gchar *thisfn = "nagp_reader_read_item";
 	NAObjectItem *item;
 	gchar *full_path;
 	gchar *type;
@@ -129,7 +129,7 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
 	g_free( full_path );
 	item = NULL;
 
-	/* a menu may have 'Action' or 'Menu' type ; defaults to Action
+	/* an item may have 'Action' or 'Menu' type; defaults to Action
 	 */
 	if( !type || !strlen( type ) || !strcmp( type, NAGP_VALUE_TYPE_ACTION )){
 		item = NA_OBJECT_ITEM( na_object_action_new());
@@ -358,19 +358,18 @@ get_boxed_from_path( const NagpGConfProvider *provider, const gchar *path, Reade
 	gint int_value;
 
 	boxed = NULL;
-	boxed = na_data_boxed_new( def );
 	have_entry = na_gconf_utils_has_entry( reader_data->entries, def->gconf_entry );
 	g_debug( "%s: entry=%s, have_entry=%s", thisfn, def->gconf_entry, have_entry ? "True":"False" );
 
 	if( have_entry ){
 		gchar *entry_path = gconf_concat_dir_and_key( path, def->gconf_entry );
+		boxed = na_data_boxed_new( def );
 
 		switch( def->type ){
 
 			case NA_DATA_TYPE_STRING:
 			case NA_DATA_TYPE_LOCALE_STRING:
 				str_value = na_gconf_utils_read_string( provider->private->gconf, entry_path, TRUE, NULL );
-				g_debug( "%s: entry=%s, value=%s", thisfn, def->gconf_entry, str_value );
 				na_boxed_set_from_string( NA_BOXED( boxed ), str_value );
 				g_free( str_value );
 				break;



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