[evolution/gnome-3-4] Bug #668988 - Handle a "minutes" entry greater than 59 intelligently



commit 3a9ac1edd9a03da18bf1631fc22cc8e4af47f102
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 26 12:57:58 2012 +0200

    Bug #668988 - Handle a "minutes" entry greater than 59 intelligently

 calendar/gui/dialogs/event-page.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 3697ce5..41b894e 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -1980,6 +1980,31 @@ minute_sel_changed (GtkSpinButton *widget,
 	hour_minute_changed (epage);
 }
 
+static gboolean
+minute_sel_focus_out (GtkSpinButton *widget,
+		      GdkEvent *event,
+		      EventPage *epage)
+{
+	const gchar *text;
+	gint hours, minutes;
+
+	g_return_val_if_fail (widget != NULL, FALSE);
+	g_return_val_if_fail (epage != NULL, FALSE);
+
+	text = gtk_entry_get_text (GTK_ENTRY (widget));
+	minutes = g_strtod (text, NULL);
+
+	if (minutes >= 60) {
+		hours = minutes / 60;
+		minutes = minutes % 60;
+
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (epage->priv->hour_selector), hours);
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (epage->priv->minute_selector), minutes);
+	}
+
+	return FALSE;
+}
+
 static void
 hour_minute_changed (EventPage *epage)
 {
@@ -3346,6 +3371,10 @@ init_widgets (EventPage *epage)
 		priv->minute_selector, "value-changed",
 		G_CALLBACK (minute_sel_changed), epage);
 
+	g_signal_connect (
+		priv->minute_selector, "focus-out-event",
+		G_CALLBACK (minute_sel_focus_out), epage);
+
 	/* Add the user defined time if necessary */
 	priv->alarm_units =
 		e_meeting_store_get_default_reminder_units (



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]