diff options
-rw-r--r-- | widgets/misc/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.c | 25 |
2 files changed, 30 insertions, 0 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 57b8ebff70..b8d1e21367 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,8 @@ +2001-09-18 Damon Chaplin <damon@ximian.com> + + * e-dateedit.c (e_date_edit_grab_focus): grab focus to the date entry + or the time entry, depending on which is visible. Fixes bug #7237. + 2001-09-16 Chris Toshok <toshok@ximian.com> * e-dateedit.h: add prototype for e_date_edit_set_editable. diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 32e5aa194d..2b46881135 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -138,6 +138,7 @@ static void e_date_edit_class_init (EDateEditClass *class); static void e_date_edit_init (EDateEdit *dedit); static void create_children (EDateEdit *dedit); static void e_date_edit_destroy (GtkObject *object); +static void e_date_edit_grab_focus (GtkWidget *widget); static void e_date_edit_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, @@ -238,6 +239,7 @@ static void e_date_edit_class_init (EDateEditClass *class) { GtkObjectClass *object_class = (GtkObjectClass *) class; + GtkWidgetClass *widget_class = (GtkWidgetClass *) class; GtkContainerClass *container_class = (GtkContainerClass *) class; object_class = (GtkObjectClass*) class; @@ -257,6 +259,8 @@ e_date_edit_class_init (EDateEditClass *class) object_class->destroy = e_date_edit_destroy; + widget_class->grab_focus = e_date_edit_grab_focus; + container_class->forall = e_date_edit_forall; class->changed = NULL; @@ -268,6 +272,8 @@ e_date_edit_init (EDateEdit *dedit) { EDateEditPrivate *priv; + GTK_WIDGET_SET_FLAGS (dedit, GTK_CAN_FOCUS); + dedit->priv = priv = g_new0 (EDateEditPrivate, 1); priv->show_date = TRUE; @@ -472,6 +478,25 @@ e_date_edit_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } + +/* Grab_focus handler for the EDateEdit. If the date field is being shown, we + grab the focus to that, otherwise we grab it to the time field. */ +static void +e_date_edit_grab_focus (GtkWidget *widget) +{ + EDateEdit *dedit; + + g_return_if_fail (E_IS_DATE_EDIT (widget)); + + dedit = E_DATE_EDIT (widget); + + if (dedit->priv->show_date) + gtk_widget_grab_focus (dedit->priv->date_entry); + else + gtk_widget_grab_focus (GTK_COMBO (dedit->priv->time_combo)->entry); +} + + /** * e_date_edit_set_editable: * @dedit: an #EDateEdit widget. |