[gnome-calculator] History view and equation entry styling (bgo#743499)



commit 246b7f08484a4f801880f6400df638acea6ce504
Author: Robert Roth <robert roth off gmail com>
Date:   Wed Oct 19 11:34:05 2016 +0300

    History view and equation entry styling (bgo#743499)

 data/calculator.css   |    9 ++++++++-
 data/history-entry.ui |   23 ++++++++++++++---------
 src/math-display.vala |    8 +++-----
 3 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/data/calculator.css b/data/calculator.css
index 7e9f85e..d12a00e 100644
--- a/data/calculator.css
+++ b/data/calculator.css
@@ -2,6 +2,13 @@
   border-width: 0 0 1px 0;
 }
 
+.sourceview {
+  padding: 0px 6px;
+}
+
+.equation-symbol {
+  padding: 0px 12px;
+}
 .math-buttons button {
 }
 
@@ -25,8 +32,8 @@
 .history-entry {
   background-color: @theme_bg_color;
   border-bottom: 1px groove @borders;
-  font-size: 0.75em;
   padding: 6px;
+  font-size: 0.90em;
 }
 
   .history-entry:last-child {
diff --git a/data/history-entry.ui b/data/history-entry.ui
index daed42f..e17ff77 100644
--- a/data/history-entry.ui
+++ b/data/history-entry.ui
@@ -5,8 +5,10 @@
   <template class="HistoryEntry" parent="GtkListBoxRow">
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkGrid" id="grid">
+      <object class="GtkGrid" id="Grid">
         <property name="visible">True</property>
+        <property name="margin_start">12</property>
+        <property name="margin_end">16</property>
         <property name="can_focus">False</property>
         <property name="column_homogeneous">True</property>
         <child>
@@ -22,6 +24,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="ellipsize">end</property>
+                <property name="xalign">0.0</property>
+                <property name="yalign">0.5</property>
                 <property name="max_width_chars">1</property>
               </object>
             </child>
@@ -29,24 +33,23 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">0</property>
-            <property name="width">4</property>
+            <property name="width">5</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="equation_symbol">
-            <property name="label"> = </property>
+            <property name="label">=</property>
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
-            <property name="xalign">0.0</property>
-            <property name="yalign">0.0</property>
-            <property name="max_width_chars">1</property>
+            <property name="xalign">0.5</property>
+            <property name="yalign">0.5</property>
+            <property name="max_width_chars">3</property>
             <style>
               <class name="equation-symbol"/>
             </style>
           </object>
           <packing>
-            <property name="left_attach">4</property>
+            <property name="left_attach">5</property>
             <property name="top_attach">0</property>
           </packing>
         </child>
@@ -63,6 +66,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="ellipsize">end</property>
+                <property name="xalign">1.0</property>
+                <property name="yalign">0.5</property>
                 <property name="max_width_chars">1</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
@@ -71,7 +76,7 @@
             </child>
           </object>
           <packing>
-            <property name="left_attach">5</property>
+            <property name="left_attach">6</property>
             <property name="top_attach">0</property>
             <property name="width">2</property>
           </packing>
diff --git a/src/math-display.vala b/src/math-display.vala
index 7a155fb..2f0f179 100644
--- a/src/math-display.vala
+++ b/src/math-display.vala
@@ -43,9 +43,7 @@ public class MathDisplay : Gtk.Viewport
         source_view.set_accepts_tab (false);
         source_view.set_pixels_above_lines (8);
         source_view.set_pixels_below_lines (2);
-        /* TEMP: Disabled for now as GTK+ doesn't properly render a right aligned right margin, see bug 
#482688 */
-        /*source_view.set_right_margin (6);*/
-        source_view.set_justification (Gtk.Justification.RIGHT);
+        source_view.set_justification (Gtk.Justification.LEFT);
 
         var style_context = source_view.get_style_context ();
         style_context.save ();
@@ -53,8 +51,9 @@ public class MathDisplay : Gtk.Viewport
         var font_desc = style_context.get_font (Gtk.StateFlags.NORMAL);
         style_context.restore ();
 
-        font_desc.set_size (16 * Pango.SCALE);
+        font_desc.set_size (15 * Pango.SCALE);
         source_view.override_font (font_desc);
+
         source_view.set_name ("displayitem");
         source_view.set_size_request (20, 20);
         source_view.get_accessible ().set_role (Atk.Role.EDITBAR);
@@ -73,7 +72,6 @@ public class MathDisplay : Gtk.Viewport
         info_view.set_wrap_mode (Gtk.WrapMode.WORD);
         info_view.set_can_focus (false);
         info_view.set_editable (false);
-        info_view.set_justification (Gtk.Justification.RIGHT);
         /* TEMP: Disabled for now as GTK+ doesn't properly render a right aligned right margin, see bug 
#482688 */
         /*info_view.set_right_margin (6);*/
         info_box.pack_start (info_view, true, true, 0);


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