[recipes] Avoid error underline on placeholder



commit ec09aea77d7a50a639830e65e167d33a60e72ab9
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 27 18:32:45 2017 -0400

    Avoid error underline on placeholder
    
    When the unit entry is empty, we show a placeholder, and
    it looks just wrong ot apply an error underline to it.

 src/gr-ingredients-viewer-row.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gr-ingredients-viewer-row.c b/src/gr-ingredients-viewer-row.c
index 2a3ed91..1651fbd 100644
--- a/src/gr-ingredients-viewer-row.c
+++ b/src/gr-ingredients-viewer-row.c
@@ -402,8 +402,12 @@ save_unit (GrIngredientsViewerRow *row)
 
         visible = gtk_stack_get_visible_child (GTK_STACK (row->unit_stack));
         if (visible == row->unit_entry) {
-                if (!parse_unit (gtk_entry_get_text (GTK_ENTRY (row->unit_entry)), &row->amount, 
&row->unit)) {
-                        set_unit_error (row, TRUE);
+                const char *text;
+
+                text = gtk_entry_get_text (GTK_ENTRY (row->unit_entry));
+                if (!parse_unit (text, &row->amount, &row->unit)) {
+                        if (text && *text)
+                                set_unit_error (row, TRUE);
                 }
 
                 update_unit (row);


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