[nautilus-actions] Only writes in GConf non empty values



commit bcb6c62d91f709f4efc6bff24796ae8183dc3f70
Author: pierre <pierre vfedora10 virtuals pwi>
Date:   Mon Mar 1 13:58:35 2010 +0100

    Only writes in GConf non empty values

 ChangeLog                  |    6 ++++++
 src/io-gconf/nagp-reader.c |    5 +++--
 src/io-gconf/nagp-writer.c |   31 +++++++++++++++++++++++--------
 3 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c5f8c1e..d52100d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-03-01 Pierre Wieser <pwieser trychlos org>
 
+	* src/io-gconf/nagp-reader.c (read_done_item):
+	Only action needs to setup the parent pointer.
+
+	* src/io-gconf/nagp-writer.c (nagp_writer_write_data):
+	Only writes non-empty values.
+
 	* src/core/na-object.c (na_object_object_reset_origin):
 	No more check for the value of object origin before resetting it.
 
diff --git a/src/io-gconf/nagp-reader.c b/src/io-gconf/nagp-reader.c
index 31b37e0..8d35b4d 100644
--- a/src/io-gconf/nagp-reader.c
+++ b/src/io-gconf/nagp-reader.c
@@ -249,8 +249,8 @@ read_done_item( const NAIFactoryProvider *provider, NAObjectItem *item, ReaderDa
 	GConfEntry *gconf_entry;
 	const gchar *key;
 
-	data->parent = item;
-
+	/* check for writability of this item
+	 */
 	entries = na_gconf_utils_get_entries( NAGP_GCONF_PROVIDER( provider )->private->gconf, data->path );
 
 	writable = TRUE;
@@ -272,6 +272,7 @@ read_done_action( const NAIFactoryProvider *provider, NAObjectAction *action, Re
 	GSList *ip;
 	gchar *profile_path;
 
+	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 );
 
diff --git a/src/io-gconf/nagp-writer.c b/src/io-gconf/nagp-writer.c
index f260c47..70c8ba3 100644
--- a/src/io-gconf/nagp-writer.c
+++ b/src/io-gconf/nagp-writer.c
@@ -403,12 +403,25 @@ nagp_writer_write_data( const NAIFactoryProvider *provider, void *writer_data,
 	switch( def->type ){
 
 		case NAFD_TYPE_STRING:
+			str_value = na_data_boxed_get_as_string( boxed );
+			if( str_value && strlen( str_value )){
+				na_gconf_utils_write_string( gconf, path, str_value, &msg );
+				if( msg ){
+					*messages = g_slist_append( *messages, msg );
+					code = NA_IIO_PROVIDER_CODE_WRITE_ERROR;
+				}
+			}
+			g_free( str_value );
+			break;
+
 		case NAFD_TYPE_LOCALE_STRING:
 			str_value = na_data_boxed_get_as_string( boxed );
-			na_gconf_utils_write_string( gconf, path, str_value, &msg );
-			if( msg ){
-				*messages = g_slist_append( *messages, msg );
-				code = NA_IIO_PROVIDER_CODE_WRITE_ERROR;
+			if( str_value && g_utf8_strlen( str_value, -1 )){
+				na_gconf_utils_write_string( gconf, path, str_value, &msg );
+				if( msg ){
+					*messages = g_slist_append( *messages, msg );
+					code = NA_IIO_PROVIDER_CODE_WRITE_ERROR;
+				}
 			}
 			g_free( str_value );
 			break;
@@ -424,10 +437,12 @@ nagp_writer_write_data( const NAIFactoryProvider *provider, void *writer_data,
 
 		case NAFD_TYPE_STRING_LIST:
 			slist_value = ( GSList * ) na_data_boxed_get_as_void( boxed );
-			na_gconf_utils_write_string_list( gconf, path, slist_value, &msg );
-			if( msg ){
-				*messages = g_slist_append( *messages, msg );
-				code = NA_IIO_PROVIDER_CODE_WRITE_ERROR;
+			if( slist_value && g_slist_length( slist_value )){
+				na_gconf_utils_write_string_list( gconf, path, slist_value, &msg );
+				if( msg ){
+					*messages = g_slist_append( *messages, msg );
+					code = NA_IIO_PROVIDER_CODE_WRITE_ERROR;
+				}
 			}
 			na_core_utils_slist_free( slist_value );
 			break;



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