From 832436edc45892c3c9c35037596110027bdeacd4 Mon Sep 17 00:00:00 2001 From: Bolian Yin Date: Tue, 9 Dec 2003 01:28:57 +0000 Subject: shortcut when cal_view is NULL. Change an action name. add check for event 2003-12-05 Bolian Yin * calendar/ea-cal-view-event.c (ea_cal_view_event_new): shortcut when cal_view is NULL. * calendar/ea-cal-view.c: Change an action name. * calendar/ea-calendar.c (ea_calendar_focus_watcher): add check for event atk object. * calendar/ea-week-view.c (ea_week_view_get_n_children): correct impl. (get_visible_text_item_count): removed. svn path=/trunk/; revision=23678 --- a11y/ChangeLog | 8 ++++++++ a11y/calendar/ea-cal-view-event.c | 3 +++ a11y/calendar/ea-cal-view.c | 4 ++-- a11y/calendar/ea-calendar.c | 11 ++++++----- a11y/calendar/ea-week-view.c | 39 +++++++++++++++++++++++++-------------- 5 files changed, 44 insertions(+), 21 deletions(-) (limited to 'a11y') diff --git a/a11y/ChangeLog b/a11y/ChangeLog index ad5dc9e85d..6752384193 100644 --- a/a11y/ChangeLog +++ b/a11y/ChangeLog @@ -1,3 +1,11 @@ +2003-12-05 Bolian Yin + + * calendar/ea-cal-view-event.c (ea_cal_view_event_new): shortcut when cal_view is NULL. + * calendar/ea-cal-view.c: Change an action name. + * calendar/ea-calendar.c (ea_calendar_focus_watcher): add check for event atk object. + * calendar/ea-week-view.c (ea_week_view_get_n_children): correct impl. + (get_visible_text_item_count): removed. + 2003-12-06 JP Rosevear * */Makefile.am: Remove hard coded disable deprecated flags diff --git a/a11y/calendar/ea-cal-view-event.c b/a11y/calendar/ea-cal-view-event.c index a03f9a1421..37b0d5ed90 100644 --- a/a11y/calendar/ea-cal-view-event.c +++ b/a11y/calendar/ea-cal-view-event.c @@ -138,6 +138,9 @@ ea_cal_view_event_new (GObject *obj) g_return_val_if_fail (E_IS_TEXT (obj), NULL); cal_view = ea_calendar_helpers_get_cal_view_from (GNOME_CANVAS_ITEM (obj)); + if (!cal_view) + return NULL; + if (E_IS_WEEK_VIEW (cal_view)) { gint event_num, span_num; EWeekViewEvent *week_view_event; diff --git a/a11y/calendar/ea-cal-view.c b/a11y/calendar/ea-cal-view.c index 9b68d24f9f..2d86d9ef10 100644 --- a/a11y/calendar/ea-cal-view.c +++ b/a11y/calendar/ea-cal-view.c @@ -303,7 +303,7 @@ ea_cal_view_dates_change_cb (GnomeCalendar *gcal, gpointer data) static const char * action_name [CAL_VIEW_ACTION_NUM] = { "New Appointment", - "New Event", + "New All Day Event", "New Meeting", "Go to Today", "Go to Date" @@ -346,7 +346,7 @@ action_interface_do_action (AtkAction *action, gint index) e_calendar_view_new_appointment (cal_view); break; case 1: - /* New Event */ + /* New All Day Event */ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend); e_calendar_view_new_appointment_for (cal_view, diff --git a/a11y/calendar/ea-calendar.c b/a11y/calendar/ea-calendar.c index 0882f9c653..bb528cb919 100644 --- a/a11y/calendar/ea-calendar.c +++ b/a11y/calendar/ea-calendar.c @@ -112,14 +112,15 @@ ea_calendar_focus_watcher (GSignalInvocationHint *ihint, canvas_item = GNOME_CANVAS_ITEM (object); if (event->type == GDK_FOCUS_CHANGE) { - if (event->focus_change.in) + if (event->focus_change.in) { ea_event = ea_calendar_helpers_get_accessible_for (canvas_item); - else - /* focus out */ - ea_event = NULL; - atk_focus_tracker_notify (ea_event); + if (!ea_event) + /* not canvas item we want */ + return TRUE; + } + atk_focus_tracker_notify (ea_event); } } else if (E_IS_DAY_VIEW (object)) { diff --git a/a11y/calendar/ea-week-view.c b/a11y/calendar/ea-week-view.c index 995cc01434..3c3e13a268 100644 --- a/a11y/calendar/ea-week-view.c +++ b/a11y/calendar/ea-week-view.c @@ -38,8 +38,6 @@ static gint ea_week_view_get_n_children (AtkObject *obj); static AtkObject* ea_week_view_ref_child (AtkObject *obj, gint i); -static void get_visible_text_item_count (GnomeCanvasItem *item, gpointer data); - static gpointer parent_class = NULL; GType @@ -195,15 +193,33 @@ ea_week_view_get_n_children (AtkObject *accessible) EWeekView *week_view; GnomeCanvasGroup *canvas_group; gint i, count = 0; + gint event_index; g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), -1); if (!GTK_ACCESSIBLE (accessible)->widget) return -1; week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget); - canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root); - g_list_foreach (canvas_group->item_list, (GFunc)get_visible_text_item_count, - &count); + + for (event_index = 0; event_index < week_view->events->len; + ++event_index) { + EWeekViewEvent *event; + EWeekViewEventSpan *span; + + event = &g_array_index (week_view->events, + EWeekViewEvent, event_index); + if (!event) + continue; + span = &g_array_index (week_view->spans, EWeekViewEventSpan, + event->spans_index + 0); + + if (!span) + continue; + + /* at least one of the event spans is visible, count it */ + if (span->text_item) + ++count; + } /* add the number of visible jump buttons */ for (i = 0; i < E_WEEK_VIEW_MAX_WEEKS * 7; i++) { @@ -246,10 +262,13 @@ ea_week_view_ref_child (AtkObject *accessible, gint index) event = &g_array_index (week_view->events, EWeekViewEvent, event_index); + if (!event) + continue; + span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num); - if (!event || !span) + if (!span) continue; current_day = span->start_day; @@ -284,11 +303,3 @@ ea_week_view_ref_child (AtkObject *accessible, gint index) #endif return atk_object; } - -static void get_visible_text_item_count (GnomeCanvasItem *item, gpointer data) -{ - gint *count = (gint *)data; - - if (item && E_IS_TEXT (item)) - ++(*count); -} -- cgit v1.2.3