[gnome-calculator] Fixed conversion user interface for LTR (bgo#711587)



commit ac3d1624d33867086980f822a5b502c596daa401
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Oct 21 20:00:22 2016 +0300

    Fixed conversion user interface for LTR (bgo#711587)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748732

 data/math-converter.ui  |   60 +++++++++++++++++++++++++++++++++++++++-------
 src/math-converter.vala |    8 ++++--
 2 files changed, 56 insertions(+), 12 deletions(-)
---
diff --git a/data/math-converter.ui b/data/math-converter.ui
index 391f604..8172ede 100644
--- a/data/math-converter.ui
+++ b/data/math-converter.ui
@@ -69,22 +69,64 @@
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="result_label">
+      <object class="GtkBox" id="result_holder">
         <property name="visible">True</property>
-        <property name="sensitive">False</property>
+        <property name="orientation">horizontal</property>
+        <property name="sensitive">True</property>
+        <property name="spacing">6</property>
         <property name="can_focus">False</property>
         <property name="halign">end</property>
         <property name="valign">center</property>
         <property name="hexpand">True</property>
         <property name="vexpand">False</property>
-        <property name="justify">center</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
+        <child>
+          <object class="GtkLabel" id="from_label">
+            <property name="visible">True</property>
+            <property name="sensitive">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">False</property>
+            <property name="justify">center</property>
+            <property name="xalign">0</property>
+            <property name="yalign">0</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="convert_equals">
+            <property name="visible">True</property>
+            <property name="sensitive">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">center</property>
+            <property name="valign">center</property>
+            <property name="hexpand">False</property>
+            <property name="vexpand">False</property>
+            <property name="justify">center</property>
+            <property name="xalign">0</property>
+            <property name="yalign">0</property>
+            <property name="label" translatable="yes" context="convertion equals label">=</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="to_label">
+            <property name="visible">True</property>
+            <property name="sensitive">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">end</property>
+            <property name="valign">center</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">False</property>
+            <property name="justify">center</property>
+            <property name="xalign">0</property>
+            <property name="yalign">0</property>
+          </object>
+          <packing>
+            <property name="expand">false</property>
+            <property name="fill">true</property>
+          </packing>
+        </child>
       </object>
-      <packing>
-        <property name="left_attach">4</property>
-        <property name="top_attach">0</property>
-      </packing>
     </child>
   </template>
 </interface>
diff --git a/src/math-converter.vala b/src/math-converter.vala
index 8243861..0cf90ac 100644
--- a/src/math-converter.vala
+++ b/src/math-converter.vala
@@ -23,7 +23,9 @@ public class MathConverter : Gtk.Grid
     [GtkChild]
     private Gtk.ComboBox to_combo;
     [GtkChild]
-    private Gtk.Label result_label;
+    private Gtk.Label from_label;
+    [GtkChild]
+    private Gtk.Label to_label;
 
     public signal void changed ();
 
@@ -101,7 +103,6 @@ public class MathConverter : Gtk.Grid
             return;
 
         var z = convert_equation (x);
-        result_label.sensitive = z != null;
         if (z != null)
         {
             Unit source_unit, target_unit;
@@ -109,7 +110,8 @@ public class MathConverter : Gtk.Grid
 
             var source_text = source_unit.format (x);
             var target_text = target_unit.format (z);
-            result_label.set_text ("%s = %s".printf (source_text, target_text));
+            from_label.set_text (source_text);
+            to_label.set_text (target_text);
         }
     }
 


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