[gthumb] rename_series: remove the spaces from the attribute id



commit 30f001118dccce448c5bc53da23db68204ad32cc
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Apr 3 19:05:04 2011 +0200

    rename_series: remove the spaces from the attribute id

 extensions/rename_series/dlg-rename-series.c |   13 ++++++++++---
 gthumb/gth-main.c                            |    2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/extensions/rename_series/dlg-rename-series.c b/extensions/rename_series/dlg-rename-series.c
index fc84ae7..0e1c474 100644
--- a/extensions/rename_series/dlg-rename-series.c
+++ b/extensions/rename_series/dlg-rename-series.c
@@ -349,8 +349,10 @@ get_required_attributes (DialogData *data)
 				    SORT_DATA_COLUMN, &sort_type,
 				    -1);
 
-		g_string_append (required_attributes, ",");
-		g_string_append (required_attributes, sort_type->required_attributes);
+		if ((sort_type->required_attributes != NULL) && ! g_str_equal (sort_type->required_attributes, "")) {
+			g_string_append (required_attributes, ",");
+			g_string_append (required_attributes, sort_type->required_attributes);
+		}
 	}
 
 	/* attributes required for renaming */
@@ -365,8 +367,13 @@ get_required_attributes (DialogData *data)
 		re = g_regex_new ("%A\\{([^}]+)\\}", 0, 0, NULL);
 		a = g_regex_split (re, template, 0);
 		for (i = 1; i < g_strv_length (a); i += 2) {
+			char *id;
+
+			id = g_strstrip (g_strdup (a[i]));
 			g_string_append (required_attributes, ",");
-			g_string_append (required_attributes, a[i]);
+			g_string_append (required_attributes, id);
+
+			g_free (id);
 		}
 
 		g_strfreev (a);
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 1d1363d..23db90e 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -1347,7 +1347,7 @@ attribute_list_reload_required (const char *old_attributes,
 	new_attributes_len = g_strv_length (new_attributes_v);
 
 	for (i = 0; i < new_attributes_len; i++) {
-		if (_g_file_attributes_matches_any (new_attributes_v[i], GIO_ATTRIBUTES)) {
+		if (_g_utf8_all_spaces (new_attributes_v[i]) || _g_file_attributes_matches_any (new_attributes_v[i], GIO_ATTRIBUTES)) {
 			g_free (new_attributes_v[i]);
 			new_attributes_v[i] = NULL;
 		}



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