[gnome-calculator] Changed history style and added CSS classes. Bug 743499
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Changed history style and added CSS classes. Bug 743499
- Date: Wed, 19 Oct 2016 07:05:37 +0000 (UTC)
commit 6a8edb043364af9a92e22a0ae648aab5abe4bc16
Author: Niels De Graef <nielsdegraef gmail com>
Date: Wed Jun 8 01:18:06 2016 +0200
Changed history style and added CSS classes. Bug 743499
Signed-off-by: Niels De Graef <nielsdegraef gmail com>
data/calculator.css | 21 +++++++++++++++++++++
data/history-entry.ui | 32 ++++++++++++++++++++++++++++++--
src/math-history.vala | 4 ++--
3 files changed, 53 insertions(+), 4 deletions(-)
---
diff --git a/data/calculator.css b/data/calculator.css
index 625cbd6..7e9f85e 100644
--- a/data/calculator.css
+++ b/data/calculator.css
@@ -22,3 +22,24 @@
.bit-marker-label {
}
+.history-entry {
+ background-color: @theme_bg_color;
+ border-bottom: 1px groove @borders;
+ font-size: 0.75em;
+ padding: 6px;
+}
+
+ .history-entry:last-child {
+ border-width: 0px;
+ }
+
+ .history-entry .equation-label {
+ /* word-spacing: 2px; Doesn't work (yet) in GTK */
+ }
+
+ .history-entry .equation-symbol {
+ font-weight: lighter;
+ }
+
+ .history-entry .answer-label {
+ }
diff --git a/data/history-entry.ui b/data/history-entry.ui
index 9c4c5f7..daed42f 100644
--- a/data/history-entry.ui
+++ b/data/history-entry.ui
@@ -14,6 +14,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="button-press-event" handler="equation_clicked_cb" swapped="no"/>
+ <style>
+ <class name="equation-label"/>
+ </style>
<child>
<object class="GtkLabel" id="equation_label">
<property name="visible">True</property>
@@ -26,7 +29,25 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">3</property>
+ <property name="width">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="equation_symbol">
+ <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>
+ <style>
+ <class name="equation-symbol"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -34,6 +55,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="button-press-event" handler="answer_clicked_cb" swapped="no"/>
+ <style>
+ <class name="answer-label"/>
+ </style>
<child>
<object class="GtkLabel" id="answer_label">
<property name="visible">True</property>
@@ -47,11 +71,15 @@
</child>
</object>
<packing>
- <property name="left_attach">3</property>
+ <property name="left_attach">5</property>
<property name="top_attach">0</property>
+ <property name="width">2</property>
</packing>
</child>
</object>
</child>
+ <style>
+ <class name="history-entry"/>
+ </style>
</template>
</interface>
diff --git a/src/math-history.vala b/src/math-history.vala
index 8a12637..d767f91 100644
--- a/src/math-history.vala
+++ b/src/math-history.vala
@@ -83,13 +83,13 @@ public class HistoryEntry : Gtk.ListBoxRow
answer_label.set_tooltip_text (answer_nine_digits);
equation_label.set_text (equation);
- answer_label.set_text ("= " + answer_four_digits);
+ answer_label.set_text (answer_four_digits);
}
[GtkCallback]
public bool answer_clicked_cb (Gtk.Widget widget, Gdk.EventButton eventbutton)
{
- var answer = answer_label.get_tooltip_text ();
+ var answer = answer_label.get_text ();
if (answer != null)
answer_clicked (answer);
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]