Commit 8f7399f8 authored by Dylan McCall's avatar Dylan McCall

Set colours for CircleCounter in CSS.

Snap CircleCounter's progress indicator to exact increments, for consistency.
parent 9a5beec9
......@@ -26,6 +26,8 @@ public class CircleCounter : Gtk.Widget {
protected const double LINE_WIDTH = 5.0;
protected const int DEFAULT_RADIUS = 48;
private const double SNAP_INCREMENT = (Math.PI * 2) / 60.0;
public enum Direction {
COUNT_DOWN,
COUNT_UP
......@@ -48,6 +50,8 @@ public class CircleCounter : Gtk.Widget {
Object ();
this.set_has_window (false);
this.get_style_context ().add_class ("_circle-counter");
this.notify["progress"].connect((s, p) => {
this.queue_draw ();
});
......@@ -64,9 +68,7 @@ public class CircleCounter : Gtk.Widget {
int radius = int.min(center_x, center_y);
double arc_radius = radius - LINE_WIDTH / 2;
// FIXME: Get some nicer colours from CSS?
Gdk.RGBA trough_color = style_context.get_color (state);
trough_color.alpha = trough_color.alpha / 5;
Gdk.RGBA trough_color = style_context.get_background_color (state);
Gdk.RGBA base_color = style_context.get_color (state);
Gdk.cairo_set_source_rgba (cr, trough_color);
......@@ -76,6 +78,8 @@ public class CircleCounter : Gtk.Widget {
double start_angle = 1.5 * Math.PI;
double progress_angle = this.progress * Math.PI * 2.0;
progress_angle = (int)(progress_angle / SNAP_INCREMENT) * SNAP_INCREMENT;
if (this.direction == Direction.COUNT_DOWN) {
if (progress_angle > 0) {
cr.arc (center_x, center_y, arc_radius, start_angle, start_angle - progress_angle);
......
......@@ -42,8 +42,9 @@ public class SettingsApplication : Gtk.Application {
font-size: small;
}
._break-status-icon {
opacity: 0.2;
._circle-counter {
color: @scrollbar_slider_prelight;
background-color: @scrollbar_trough;
}
""";
......
......@@ -117,7 +117,6 @@ public abstract class TimerBreakStatusPanel : BreakStatusPanel {
// FIXME: This is an application icon. It doesn't make sense here.
this.circle_counter = new CircleCounter ();
this.attach (this.circle_counter, 0, 0, 1, 1);
this.circle_counter.get_style_context ().add_class ("_break-status-icon");
var labels_grid = new Gtk.Grid ();
this.attach (labels_grid, 1, 0, 1, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment