aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog4
-rw-r--r--calendar/gncal-full-day.c31
-rw-r--r--calendar/gncal-full-day.h14
-rw-r--r--calendar/gnome-cal.c1
-rw-r--r--calendar/gui/gncal-full-day.c31
-rw-r--r--calendar/gui/gncal-full-day.h14
-rw-r--r--calendar/gui/gnome-cal.c1
7 files changed, 72 insertions, 24 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index db529603fe..2a3844a5a6 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,9 @@
1998-04-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
+ * gncal-full-day.c (gncal_full_day_get_day_start_yoffset): New
+ public function that returns the y offset for the row
+ corresponding to the "day begin" time.
+
* gncal-full-day.c (gncal_full_day_key_press): Now any printable
keystroke (not just Return) will activate the selected range.
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)
{
diff --git a/calendar/gncal-full-day.h b/calendar/gncal-full-day.h
index 97d4d9482d..0d50243dc2 100644
--- a/calendar/gncal-full-day.h
+++ b/calendar/gncal-full-day.h
@@ -49,20 +49,22 @@ struct _GncalFullDayClass {
};
-guint gncal_full_day_get_type (void);
-GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
+guint gncal_full_day_get_type (void);
+GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
-void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
+void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
+void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
/* Returns the selected range in lower and upper. If nothing is
* selected, return value is FALSE, otherwise it is TRUE.
* The lower and upper values are always set to proper values, regardless of
* the selection value
*/
-int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
+int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
-void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
+void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
+
+int gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday);
END_GNOME_DECLS
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index a7b5402e0d..bc26be5c92 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -102,6 +102,7 @@ setup_day_view (GnomeCalendar *gcal, time_t now)
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
0, 0);
gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
+
gtk_widget_show_all (GTK_WIDGET (t));
}
diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c
index a9265ae7c6..949d890e4c 100644
--- a/calendar/gui/gncal-full-day.c
+++ b/calendar/gui/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)
{
diff --git a/calendar/gui/gncal-full-day.h b/calendar/gui/gncal-full-day.h
index 97d4d9482d..0d50243dc2 100644
--- a/calendar/gui/gncal-full-day.h
+++ b/calendar/gui/gncal-full-day.h
@@ -49,20 +49,22 @@ struct _GncalFullDayClass {
};
-guint gncal_full_day_get_type (void);
-GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
+guint gncal_full_day_get_type (void);
+GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
-void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
+void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
+void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
/* Returns the selected range in lower and upper. If nothing is
* selected, return value is FALSE, otherwise it is TRUE.
* The lower and upper values are always set to proper values, regardless of
* the selection value
*/
-int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
+int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
-void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
+void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
+
+int gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday);
END_GNOME_DECLS
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index a7b5402e0d..bc26be5c92 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -102,6 +102,7 @@ setup_day_view (GnomeCalendar *gcal, time_t now)
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
0, 0);
gtk_container_add (GTK_CONTAINER (sw), gcal->day_view);
+
gtk_widget_show_all (GTK_WIDGET (t));
}