From 6d1f104d1e22eff69151ef4a3a0b25863c392fdb Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 17 Sep 2001 02:58:58 +0000 Subject: add prototype for e_date_edit_set_editable. 2001-09-16 Chris Toshok * e-dateedit.h: add prototype for e_date_edit_set_editable. * e-dateedit.c (e_date_edit_set_editable): new function, analogous to gtk_entry_set_editable: let's the user select but not edit (or in this case, bring up the calendar view.) svn path=/trunk/; revision=12867 --- widgets/misc/ChangeLog | 8 ++++++++ widgets/misc/e-dateedit.c | 21 +++++++++++++++++++++ widgets/misc/e-dateedit.h | 4 ++++ 3 files changed, 33 insertions(+) (limited to 'widgets') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index b57cc24d41..57b8ebff70 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,11 @@ +2001-09-16 Chris Toshok + + * e-dateedit.h: add prototype for e_date_edit_set_editable. + + * e-dateedit.c (e_date_edit_set_editable): new function, analogous + to gtk_entry_set_editable: let's the user select but not edit (or + in this case, bring up the calendar view.) + 2001-09-13 Jeffrey Stedfast * e-search-bar.c (set_dropdown): Don't unref the old dropdown, we diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index e046b65517..32e5aa194d 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -472,6 +472,27 @@ e_date_edit_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } +/** + * e_date_edit_set_editable: + * @dedit: an #EDateEdit widget. + * @editable: whether or not the widget should accept edits. + * + * Allows the programmer to disallow editing (and the popping up of + * the calendar widget), while still allowing the user to select the + * date from the GtkEntry. + */ +void +e_date_edit_set_editable (EDateEdit *dedit, gboolean editable) +{ + EDateEditPrivate *priv; + + g_return_if_fail (E_IS_DATE_EDIT (dedit)); + + priv = dedit->priv; + + gtk_entry_set_editable (GTK_ENTRY (priv->date_entry), editable); + gtk_widget_set_sensitive (priv->date_button, editable); +} static void e_date_edit_forall (GtkContainer *container, diff --git a/widgets/misc/e-dateedit.h b/widgets/misc/e-dateedit.h index 61d2b1858d..76fdb06bf9 100644 --- a/widgets/misc/e-dateedit.h +++ b/widgets/misc/e-dateedit.h @@ -81,6 +81,10 @@ struct _EDateEditClass { guint e_date_edit_get_type (void); GtkWidget* e_date_edit_new (void); +/* Analogous to gtk_entry_set_editable. disable editing, while still + allowing selection. */ +void e_date_edit_set_editable (EDateEdit *dedit, gboolean editable); + /* Returns TRUE if the last date and time set were valid. The date and time are only set when the user hits Return or switches keyboard focus, or selects a date or time from the popup. */ -- cgit