[gnome-clocks/bilelmoussaoui/clean: 1/2] widgets: remove unused AnalogFrame
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/bilelmoussaoui/clean: 1/2] widgets: remove unused AnalogFrame
- Date: Sat, 4 Apr 2020 11:07:25 +0000 (UTC)
commit 2d5000ff7dbbef58b437f2fcbf13ae9ff4c1d990
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Sat Apr 4 12:59:16 2020 +0200
widgets: remove unused AnalogFrame
src/widgets.vala | 72 --------------------------------------------------------
1 file changed, 72 deletions(-)
---
diff --git a/src/widgets.vala b/src/widgets.vala
index 8542917..06e934e 100644
--- a/src/widgets.vala
+++ b/src/widgets.vala
@@ -192,78 +192,6 @@ public class AmPmToggleButton : Gtk.Button {
}
}
-public class AnalogFrame : Gtk.Bin {
- protected const int LINE_WIDTH = 6;
- protected const int RADIUS_PAD = 48;
-
- private int calculate_diameter () {
- int ret = 2 * RADIUS_PAD;
- var child = get_child ();
- if (child != null && child.visible) {
- int w, h;
- child.get_preferred_width (out w, null);
- child.get_preferred_height (out h, null);
- ret += (int) Math.sqrt (w * w + h * h);
- }
-
- return ret;
- }
-
- public override void get_preferred_width (out int min_w, out int natural_w) {
- var d = calculate_diameter ();
- min_w = d;
- natural_w = d;
- }
-
- public override void get_preferred_height (out int min_h, out int natural_h) {
- var d = calculate_diameter ();
- min_h = d;
- natural_h = d;
- }
-
- public override void size_allocate (Gtk.Allocation allocation) {
- base.size_allocate (allocation);
- }
-
- public override bool draw (Cairo.Context cr) {
- var context = get_style_context ();
-
- Gtk.Allocation allocation;
- get_allocation (out allocation);
- var center_x = allocation.width / 2;
- var center_y = allocation.height / 2;
-
- var radius = calculate_diameter () / 2;
-
- cr.save ();
- cr.move_to (center_x + radius, center_y);
-
- context.save ();
- context.add_class ("clocks-analog-frame");
-
- context.save ();
- context.add_class (Gtk.STYLE_CLASS_TROUGH);
-
- var color = context.get_color (context.get_state ());
-
- cr.set_line_width (LINE_WIDTH);
- Gdk.cairo_set_source_rgba (cr, color);
- cr.arc (center_x, center_y, radius - LINE_WIDTH / 2, 0, 2 * Math.PI);
- cr.stroke ();
-
- context.restore ();
-
- draw_progress (cr, center_x, center_y, radius);
-
- context.restore ();
- cr.restore ();
-
- return base.draw (cr);
- }
-
- public virtual void draw_progress (Cairo.Context cr, int center_x, int center_y, int radius) {
- }
-}
} // namespace Clocks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]