[nautilus-actions] Fix default value test



commit ef30b689c0db5b97b0c321db1f6c020501aaec1a
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Feb 20 10:59:19 2011 +0100

    Fix default value test

 ChangeLog                |    5 +++++
 src/core/na-data-boxed.c |   11 +++++------
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 865c343..c776ae1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-20 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-data-boxed.c (string_is_default, string_list_is_default,
+	locale_is_default): Fix default value test.
+
 2011-02-19 Pierre Wieser <pwieser trychlos org>
 
 	* src/api/na-object-api.h (na_object_set_isfile, na_object_set_isdir,
diff --git a/src/core/na-data-boxed.c b/src/core/na-data-boxed.c
index f8a6fc0..2b875bf 100644
--- a/src/core/na-data-boxed.c
+++ b/src/core/na-data-boxed.c
@@ -672,7 +672,7 @@ string_is_default( const NADataBoxed *boxed )
 	gboolean is_default = FALSE;
 	gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
 
-	if( boxed->private->data_def->default_value ){
+	if( boxed->private->data_def->default_value && strlen( boxed->private->data_def->default_value )){
 		if( value && strlen( value )){
 			/* default value is not null and string has something */
 			is_default = ( strcmp( value, boxed->private->data_def->default_value ) == 0 );
@@ -682,7 +682,7 @@ string_is_default( const NADataBoxed *boxed )
 			is_default = FALSE;
 		}
 
-	} else if( value ){
+	} else if( value && strlen( value )){
 		/* default value is null, but string has something */
 		is_default = FALSE;
 
@@ -728,7 +728,7 @@ string_list_is_default( const NADataBoxed *boxed )
 	gboolean is_default = FALSE;
 	gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
 
-	if( boxed->private->data_def->default_value ){
+	if( boxed->private->data_def->default_value && strlen( boxed->private->data_def->default_value )){
 		if( value && strlen( value )){
 			is_default = ( strcmp( value, boxed->private->data_def->default_value ) == 0 );
 		} else {
@@ -736,7 +736,6 @@ string_list_is_default( const NADataBoxed *boxed )
 		}
 	} else if( value && strlen( value )){
 		is_default = FALSE;
-
 	} else {
 		is_default = TRUE;
 	}
@@ -767,7 +766,7 @@ locale_is_default( const NADataBoxed *boxed )
 	gboolean is_default = FALSE;
 	gchar *value = na_boxed_get_string( NA_BOXED( boxed ));
 
-	if( boxed->private->data_def->default_value ){
+	if( boxed->private->data_def->default_value && g_utf8_strlen( boxed->private->data_def->default_value, -1 )){
 		if( value && strlen( value )){
 			/* default value is not null and string has something */
 			is_default = ( na_core_utils_str_collate( value, boxed->private->data_def->default_value ) == 0 );
@@ -776,7 +775,7 @@ locale_is_default( const NADataBoxed *boxed )
 			/* default value is not null, but string is null */
 			is_default = FALSE;
 		}
-	} else if( value ){
+	} else if( value && g_utf8_strlen( value, -1 )){
 		/* default value is null, but string has something */
 		is_default = FALSE;
 



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