[recipes/inline-editing] Remove leading and trailing spaces from unit_entry



commit a33d854220b2dbf3a0fbf8b35ce26b19e1b81368
Author: Ekta Nandwani <mailnandwaniekta gmail com>
Date:   Wed Apr 26 01:38:45 2017 +0530

    Remove leading and trailing spaces from  unit_entry
    
    This allows the unit_entry to split in amount and unit by removing spaces

 src/gr-ingredients-viewer-row.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-ingredients-viewer-row.c b/src/gr-ingredients-viewer-row.c
index 77cf607..56b2722 100644
--- a/src/gr-ingredients-viewer-row.c
+++ b/src/gr-ingredients-viewer-row.c
@@ -264,7 +264,8 @@ edit_ingredient (GrIngredientsViewerRow *row)
 static void
 save_row (GrIngredientsViewerRow *row)
 {
-        char** strv = g_strsplit (gtk_entry_get_text (GTK_ENTRY (row->unit_entry)), " ", -1);
+        g_autofree char *tmp = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (row->unit_entry))));
+        char** strv = g_strsplit (tmp, " ", -1);
 
         row->amount = strv[0];
         row->unit = strv[1];


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