[gnome-clocks/wip/analogtimer] stuff
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/wip/analogtimer] stuff
- Date: Wed, 7 Aug 2013 13:12:35 +0000 (UTC)
commit 062f987bde502f1d2997db7149f0a39413511539
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Aug 5 21:42:26 2013 +0200
stuff
NEWS | 7 ++++
configure.ac | 2 +-
data/css/gnome-clocks.css | 4 ++
src/timer.vala | 84 +++++++++++++++++++++++++--------------------
4 files changed, 59 insertions(+), 38 deletions(-)
---
diff --git a/NEWS b/NEWS
index 6b55f06..946d973 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+gnome-clocks 3.9.3
+==================
+
+ * Adapt to the latest GTK+ and Vala changes
+ * Misc bugfixes
+ * Updated translations
+
gnome-clocks 3.9.2
==================
diff --git a/configure.ac b/configure.ac
index a518ef5..8e10dbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ(2.63)
AC_INIT([gnome-clocks],
- [3.9.2],
+ [3.9.3],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-clocks],
[gnome-clocks])
diff --git a/data/css/gnome-clocks.css b/data/css/gnome-clocks.css
index c2ebfa6..969ac8e 100644
--- a/data/css/gnome-clocks.css
+++ b/data/css/gnome-clocks.css
@@ -106,6 +106,10 @@
font-size: 18px;
}
+.clocks-timer-inner {
+ background-color: @theme_bg_color;
+}
+
.clocks-countup-label {
font-size: 32px;
}
diff --git a/src/timer.vala b/src/timer.vala
index 317da3a..4c5ab57 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -89,8 +89,6 @@ public class CountdownFrame : Gtk.Frame {
}
public override bool draw (Cairo.Context cr) {
- base.draw(cr);
-
var context = get_style_context ();
Gtk.Allocation allocation;
get_allocation (out allocation);
@@ -98,50 +96,56 @@ public class CountdownFrame : Gtk.Frame {
var center_y = allocation.height / 2;
var radius = calculate_diameter () / 2;
+
+ cr.save ();
cr.move_to (center_x + radius, center_y);
- cr.set_line_width (1);
- var color = context.get_border_color (Gtk.StateFlags.SELECTED);
+ context.save ();
+ context.add_class ("clocks-timer-inner");
+ var color = context.get_background_color (Gtk.StateFlags.NORMAL);
Gdk.cairo_set_source_rgba (cr, color);
cr.arc (center_x, center_y, radius, 0, 2 * Math.PI);
- cr.arc (center_x, center_y, radius - 9, 0, 2 * Math.PI);
- cr.stroke ();
+ cr.fill ();
+ context.restore ();
- cr.set_line_width (8);
-
- color = context.get_color (Gtk.StateFlags.SELECTED);
- cr.arc (center_x, center_y, radius - 4.5, 0, 2 * Math.PI);
+ cr.set_line_width (1);
+ color = context.get_border_color (Gtk.StateFlags.SELECTED);
Gdk.cairo_set_source_rgba (cr, color);
+ cr.arc (center_x, center_y, radius, 0, 2 * Math.PI);
cr.stroke ();
- var progress = get_progress ();
- if (progress > 0) {
- color = context.get_background_color (Gtk.StateFlags.SELECTED);
- cr.arc (center_x, center_y, radius - 4.5, 1.5 * Math.PI, (1.5 + progress * 2 ) * Math.PI);
- Gdk.cairo_set_source_rgba (cr, color);
- cr.stroke ();
-
- if (progress < 1) {
- if (cursor_pattern == null) {
- cursor_pattern = new Cairo.Pattern.radial (0, 0, 6, 0, 0, 18);
- cursor_pattern.add_color_stop_rgba (0, color.red, color.green, color.blue, 1);
- cursor_pattern.add_color_stop_rgba (0.5, color.red, color.green, color.blue, 0);
+ if (span > 0) {
+ var progress = get_progress ();
+ if (progress > 0) {
+ cr.set_line_width (2);
+ color = context.get_background_color (Gtk.StateFlags.SELECTED);
+ cr.arc (center_x, center_y, radius, 1.5 * Math.PI, (1.5 + progress * 2 ) * Math.PI);
+ Gdk.cairo_set_source_rgba (cr, color);
+ cr.stroke ();
+
+ if (progress < 1) {
+ if (cursor_pattern == null) {
+ cursor_pattern = new Cairo.Pattern.radial (0, 0, 3, 0, 0, 9);
+ cursor_pattern.add_color_stop_rgba (0, color.red, color.green, color.blue, 1);
+ cursor_pattern.add_color_stop_rgba (0.5, color.red, color.green, color.blue, 0);
+ }
+
+ var x = center_x + (radius) * Math.cos((1.5 + progress * 2) * Math.PI);
+ var y = center_y + (radius) * Math.sin((1.5 + progress * 2) * Math.PI);
+
+ var cursor_radius = 9;
+ cr.arc (x, y, cursor_radius, 0, 2 * Math.PI);
+ cr.translate (x, y);
+ cr.set_source (cursor_pattern);
+ cr.fill ();
}
-
- var x = center_x + (radius - 4.5) * Math.cos((1.5 + progress * 2) * Math.PI);
- var y = center_y + (radius - 4.5) * Math.sin((1.5 + progress * 2) * Math.PI);
-
- var cursor_radius = 18;
- cr.arc (x, y, cursor_radius, 0, 2 * Math.PI);
- cr.translate (x, y);
- cr.set_source (cursor_pattern);
- cr.fill ();
}
}
- return false;
- }
+ cr.restore ();
+ return base.draw(cr);
+ }
}
public class MainPanel : Gtk.Stack, Clocks.Clock {
@@ -164,6 +168,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
private Gtk.SpinButton m_spinbutton;
private Gtk.SpinButton s_spinbutton;
private Gtk.Button start_button;
+ private CountdownFrame setup_frame;
private CountdownFrame countdown_frame;
private Gtk.Label countdown_label;
private Gtk.Label countup_label;
@@ -183,9 +188,14 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
span = 0;
timer = new GLib.Timer ();
+ setup_frame = new CountdownFrame ();
+ setup_frame.show ();
+
var builder = Utils.load_ui ("timer.ui");
setup_panel = builder.get_object ("setup_panel") as Gtk.Widget;
+ setup_frame.add (setup_panel);
+
h_spinbutton = builder.get_object ("spinbutton_hours") as Gtk.SpinButton;
m_spinbutton = builder.get_object ("spinbutton_minutes") as Gtk.SpinButton;
s_spinbutton = builder.get_object ("spinbutton_seconds") as Gtk.SpinButton;
@@ -236,7 +246,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
left_button.set_label (_("Pause"));
});
- add (setup_panel);
+ add (setup_frame);
add (countdown_frame);
reset ();
@@ -278,7 +288,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
s_spinbutton.value = span % 60;
start_button.set_sensitive (span > 0);
countdown_frame.reset ();
- visible_child = setup_panel;
+ visible_child = setup_frame;
}
private void start () {
@@ -338,7 +348,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
remove_timeout ();
update_countdown_label (0, 0, 0);
update_countup_label (0, 0, 0);
- visible_child = setup_panel;
+ visible_child = setup_frame;
return false;
}
@@ -375,7 +385,7 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
}
public override void grab_focus () {
- if (visible_child == setup_panel) {
+ if (visible_child == setup_frame) {
start_button.grab_focus ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]