[recipes/inline-editing] More tweaks



commit 53d196a246f303157aeeeb3b4b5f00166e76c5d3
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Apr 26 05:17:34 2017 -0400

    More tweaks

 src/gr-ingredients-viewer-row.c  |   13 +++++++++++--
 src/gr-ingredients-viewer-row.ui |    8 +++-----
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/gr-ingredients-viewer-row.c b/src/gr-ingredients-viewer-row.c
index 8020584..0d97273 100644
--- a/src/gr-ingredients-viewer-row.c
+++ b/src/gr-ingredients-viewer-row.c
@@ -131,11 +131,13 @@ update_unit (GrIngredientsViewerRow *row)
 {
         g_autofree char *tmp = NULL;
         const char *amount;
+        const char *space;
         const char *unit;
 
         amount = row->amount ? row->amount : "";
+        space = amount[0] ? " " : "";
         unit = row->unit ? row->unit : "";
-        tmp = g_strdup_printf ("%s %s", amount, unit);
+        tmp = g_strdup_printf ("%s%s%s", amount, space, unit);
         gtk_label_set_label (GTK_LABEL (row->unit_label), tmp);
 }
 
@@ -253,8 +255,15 @@ static void
 edit_ingredient (GrIngredientsViewerRow *row)
 {
         g_autofree char *tmp = NULL;
+        const char *amount;
+        const char *space;
+        const char *unit;
+
+        amount = row->amount ? row->amount : "";
+        space = amount[0] ? " " : "";
+        unit = row->unit ? row->unit : "";
+        tmp = g_strdup_printf ("%s%s%s", amount, space, unit);
 
-        tmp = g_strconcat (row->amount ? row->amount : "", " ", row->unit, NULL);
         gtk_entry_set_text (GTK_ENTRY (row->unit_entry), tmp);
         gtk_entry_set_text (GTK_ENTRY (row->ingredient_entry), row->ingredient);
 
diff --git a/src/gr-ingredients-viewer-row.ui b/src/gr-ingredients-viewer-row.ui
index d72d721..ddd31c0 100644
--- a/src/gr-ingredients-viewer-row.ui
+++ b/src/gr-ingredients-viewer-row.ui
@@ -28,9 +28,8 @@
               <object class="GtkEntry" id="unit_entry">
                 <property name="visible">1</property>
                 <property name="xalign">0</property>
-                <property name="placeholder-text" translatable="yes">Amount Unit</property>
+                <property name="placeholder-text" translatable="yes">Amount</property>
                 <property name="width-chars">10</property>
-                <property name="max-length">10</property>
                 <signal name="activate" handler="save_row" swapped="yes"/>
               </object>
               <packing>
@@ -46,8 +45,7 @@
               <object class="GtkLabel" id="ingredient_label">
                 <property name="visible">1</property>
                 <property name="xalign">0</property>
-                <property name="width-chars">10</property>
-                <property name="width-chars">10</property>
+                <property name="width-chars">20</property>
               </object>
               <packing>
                 <property name="name">ingredient_label</property>
@@ -57,7 +55,7 @@
               <object class="GtkEntry" id="ingredient_entry">
                 <property name="visible">1</property>
                 <property name="xalign">0</property>
-                <property name="width-chars">10</property>
+                <property name="width-chars">20</property>
                 <property name="placeholder-text" translatable="yes">Ingredient</property>
                 <signal name="activate" handler="save_row" swapped="yes"/>
               </object>


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