aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/TODO3
-rw-r--r--calendar/gncal-full-day.c36
-rw-r--r--calendar/gncal-full-day.h2
-rw-r--r--calendar/gnome-cal.c1
-rw-r--r--calendar/gnome-cal.h2
-rw-r--r--calendar/gui/gncal-full-day.c36
-rw-r--r--calendar/gui/gncal-full-day.h2
-rw-r--r--calendar/gui/gnome-cal.c1
-rw-r--r--calendar/gui/gnome-cal.h2
10 files changed, 89 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 3f0b1d70c3..87c6dc9358 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,14 @@
1998-04-13 Federico Mena Quintero <federico@nuclecu.unam.mx>
+ * gncal-full-day.h:
+ * gncal-full-day.c (gncal_full_day_focus_child): New function to
+ let the outside world decide which child to focus.
+ (gncal_full_day_focus_child): Bleah. We have to synthesize a
+ click because GtkText will not set the cursor when you focus it.
+
+ * gnome-cal.c (day_view_range_activated): Focus the new child in
+ the full day widget.
+
* eventedit.c (event_editor_setup_time_frame): Re-aligned some
widgets to make it look prettier.
(ee_alarm_widgets): Likewise.
diff --git a/calendar/TODO b/calendar/TODO
index a092c0316f..1ab5522faa 100644
--- a/calendar/TODO
+++ b/calendar/TODO
@@ -15,9 +15,6 @@ Event editor dialog:
Full day view widget:
-- Finish the code on gnome-cal.c to add an event when the
- range_activated signal is caught.
-
- Check notification to calendar when an object changes. Maybe we
need some flags to tell gnome_calendar_object_changed() whether
summary/dates/etc. changed. Maybe not.
diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c
index dc61018ecd..f32c8c482c 100644
--- a/calendar/gncal-full-day.c
+++ b/calendar/gncal-full-day.c
@@ -1662,6 +1662,42 @@ gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *up
return TRUE;
}
+void
+gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *object)
+{
+ GList *children;
+ Child *child;
+ GdkEvent event;
+
+ g_return_if_fail (fullday != NULL);
+ g_return_if_fail (object != NULL);
+
+ for (children = fullday->children; children; children = children->next) {
+ child = children->data;
+
+ if (child->ico == object) {
+ gtk_widget_grab_focus (child->widget);
+
+ /* We synthesize a click because GtkText will not set the cursor and
+ * the user will not be able to type-- this has to be fixed in
+ * GtkText. */
+
+ memset (&event, 0, sizeof (event));
+
+ event.type = GDK_BUTTON_PRESS;
+ event.button.window = child->widget->window;
+ event.button.time = GDK_CURRENT_TIME;
+ event.button.x = 0;
+ event.button.y = 0;
+ event.button.button = 1;
+
+ gtk_widget_event (child->widget, &event);
+
+ break;
+ }
+ }
+}
+
static void
range_activated (GncalFullDay *fullday)
{
diff --git a/calendar/gncal-full-day.h b/calendar/gncal-full-day.h
index 309924bc2e..289accd136 100644
--- a/calendar/gncal-full-day.h
+++ b/calendar/gncal-full-day.h
@@ -60,6 +60,8 @@ void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower,
*/
int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
+void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *object);
+
END_GNOME_DECLS
#endif
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index 257dfe0532..6a9b7b044f 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -49,6 +49,7 @@ day_view_range_activated (GncalFullDay *fullday, GnomeCalendar *gcal)
gncal_full_day_selection_range (fullday, &ical->dtstart, &ical->dtend);
gnome_calendar_add_object (gcal, ical);
+ gncal_full_day_focus_child (fullday, ical);
}
static void
diff --git a/calendar/gnome-cal.h b/calendar/gnome-cal.h
index dcb4b2ffa1..5a4d8e8d09 100644
--- a/calendar/gnome-cal.h
+++ b/calendar/gnome-cal.h
@@ -36,7 +36,7 @@ typedef struct {
} GnomeCalendarClass;
guint gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_new (char *title);
+GtkWidget *gnome_calendar_new (char *title);
void gnome_calendar_load (GnomeCalendar *gcal, char *file);
void gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj);
void gnome_calendar_next (GnomeCalendar *gcal);
diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c
index dc61018ecd..f32c8c482c 100644
--- a/calendar/gui/gncal-full-day.c
+++ b/calendar/gui/gncal-full-day.c
@@ -1662,6 +1662,42 @@ gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *up
return TRUE;
}
+void
+gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *object)
+{
+ GList *children;
+ Child *child;
+ GdkEvent event;
+
+ g_return_if_fail (fullday != NULL);
+ g_return_if_fail (object != NULL);
+
+ for (children = fullday->children; children; children = children->next) {
+ child = children->data;
+
+ if (child->ico == object) {
+ gtk_widget_grab_focus (child->widget);
+
+ /* We synthesize a click because GtkText will not set the cursor and
+ * the user will not be able to type-- this has to be fixed in
+ * GtkText. */
+
+ memset (&event, 0, sizeof (event));
+
+ event.type = GDK_BUTTON_PRESS;
+ event.button.window = child->widget->window;
+ event.button.time = GDK_CURRENT_TIME;
+ event.button.x = 0;
+ event.button.y = 0;
+ event.button.button = 1;
+
+ gtk_widget_event (child->widget, &event);
+
+ break;
+ }
+ }
+}
+
static void
range_activated (GncalFullDay *fullday)
{
diff --git a/calendar/gui/gncal-full-day.h b/calendar/gui/gncal-full-day.h
index 309924bc2e..289accd136 100644
--- a/calendar/gui/gncal-full-day.h
+++ b/calendar/gui/gncal-full-day.h
@@ -60,6 +60,8 @@ void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower,
*/
int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
+void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *object);
+
END_GNOME_DECLS
#endif
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 257dfe0532..6a9b7b044f 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -49,6 +49,7 @@ day_view_range_activated (GncalFullDay *fullday, GnomeCalendar *gcal)
gncal_full_day_selection_range (fullday, &ical->dtstart, &ical->dtend);
gnome_calendar_add_object (gcal, ical);
+ gncal_full_day_focus_child (fullday, ical);
}
static void
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index dcb4b2ffa1..5a4d8e8d09 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -36,7 +36,7 @@ typedef struct {
} GnomeCalendarClass;
guint gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_new (char *title);
+GtkWidget *gnome_calendar_new (char *title);
void gnome_calendar_load (GnomeCalendar *gcal, char *file);
void gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj);
void gnome_calendar_next (GnomeCalendar *gcal);