From 5fda22d8393b161a6539b848bdd5d88db7e77bc5 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Tue, 21 Apr 1998 03:11:42 +0000 Subject: Make the any-key-creates-new-appointment-at-selection thing actually work - Federico svn path=/trunk/; revision=173 --- calendar/gncal-full-day.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'calendar/gncal-full-day.c') diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c index a9265ae7c6..949d890e4c 100644 --- a/calendar/gncal-full-day.c +++ b/calendar/gncal-full-day.c @@ -1812,6 +1812,7 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event) struct drag_info *di; GList *children; Child *child; + gint pos; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE); @@ -1834,20 +1835,22 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event) gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]); - /* This is sort of a hack. We find the focused child, if it exists, and - * we re-send the keystroke to it. - */ + /* Find the new child, which should hopefully be focused, and insert the keypress */ for (children = fullday->children; children; children = children->next) { child = children->data; if (GTK_WIDGET_HAS_FOCUS (child->widget)) { - event->window = GTK_TEXT (child->widget)->text_area; - gtk_widget_event (widget, (GdkEvent *) event); + pos = gtk_text_get_length (GTK_TEXT (child->widget)); + + gtk_editable_insert_text (GTK_EDITABLE (child->widget), + event->string, + event->length, + &pos); + return TRUE; } } - } return FALSE; @@ -2072,6 +2075,22 @@ gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico) } } +int +gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday) +{ + GtkWidget *widget; + int begin_row; + + g_return_val_if_fail (fullday != NULL, 0); + g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0); + + widget = GTK_WIDGET (fullday); + + begin_row = (day_begin * 60) / fullday->interval; + + return widget->style->klass->ythickness + begin_row * calc_row_height (fullday); +} + static void range_activated (GncalFullDay *fullday) { -- cgit v1.2.3