Merge lp:~elementary-apps/pantheon-calculator/ui-cleanups into lp:~elementary-apps/pantheon-calculator/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Cody Garver
Approved revision: 206
Merged at revision: 206
Proposed branch: lp:~elementary-apps/pantheon-calculator/ui-cleanups
Merge into: lp:~elementary-apps/pantheon-calculator/trunk
Diff against target: 168 lines (+38/-49)
2 files modified
src/Button.vala (+1/-6)
src/MainWindow.vala (+37/-43)
To merge this branch: bzr merge lp:~elementary-apps/pantheon-calculator/ui-cleanups
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+288222@code.launchpad.net

Commit message

Cleanup UI a little bit
Get rid of superfluous code

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Button.vala'
2--- src/Button.vala 2015-03-16 17:05:32 +0000
3+++ src/Button.vala 2016-03-06 17:57:40 +0000
4@@ -21,7 +21,7 @@
5
6 public class PantheonCalculator.Button : Gtk.Button {
7 private const int WIDTH = 65;
8- private const int HEIGHT = 45;
9+ private const int HEIGHT = 43;
10 public string function = null;
11
12 public Button (string label, string? description = null) {
13@@ -32,11 +32,6 @@
14 tooltip_text = description;
15 }
16
17- public Button.from_icon_name (string icon_name, string? description = null) {
18- image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.BUTTON);
19- tooltip_text = description;
20- }
21-
22 public override void get_preferred_width (out int minimum_width, out int natural_width) {
23 minimum_width = WIDTH;
24 natural_width = WIDTH;
25
26=== modified file 'src/MainWindow.vala'
27--- src/MainWindow.vala 2015-09-25 17:18:02 +0000
28+++ src/MainWindow.vala 2016-03-06 17:57:40 +0000
29@@ -75,19 +75,17 @@
30 headerbar.set_title (_("Calculator"));
31 set_titlebar (headerbar);
32
33- extended_img_1 = new Gtk.Image.from_icon_name ("pane-hide-symbolic", Gtk.IconSize.LARGE_TOOLBAR);
34- extended_img_2 = new Gtk.Image.from_icon_name ("pane-show-symbolic", Gtk.IconSize.LARGE_TOOLBAR);
35+ extended_img_1 = new Gtk.Image.from_icon_name ("pane-hide-symbolic", Gtk.IconSize.MENU);
36+ extended_img_2 = new Gtk.Image.from_icon_name ("pane-show-symbolic", Gtk.IconSize.MENU);
37
38 button_extended = new Gtk.ToggleButton ();
39 button_extended.image = extended_img_1;
40 button_extended.tooltip_text = _("Show extended functionality");
41- button_extended.relief = Gtk.ReliefStyle.NONE;
42 button_extended.toggled.connect (toggle_grid);
43
44 button_history = new Gtk.Button ();
45- button_history.image = new Gtk.Image.from_icon_name ("document-open-recent-symbolic", Gtk.IconSize.LARGE_TOOLBAR);
46+ button_history.image = new Gtk.Image.from_icon_name ("document-open-recent-symbolic", Gtk.IconSize.MENU);
47 button_history.tooltip_text = _("History");
48- button_history.relief = Gtk.ReliefStyle.NONE;
49 button_history.sensitive = false;
50 button_history.clicked.connect (show_history);
51
52@@ -97,11 +95,7 @@
53
54 private void build_ui () {
55 main_grid = new Gtk.Grid ();
56- main_grid.orientation = Gtk.Orientation.VERTICAL;
57- main_grid.row_spacing = 3;
58 main_grid.margin = 6;
59- main_grid.expand = true;
60- main_grid.halign = Gtk.Align.CENTER;
61
62 build_basic_ui ();
63 build_extended_ui ();
64@@ -125,6 +119,7 @@
65
66 private void build_basic_ui () {
67 entry = new Gtk.Entry ();
68+ entry.set_alignment (1);
69 entry.set_text (settings.get_string ("entry-content"));
70 entry.get_style_context ().add_class ("h2");
71
72@@ -133,7 +128,7 @@
73 button_calc.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
74 button_ans = new Button ("ANS", _("Add last result"));
75 button_ans.sensitive = false;
76- button_undo = new Button.from_icon_name ("go-previous-symbolic", _("Backspace"));
77+ button_undo = new Button ("Del", _("Backspace"));
78 button_del = new Button ("C", _("Clear entry"));
79 button_del.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
80
81@@ -166,37 +161,36 @@
82 var button_9 = new Button ("9");
83
84 var basic_grid = new Gtk.Grid ();
85- basic_grid.column_spacing = 3;
86- basic_grid.row_spacing = 3;
87- basic_grid.valign = Gtk.Align.END;
88- basic_grid.attach (button_del, 0, 0, 1, 1);
89- basic_grid.attach (button_undo, 1, 0, 1, 1);
90- basic_grid.attach (button_percent, 2, 0, 1, 1);
91- basic_grid.attach (button_div, 3, 0, 1, 1);
92-
93- basic_grid.attach (button_7, 0, 1, 1, 1);
94- basic_grid.attach (button_8, 1, 1, 1, 1);
95- basic_grid.attach (button_9, 2, 1, 1, 1);
96- basic_grid.attach (button_mult, 3, 1, 1, 1);
97-
98- basic_grid.attach (button_4, 0, 2, 1, 1);
99- basic_grid.attach (button_5, 1, 2, 1, 1);
100- basic_grid.attach (button_6, 2, 2, 1, 1);
101- basic_grid.attach (button_sub, 3, 2, 1, 1);
102-
103- basic_grid.attach (button_1, 0, 3, 1, 1);
104- basic_grid.attach (button_2, 1, 3, 1, 1);
105- basic_grid.attach (button_3, 2, 3, 1, 1);
106- basic_grid.attach (button_add, 3, 3, 1, 1);
107-
108- basic_grid.attach (button_0, 0, 4, 1, 1);
109- basic_grid.attach (button_point, 1, 4, 1, 1);
110- basic_grid.attach (button_ans, 2, 4, 1, 1);
111- basic_grid.attach (button_calc, 3, 4, 1, 1);
112+ basic_grid.column_spacing = 6;
113+ basic_grid.row_spacing = 6;
114+ basic_grid.attach (entry, 0, 0, 4, 1);
115+ basic_grid.attach (button_del, 0, 1, 1, 1);
116+ basic_grid.attach (button_undo, 1, 1, 1, 1);
117+ basic_grid.attach (button_percent, 2, 1, 1, 1);
118+ basic_grid.attach (button_div, 3, 1, 1, 1);
119+
120+ basic_grid.attach (button_7, 0, 2, 1, 1);
121+ basic_grid.attach (button_8, 1, 2, 1, 1);
122+ basic_grid.attach (button_9, 2, 2, 1, 1);
123+ basic_grid.attach (button_mult, 3, 2, 1, 1);
124+
125+ basic_grid.attach (button_4, 0, 3, 1, 1);
126+ basic_grid.attach (button_5, 1, 3, 1, 1);
127+ basic_grid.attach (button_6, 2, 3, 1, 1);
128+ basic_grid.attach (button_sub, 3, 3, 1, 1);
129+
130+ basic_grid.attach (button_1, 0, 4, 1, 1);
131+ basic_grid.attach (button_2, 1, 4, 1, 1);
132+ basic_grid.attach (button_3, 2, 4, 1, 1);
133+ basic_grid.attach (button_add, 3, 4, 1, 1);
134+
135+ basic_grid.attach (button_0, 0, 5, 1, 1);
136+ basic_grid.attach (button_point, 1, 5, 1, 1);
137+ basic_grid.attach (button_ans, 2, 5, 1, 1);
138+ basic_grid.attach (button_calc, 3, 5, 1, 1);
139
140 //attach all widgets
141- main_grid.attach (entry, 0, 0, 1, 1);
142- main_grid.attach (basic_grid, 0, 1, 1, 1);
143+ main_grid.add (basic_grid);
144
145 entry.changed.connect (remove_error);
146 entry.activate.connect (button_calc_clicked);
147@@ -239,9 +233,9 @@
148 var button_e = new Button ("e", _("Euler's Number"));
149
150 var extended_grid = new Gtk.Grid ();
151- extended_grid.margin_start = 3;
152- extended_grid.column_spacing = 3;
153- extended_grid.row_spacing = 3;
154+ extended_grid.margin_start = 6;
155+ extended_grid.column_spacing = 6;
156+ extended_grid.row_spacing = 6;
157 extended_grid.valign = Gtk.Align.END;
158 extended_grid.attach (button_par_left, 0, 0, 1, 1);
159 extended_grid.attach (button_par_right, 1, 0, 1, 1);
160@@ -260,7 +254,7 @@
161 extended_revealer.set_transition_type (Gtk.RevealerTransitionType.SLIDE_LEFT);
162 extended_revealer.show_all ();
163 extended_revealer.add (extended_grid);
164- main_grid.attach (extended_revealer, 1, 0, 1, 2);
165+ main_grid.add (extended_revealer);
166
167 button_pi.clicked.connect (() => {regular_button_clicked (button_pi.function);});
168 button_e.clicked.connect (() => {regular_button_clicked (button_e.function);});

Subscribers

People subscribed via source and target branches