[gimp] app: trim out trailing whitespaces from item names.



commit 123c605da7ece9809421a5ebca83604dca77ed2c
Author: Jehan <jehan girinstud io>
Date:   Wed Jun 17 00:50:04 2015 +0200

    app: trim out trailing whitespaces from item names.
    
    Trailing whitespaces are a bother because they are not easily spotted
    and there are no good reasons to have any on an item name.

 app/core/gimpitemtree.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpitemtree.c b/app/core/gimpitemtree.c
index 601304e..6cb8dc7 100644
--- a/app/core/gimpitemtree.c
+++ b/app/core/gimpitemtree.c
@@ -646,6 +646,14 @@ gimp_item_tree_uniquefy_name (GimpItemTree *tree,
       gimp_object_set_name (GIMP_OBJECT (item), new_name);
     }
 
+  /* Remove any trailing whitespace. */
+  if (gimp_object_get_name (item))
+    {
+      gchar *name = g_strchomp (g_strdup (gimp_object_get_name (item)));
+
+      gimp_object_take_name (GIMP_OBJECT (item), name);
+    }
+
   if (g_hash_table_lookup (private->name_hash,
                            gimp_object_get_name (item)))
     {


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