diff options
author | Srinivasa Ragavan <sragavan@novell.com> | 2005-11-24 14:24:01 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2005-11-24 14:24:01 +0800 |
commit | 77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5 (patch) | |
tree | c68a12b5d5b3401cf7aafa5c3cd360050834821c | |
parent | 761a444b562b13688a9b28bb993a33d51c3bda50 (diff) | |
download | gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.tar gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.tar.gz gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.tar.bz2 gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.tar.lz gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.tar.xz gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.tar.zst gsoc2013-evolution-77cf09208aa0fecdc7eaf20adee4ee4125ab5cf5.zip |
Commiting Johnny Jacob's patch on EDateEdit
2005-11-24 Srinivasa Ragavan <sragavan@novell.com>
* Commiting Johnny Jacob's patch on EDateEdit
svn path=/trunk/; revision=30652
-rw-r--r-- | widgets/misc/ChangeLog | 11 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.c | 54 |
2 files changed, 64 insertions, 1 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 3e431df074..978098382a 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,14 @@ +2005-11-23 Johnny Jacob <johnnyjacob@gmail.com> + + * e-dateedit.c: (on_date_entry_focus_out) (on_time_entry_focus_out) : + Validation for date and time during focus out event. + +2005-11-22 Johnny Jacob <johnnyjacob@gmail.com> + + ** See Bug #303856 + * e-dateedit.c: (create_children) : Added a signal handler + for date_entry's "key_release_event". + 2005-11-17 Harish Krishnaswamy <kharish@novell.com> * e-attachment-bar.c: (update), (e_attachment_bar_set_width): diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 258ad5b20e..1cae770ed4 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -55,6 +55,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtkmain.h> #include <gtk/gtkvbox.h> +#include <gtk/gtkmessagedialog.h> #include <atk/atkrelation.h> #include <atk/atkrelationset.h> #include <libgnome/gnome-i18n.h> @@ -147,6 +148,9 @@ static void e_date_edit_grab_focus (GtkWidget *widget); static gint on_date_entry_key_press (GtkWidget *widget, GdkEventKey *event, EDateEdit *dedit); +static gint on_date_entry_key_release (GtkWidget *widget, + GdkEventKey *event, + EDateEdit *dedit); static void on_date_button_clicked (GtkWidget *widget, EDateEdit *dedit); static void e_date_edit_show_date_popup (EDateEdit *dedit); @@ -340,6 +344,9 @@ create_children (EDateEdit *dedit) g_signal_connect (priv->date_entry, "key_press_event", G_CALLBACK (on_date_entry_key_press), dedit); + g_signal_connect (priv->date_entry, "key_release_event", + G_CALLBACK (on_date_entry_key_release), + dedit); g_signal_connect_after (priv->date_entry, "focus_out_event", G_CALLBACK (on_date_entry_focus_out), @@ -1587,6 +1594,15 @@ on_time_entry_key_press (GtkWidget *widget, } static gint +on_date_entry_key_release (GtkWidget *widget, + GdkEventKey *event, + EDateEdit *dedit) +{ + e_date_edit_check_date_changed (dedit); + return TRUE; +} + +static gint on_time_entry_key_release (GtkWidget *widget, GdkEventKey *event, EDateEdit *dedit) @@ -1597,7 +1613,7 @@ on_time_entry_key_release (GtkWidget *widget, e_date_edit_check_time_changed (dedit); return TRUE; } - + e_date_edit_check_time_changed (dedit); return FALSE; } @@ -1607,7 +1623,28 @@ on_date_entry_focus_out (GtkEntry *entry, GdkEventFocus *event, EDateEdit *dedit) { + struct tm tmp_tm; + GtkMessageDialog *msg_dialog; + + tmp_tm.tm_year = 0; + tmp_tm.tm_mon = 0; + tmp_tm.tm_mday = 0; + e_date_edit_check_date_changed (dedit); + + if (!e_date_edit_date_is_valid (dedit)) { + msg_dialog = gtk_message_dialog_new(NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + "Invalid Date Value"); + gtk_dialog_run (GTK_DIALOG(msg_dialog)); + gtk_widget_destroy (msg_dialog); + e_date_edit_get_date (dedit,&tmp_tm.tm_year,&tmp_tm.tm_mon,&tmp_tm.tm_mday); + e_date_edit_set_date (dedit,tmp_tm.tm_year,tmp_tm.tm_mon,tmp_tm.tm_mday); + gtk_widget_grab_focus (entry); + return FALSE; + } return FALSE; } @@ -1617,7 +1654,22 @@ on_time_entry_focus_out (GtkEntry *entry, GdkEventFocus *event, EDateEdit *dedit) { + GtkMessageDialog *msg_dialog; + e_date_edit_check_time_changed (dedit); + + if (!e_date_edit_time_is_valid (dedit)) { + msg_dialog=gtk_message_dialog_new(NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + "Invalid Time Value"); + gtk_dialog_run (GTK_DIALOG(msg_dialog)); + gtk_widget_destroy (msg_dialog); + e_date_edit_set_time (dedit,e_date_edit_get_time(dedit)); + gtk_widget_grab_focus (entry); + return FALSE; + } return FALSE; } |