[gnome-clocks] Fix warnings in the custom spinbutton input handler
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Fix warnings in the custom spinbutton input handler
- Date: Mon, 9 Mar 2015 21:06:13 +0000 (UTC)
commit 9a5d8a4343f894437ec1f109a68485a46e250174
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Mar 9 22:05:34 2015 +0100
Fix warnings in the custom spinbutton input handler
src/timer.vala | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/timer.vala b/src/timer.vala
index 918ca06..ef6e305 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -152,12 +152,10 @@ public class Face : Gtk.Stack, Clocks.Clock {
// extra portion to hours field
if (entered_value > 59) {
int current_hours = h_spinbutton.get_value_as_int ();
- if (current_hours < 99) {
- h_spinbutton.set_value (current_hours + entered_value / 60);
- m_spinbutton.set_value (entered_value % 60);
- }
+ h_spinbutton.set_value (double.min (99, current_hours + entered_value / 60));
}
- return 0;
+ new_value = entered_value % 60;
+ return 1;
}
[GtkCallback]
@@ -171,15 +169,13 @@ public class Face : Gtk.Stack, Clocks.Clock {
int new_minutes = current_minutes + entered_value / 60;
if (new_minutes > 59) {
int current_hours = h_spinbutton.get_value_as_int ();
- if (current_hours < 99) {
- h_spinbutton.set_value (current_hours + new_minutes / 60);
- new_minutes = new_minutes % 60;
- }
+ h_spinbutton.set_value (double.min (99, current_hours + new_minutes / 60));
+ new_minutes = new_minutes % 60;
}
m_spinbutton.set_value (new_minutes);
- s_spinbutton.set_value (entered_value % 60);
}
- return 0;
+ new_value = entered_value % 60;
+ return 1;
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]