From 55e921af93354f13406657f4a5d68c5e426d9402 Mon Sep 17 00:00:00 2001 From: Li Yuan Date: Thu, 30 Sep 2004 07:32:36 +0000 Subject: Make accessibility name and description translatable. 2004-09-23 Li Yuan * calendar/ea-cal-view-event.c: (ea_cal_view_event_get_type), (ea_cal_view_event_get_name), (ea_cal_view_event_get_description): Make accessibility name and description translatable. (atk_action_interface_init), (ea_cal_view_event_do_action), (ea_cal_view_event_get_n_actions), (ea_cal_view_event_action_get_name): Add action interface to ea-cal-view-event so that it can be UI grabbed by GOK. * calendar/ea-cal-view.c: Make accessibility name and description translatable. * calendar/ea-day-view-cell.c: (ea_day_view_cell_new): Change atk role of ea-day-view-cell from ATK_ROLE_TABLE_CELL to ATK_ROLE_UNKNOWN so that it can be UI grabbed by GOK. (atk_component_interface_init), (component_interface_grab_focus): Add a component interface function : grab_focus. When grab focus, present the Evolution GUI to the front. * calendar/ea-day-view-main-item.c: (ea_day_view_main_item_get_description): Make accessibility name and description translatable. (ea_day_view_main_item_time_change_cb): Notify the item_cell is selected. * calendar/ea-day-view.c: (ea_day_view_get_name), (ea_day_view_get_description): Make accessibility name and description translatable. * calendar/ea-gnome-calendar.c: (ea_gnome_calendar_get_name), (ea_gnome_calendar_get_description), (ea_gnome_calendar_ref_child): Make accessibility name and description translatable. * calendar/ea-jump-button.c: (ea_jump_button_get_name), (ea_jump_button_get_description): Make accessibility name and description translatable. * calendar/ea-week-view-cell.c: (ea_week_view_cell_get_name), (atk_component_interface_init), (component_interface_get_extents), (component_interface_grab_focus): Add a component interface function : grab_focus. Add support for different week start days. When grab focus, present the Evolutioon GUI to the front. * calendar/ea-week-view-main-item.c: (ea_week_view_main_item_new): Set the atk role to ATK_ROLE_TABLE. (ea_week_view_main_item_get_description): Make accessibility name and description translatable. (ea_week_view_main_item_time_change_cb): Notify the item_cell is selected. * calendar/ea-week-view.c: (ea_week_view_get_name), (ea_week_view_get_description): Make accessibility name and description translatable. * widgets/ea-calendar-cell.c: (ea_calendar_cell_new): Change atk role of ea-calendar-cell from ATK_ROLE_TABLE_CELL to ATK_ROLE_UNKNOWN so that it can be UI grabbed by GOK. * widgets/ea-calendar-item.c: (ea_calendar_item_class_init), (ea_calendar_item_get_name), (ea_calendar_item_get_description): Make accessibility name and description translatable. (ea_calendar_item_ref_state_set),: Implement ref_state_set so that ea-calendar-item can be UI grabbed by GOK. (ea_calendar_item_destory_cell_data): Fix a crash here. svn path=/trunk/; revision=27434 --- a11y/ChangeLog | 59 +++++++++++++++ a11y/calendar/ea-cal-view-event.c | 80 ++++++++++++++++++-- a11y/calendar/ea-cal-view.c | 11 +-- a11y/calendar/ea-day-view-cell.c | 41 +++++++++- a11y/calendar/ea-day-view-main-item.c | 14 +++- a11y/calendar/ea-day-view.c | 16 ++-- a11y/calendar/ea-gnome-calendar.c | 9 ++- a11y/calendar/ea-jump-button.c | 5 +- a11y/calendar/ea-week-view-cell.c | 134 +++++++++++++++++++++++++++++++-- a11y/calendar/ea-week-view-main-item.c | 13 +++- a11y/calendar/ea-week-view.c | 16 ++-- a11y/widgets/ea-calendar-cell.c | 2 +- a11y/widgets/ea-calendar-item.c | 56 +++++++++++--- 13 files changed, 401 insertions(+), 55 deletions(-) (limited to 'a11y') diff --git a/a11y/ChangeLog b/a11y/ChangeLog index c99dc53eec..5e109daf7a 100644 --- a/a11y/ChangeLog +++ b/a11y/ChangeLog @@ -1,3 +1,62 @@ +2004-09-23 Li Yuan + + * calendar/ea-cal-view-event.c: (ea_cal_view_event_get_type), + (ea_cal_view_event_get_name), (ea_cal_view_event_get_description): + Make accessibility name and description translatable. + (atk_action_interface_init), (ea_cal_view_event_do_action), + (ea_cal_view_event_get_n_actions), + (ea_cal_view_event_action_get_name): + Add action interface to ea-cal-view-event so that it can be + UI grabbed by GOK. + * calendar/ea-cal-view.c: + Make accessibility name and description translatable. + * calendar/ea-day-view-cell.c: (ea_day_view_cell_new): + Change atk role of ea-day-view-cell from ATK_ROLE_TABLE_CELL + to ATK_ROLE_UNKNOWN so that it can be UI grabbed by GOK. + (atk_component_interface_init), (component_interface_grab_focus): + Add a component interface function : grab_focus. + When grab focus, present the Evolution GUI to the front. + * calendar/ea-day-view-main-item.c: + (ea_day_view_main_item_get_description): + Make accessibility name and description translatable. + (ea_day_view_main_item_time_change_cb): + Notify the item_cell is selected. + * calendar/ea-day-view.c: (ea_day_view_get_name), + (ea_day_view_get_description): + Make accessibility name and description translatable. + * calendar/ea-gnome-calendar.c: (ea_gnome_calendar_get_name), + (ea_gnome_calendar_get_description), (ea_gnome_calendar_ref_child): + Make accessibility name and description translatable. + * calendar/ea-jump-button.c: (ea_jump_button_get_name), + (ea_jump_button_get_description): + Make accessibility name and description translatable. + * calendar/ea-week-view-cell.c: (ea_week_view_cell_get_name), + (atk_component_interface_init), (component_interface_get_extents), + (component_interface_grab_focus): + Add a component interface function : grab_focus. + Add support for different week start days. + When grab focus, present the Evolutioon GUI to the front. + * calendar/ea-week-view-main-item.c: (ea_week_view_main_item_new): + Set the atk role to ATK_ROLE_TABLE. + (ea_week_view_main_item_get_description): + Make accessibility name and description translatable. + (ea_week_view_main_item_time_change_cb): + Notify the item_cell is selected. + * calendar/ea-week-view.c: (ea_week_view_get_name), + (ea_week_view_get_description): + Make accessibility name and description translatable. + * widgets/ea-calendar-cell.c: (ea_calendar_cell_new): + Change atk role of ea-calendar-cell from ATK_ROLE_TABLE_CELL + to ATK_ROLE_UNKNOWN so that it can be UI grabbed by GOK. + * widgets/ea-calendar-item.c: (ea_calendar_item_class_init), + (ea_calendar_item_get_name), (ea_calendar_item_get_description): + Make accessibility name and description translatable. + (ea_calendar_item_ref_state_set),: + Implement ref_state_set so that ea-calendar-item can be UI + grabbed by GOK. + (ea_calendar_item_destory_cell_data): + Fix a crash here. + 2004-04-29 Rodney Dawes * calendar/Makefile.am (INCLUDES): Add $(top_srcdir)/widgets/misc diff --git a/a11y/calendar/ea-cal-view-event.c b/a11y/calendar/ea-cal-view-event.c index 5f9e7eb9ba..3a389b2324 100644 --- a/a11y/calendar/ea-cal-view-event.c +++ b/a11y/calendar/ea-cal-view-event.c @@ -28,6 +28,7 @@ #include "ea-day-view.h" #include "ea-week-view.h" #include +#include static void ea_cal_view_event_class_init (EaCalViewEventClass *klass); @@ -41,6 +42,12 @@ static void atk_component_interface_init (AtkComponentIface *iface); static void ea_cal_view_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); +/* action interface */ +static void atk_action_interface_init (AtkActionIface *iface); +static gboolean ea_cal_view_event_do_action (AtkAction *action, gint i); +static gint ea_cal_view_event_get_n_actions (AtkAction *action); +static G_CONST_RETURN gchar* ea_cal_view_event_action_get_name (AtkAction *action, gint i); + #ifdef ACC_DEBUG static gint n_ea_cal_view_event_created = 0, n_ea_cal_view_event_destroyed = 0; @@ -78,6 +85,13 @@ ea_cal_view_event_get_type (void) NULL }; + static const GInterfaceInfo atk_action_info = { + (GInterfaceInitFunc) atk_action_interface_init, + (GInterfaceFinalizeFunc) NULL, + NULL + }; + + /* * Figure out the size of the class and instance * we are run-time deriving from (atk object for E_TEXT, in this case) @@ -96,6 +110,10 @@ ea_cal_view_event_get_type (void) "EaCalViewEvent", &tinfo, 0); g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info); + g_type_add_interface_static (type, ATK_TYPE_ACTION, + &atk_action_info); + + } return type; @@ -214,30 +232,30 @@ ea_cal_view_event_get_name (AtkObject *accessible) if (event && event->comp_data) { if (e_cal_util_component_has_alarms (event->comp_data->icalcomp)) { tmp_name = new_name; - new_name = g_strconcat (new_name, "alarm ", NULL); + new_name = g_strconcat (new_name, _("alarm "), NULL); g_free (tmp_name); } if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) { tmp_name = new_name; - new_name = g_strconcat (new_name, "recurrence ", NULL); + new_name = g_strconcat (new_name, _("recurrence "), NULL); g_free (tmp_name); } if (event->different_timezone) { tmp_name = new_name; - new_name = g_strconcat (new_name, "time-zone ", NULL); + new_name = g_strconcat (new_name, _("time-zone "), NULL); g_free (tmp_name); } if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) { tmp_name = new_name; - new_name = g_strconcat (new_name, "meeting ", NULL); + new_name = g_strconcat (new_name, _("meeting "), NULL); g_free (tmp_name); } } tmp_name = new_name; - new_name = g_strconcat (new_name, "event. Summary is ", NULL); + new_name = g_strconcat (new_name, _("event. Summary is "), NULL); g_free (tmp_name); summary = icalcomponent_get_summary (event->comp_data->icalcomp); @@ -248,7 +266,7 @@ ea_cal_view_event_get_name (AtkObject *accessible) } else { tmp_name = new_name; - new_name = g_strconcat (new_name, "empty", NULL); + new_name = g_strconcat (new_name, _("empty"), NULL); g_free (tmp_name); } @@ -267,7 +285,7 @@ ea_cal_view_event_get_description (AtkObject *accessible) if (accessible->description) return accessible->description; - return "calendar view event"; + return _("calendar view event"); } static AtkObject * @@ -480,3 +498,51 @@ ea_cal_view_get_extents (AtkComponent *component, printf ("Event Bounds (%d, %d, %d, %d)\n", *x, *y, *width, *height); #endif } + +#define CAL_VIEW_EVENT_ACTION_NUM 1 + +static const char * action_name [CAL_VIEW_EVENT_ACTION_NUM] = { + N_("Grab Focus") +}; + +static void +atk_action_interface_init (AtkActionIface *iface) +{ + g_return_if_fail (iface != NULL); + + iface->do_action = ea_cal_view_event_do_action; + iface->get_n_actions = ea_cal_view_event_get_n_actions; + iface->get_name = ea_cal_view_event_action_get_name; +} + +static gboolean +ea_cal_view_event_do_action (AtkAction *action, gint i) +{ + AtkGObjectAccessible *atk_gobj; + AtkComponent *atk_comp; + + atk_gobj = ATK_GOBJECT_ACCESSIBLE (action); + + if (i == 0) { + atk_comp = (AtkComponent *)atk_gobj; + return atk_component_grab_focus (atk_comp); + } + + return FALSE; + +} + +static gint +ea_cal_view_event_get_n_actions (AtkAction *action) +{ + return CAL_VIEW_EVENT_ACTION_NUM; +} + +static G_CONST_RETURN gchar* +ea_cal_view_event_action_get_name (AtkAction *action, gint i) +{ + if (i >= 0 && i < CAL_VIEW_EVENT_ACTION_NUM) + return action_name [i]; + return NULL; +} + diff --git a/a11y/calendar/ea-cal-view.c b/a11y/calendar/ea-cal-view.c index 2d86d9ef10..31400ca2da 100644 --- a/a11y/calendar/ea-cal-view.c +++ b/a11y/calendar/ea-cal-view.c @@ -30,6 +30,7 @@ #include "calendar-commands.h" #include "goto.h" #include +#include static void ea_cal_view_class_init (EaCalViewClass *klass); @@ -302,11 +303,11 @@ ea_cal_view_dates_change_cb (GnomeCalendar *gcal, gpointer data) #define CAL_VIEW_ACTION_NUM 5 static const char * action_name [CAL_VIEW_ACTION_NUM] = { - "New Appointment", - "New All Day Event", - "New Meeting", - "Go to Today", - "Go to Date" + N_("New Appointment"), + N_("New All Day Event"), + N_("New Meeting"), + N_("Go to Today"), + N_("Go to Date") }; static void diff --git a/a11y/calendar/ea-day-view-cell.c b/a11y/calendar/ea-day-view-cell.c index 6fe6cf7077..5b1f81ae1a 100644 --- a/a11y/calendar/ea-day-view-cell.c +++ b/a11y/calendar/ea-day-view-cell.c @@ -103,6 +103,8 @@ static void component_interface_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); +static gboolean component_interface_grab_focus (AtkComponent *component); + static gpointer parent_class = NULL; #ifdef ACC_DEBUG @@ -175,7 +177,7 @@ ea_day_view_cell_new (GObject *obj) object = g_object_new (EA_TYPE_DAY_VIEW_CELL, NULL); atk_object = ATK_OBJECT (object); atk_object_initialize (atk_object, obj); - atk_object->role = ATK_ROLE_TABLE_CELL; + atk_object->role = ATK_ROLE_UNKNOWN; #ifdef ACC_DEBUG ++n_ea_day_view_cell_created; @@ -314,6 +316,7 @@ atk_component_interface_init (AtkComponentIface *iface) g_return_if_fail (iface != NULL); iface->get_extents = component_interface_get_extents; + iface->grab_focus = component_interface_grab_focus; } static void @@ -355,3 +358,39 @@ component_interface_get_extents (AtkComponent *component, *width = day_view->day_widths[cell->column]; *height = day_view->row_height; } + +static gboolean +component_interface_grab_focus (AtkComponent *comp) +{ + GObject *g_obj; + EDayViewCell *cell; + EDayView *day_view; + GtkWidget *toplevel; + + g_return_val_if_fail (EA_IS_DAY_VIEW_CELL (comp), FALSE); + + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (comp)); + if (!g_obj) + return FALSE; + + cell = E_DAY_VIEW_CELL (g_obj); + day_view = cell->day_view; + + day_view->selection_start_day = cell->column; + day_view->selection_end_day = cell->column; + day_view->selection_start_row = cell->row; + day_view->selection_end_row = cell->row; + + e_day_view_ensure_rows_visible (day_view, + day_view->selection_start_row, + day_view->selection_end_row); + e_day_view_update_calendar_selection_time (day_view); + gtk_widget_queue_draw (day_view->main_canvas); + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (day_view)); + if (GTK_WIDGET_TOPLEVEL (toplevel)) + gtk_window_present (GTK_WINDOW (toplevel)); + + return TRUE; +} + diff --git a/a11y/calendar/ea-day-view-main-item.c b/a11y/calendar/ea-day-view-main-item.c index 3583da5a31..b65ad63957 100644 --- a/a11y/calendar/ea-day-view-main-item.c +++ b/a11y/calendar/ea-day-view-main-item.c @@ -28,6 +28,7 @@ #include "ea-day-view.h" #include "ea-day-view-cell.h" #include "ea-cell-table.h" +#include /* EaDayViewMainItem */ static void ea_day_view_main_item_class_init (EaDayViewMainItemClass *klass); @@ -295,7 +296,7 @@ ea_day_view_main_item_get_name (AtkObject *accessible) static G_CONST_RETURN gchar* ea_day_view_main_item_get_description (AtkObject *accessible) { - return "a table to view and select the current time range"; + return _("a table to view and select the current time range"); } static gint @@ -441,11 +442,16 @@ ea_day_view_main_item_time_change_cb (EDayView *day_view, gpointer data) state_set = atk_object_ref_state_set (item_cell); atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); g_object_unref (state_set); - } - g_signal_emit_by_name (ea_main_item, + + g_signal_emit_by_name (ea_main_item, "active-descendant-changed", item_cell); - g_signal_emit_by_name (data, "selection_changed"); + g_signal_emit_by_name (data, "selection_changed"); + + atk_focus_tracker_notify (item_cell); + g_object_unref (item_cell); + } + } /* helpers */ diff --git a/a11y/calendar/ea-day-view.c b/a11y/calendar/ea-day-view.c index f91583da24..7f5926e9a6 100644 --- a/a11y/calendar/ea-day-view.c +++ b/a11y/calendar/ea-day-view.c @@ -29,6 +29,7 @@ #include "ea-calendar-helpers.h" #include "calendar-commands.h" #include +#include static void ea_day_view_class_init (EaDayViewClass *klass); @@ -141,16 +142,19 @@ ea_day_view_get_name (AtkObject *accessible) n_events = atk_object_get_n_accessible_children (accessible); /* the child main item is always there */ --n_events; - if (n_events > 0) + if (n_events = 1) g_snprintf (buffer, sizeof (buffer), - ", %d events", n_events); + _(", %d event"), n_events); + if (n_events > 1) + g_snprintf (buffer, sizeof (buffer), + _(", %d events"), n_events); view_type = gnome_calendar_get_view (gcal); if (view_type == GNOME_CAL_WORK_WEEK_VIEW) - accessible->name = g_strconcat ("work week view :", + accessible->name = g_strconcat (_("work week view :"), label_text, buffer, NULL); else - accessible->name = g_strconcat ("day view :", + accessible->name = g_strconcat (_("day view :"), label_text, buffer, NULL); return accessible->name; @@ -177,9 +181,9 @@ ea_day_view_get_description (AtkObject *accessible) view_type = gnome_calendar_get_view (gcal); if (view_type == GNOME_CAL_WORK_WEEK_VIEW) - return "calendar view for a work week"; + return _("calendar view for a work week"); else - return "calendar view for one or more days"; + return _("calendar view for one or more days"); } } diff --git a/a11y/calendar/ea-gnome-calendar.c b/a11y/calendar/ea-gnome-calendar.c index 9d057ee31a..80870e6c33 100644 --- a/a11y/calendar/ea-gnome-calendar.c +++ b/a11y/calendar/ea-gnome-calendar.c @@ -26,6 +26,7 @@ #include "ea-gnome-calendar.h" #include "calendar-commands.h" #include +#include static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass); @@ -139,7 +140,7 @@ ea_gnome_calendar_get_name (AtkObject *accessible) { if (accessible->name) return accessible->name; - return "Gnome Calendar"; + return _("Gnome Calendar"); } static G_CONST_RETURN gchar* @@ -147,7 +148,7 @@ ea_gnome_calendar_get_description (AtkObject *accessible) { if (accessible->description) return accessible->description; - return "Gnome Calendar"; + return _("Gnome Calendar"); } static gint @@ -182,8 +183,8 @@ ea_gnome_calendar_ref_child (AtkObject *obj, gint i) childWidget = gnome_calendar_get_search_bar_widget (calendarWidget); child = gtk_widget_get_accessible (childWidget); atk_object_set_parent (child, obj); - atk_object_set_name (child, "search bar"); - atk_object_set_description (child, "evolution calendar search bar"); + atk_object_set_name (child, _("search bar")); + atk_object_set_description (child, _("evolution calendar search bar")); break; case 1: /* for the day/week view */ diff --git a/a11y/calendar/ea-jump-button.c b/a11y/calendar/ea-jump-button.c index 2209447ced..d9bab31943 100644 --- a/a11y/calendar/ea-jump-button.c +++ b/a11y/calendar/ea-jump-button.c @@ -28,6 +28,7 @@ #include "ea-week-view.h" #include "e-week-view.h" #include +#include static void ea_jump_button_class_init (EaJumpButtonClass *klass); @@ -145,7 +146,7 @@ ea_jump_button_get_name (AtkObject *accessible) if (accessible->name) return accessible->name; - return "Jump"; + return _("Jump button"); } static G_CONST_RETURN gchar* @@ -154,7 +155,7 @@ ea_jump_button_get_description (AtkObject *accessible) if (accessible->description) return accessible->description; - return "Click here, you can find more events."; + return _("Click here, you can find more events."); } static void diff --git a/a11y/calendar/ea-week-view-cell.c b/a11y/calendar/ea-week-view-cell.c index 5d97ed74b4..543b26794a 100644 --- a/a11y/calendar/ea-week-view-cell.c +++ b/a11y/calendar/ea-week-view-cell.c @@ -103,6 +103,8 @@ static void component_interface_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); +static gboolean component_interface_grab_focus (AtkComponent *component); + static gpointer parent_class = NULL; #ifdef ACC_DEBUG @@ -208,6 +210,8 @@ ea_week_view_cell_get_name (AtkObject *accessible) GnomeCanvasItem *main_item; gchar *new_name = g_strdup (""); const gchar *row_label, *column_label; + gint new_column, new_row; + gint start_day; atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible); g_obj = atk_gobject_accessible_get_object (atk_gobj); @@ -217,10 +221,20 @@ ea_week_view_cell_get_name (AtkObject *accessible) cell = E_WEEK_VIEW_CELL (g_obj); main_item = cell->week_view->main_canvas_item; ea_main_item = atk_gobject_accessible_for_object (G_OBJECT (main_item)); + + start_day = cell->week_view->display_start_day; + if (cell->column + start_day >= 7) { + new_column = cell->column + start_day - 7; + new_row = cell->row + 1; + } else { + new_column = cell->column + start_day; + new_row = cell->row; + } + column_label = atk_table_get_column_description (ATK_TABLE (ea_main_item), - cell->column); + new_column); row_label = atk_table_get_row_description (ATK_TABLE (ea_main_item), - cell->row); + new_row); new_name = g_strconcat (column_label, " ", row_label, NULL); ATK_OBJECT_CLASS (parent_class)->set_name (accessible, new_name); g_free (new_name); @@ -314,6 +328,7 @@ atk_component_interface_init (AtkComponentIface *iface) g_return_if_fail (iface != NULL); iface->get_extents = component_interface_get_extents; + iface->grab_focus = component_interface_grab_focus; } static void @@ -328,6 +343,7 @@ component_interface_get_extents (AtkComponent *component, GtkWidget *main_canvas; gint week_view_width, week_view_height; gint scroll_x, scroll_y; + gint start_day; *x = *y = *width = *height = 0; @@ -349,8 +365,114 @@ component_interface_get_extents (AtkComponent *component, coord_type); gnome_canvas_get_scroll_offsets (GNOME_CANVAS (week_view->main_canvas), &scroll_x, &scroll_y); - *x += week_view->col_offsets[cell->column] - scroll_x; - *y += week_view->row_offsets[cell->row*2]- scroll_y; - *width = week_view->col_widths[cell->column]; - *height = week_view->row_heights[ cell->row*2]*2; + start_day = week_view->display_start_day; + if (week_view->multi_week_view) { + if (week_view->compress_weekend && (cell->column == (5 - start_day))) { + *height = week_view->row_heights[cell->row*2]; + *width = week_view->col_widths[cell->column]; + *x += week_view->col_offsets[cell->column] - scroll_x; + *y += week_view->row_offsets[cell->row*2]- scroll_y; + } else if (week_view->compress_weekend && (cell->column == (6 - start_day))) { + *height = week_view->row_heights[cell->row*2]; + *width = week_view->col_widths[cell->column - 1]; + *x += week_view->col_offsets[cell->column - 1]- scroll_x; + *y += week_view->row_offsets[cell->row*2 + 1]- scroll_y; + } else if (week_view->compress_weekend && (cell->column > (6 - start_day))){ + *height = week_view->row_heights[cell->row*2]*2; + *width = week_view->col_widths[cell->column - 1]; + *x += week_view->col_offsets[cell->column - 1] - scroll_x; + *y += week_view->row_offsets[cell->row*2]- scroll_y; + } else { + *height = week_view->row_heights[cell->row*2]*2; + *width = week_view->col_widths[cell->column]; + *x += week_view->col_offsets[cell->column] - scroll_x; + *y += week_view->row_offsets[cell->row*2]- scroll_y; + } + } else { + if (start_day < 3) { + if (cell->column < 3) { + *height = week_view->row_heights[cell->column*2]*2; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2]- scroll_y; + } else { + if (cell->column == 5 - start_day) { + *height = week_view->row_heights[(cell->column - 3)*2]; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 3)*2]- scroll_y; + } else if (cell->column == 6 - start_day) { + *height = week_view->row_heights[(cell->column - 4)*2]; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 3)*2 - 1]- scroll_y; + } else if (cell->column > 6 - start_day) { + *height = week_view->row_heights[(cell->column - 4)*2]*2; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 4)*2]- scroll_y; + } else { + *height = week_view->row_heights[(cell->column - 3)*2]*2; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 3)*2]- scroll_y; + } + } + } else if (cell->column < 4) { + if (cell->column == 5 - start_day) { + *height = week_view->row_heights[cell->column*2]; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2]- scroll_y; + } else if (cell->column == 6 - start_day) { + *height = week_view->row_heights[(cell->column - 1)*2]; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2 - 1]- scroll_y; + } else if (cell->column > 6 - start_day) { + *height = week_view->row_heights[(cell->column - 1)*2]*2; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[(cell->column - 1)*2]- scroll_y; + } else { + *height = week_view->row_heights[(cell->column)*2]*2; + *width = week_view->col_widths[0]; + *x += week_view->col_offsets[0] - scroll_x; + *y += week_view->row_offsets[cell->column*2]- scroll_y; + } + } else { + *height = week_view->row_heights[(cell->column - 4)*2]*2; + *width = week_view->col_widths[1]; + *x += week_view->col_offsets[1] - scroll_x; + *y += week_view->row_offsets[(cell->column - 4)*2]- scroll_y; + } + } +} + +static gboolean +component_interface_grab_focus (AtkComponent *comp) +{ + GObject *g_obj; + EWeekViewCell *cell; + EWeekView *week_view; + GtkWidget *toplevel; + + g_return_val_if_fail (EA_IS_WEEK_VIEW_CELL (comp), FALSE); + + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (comp)); + if (!g_obj) + return FALSE; + + cell = E_WEEK_VIEW_CELL (g_obj); + week_view = cell->week_view; + + week_view->selection_start_day = cell->row * 7 + cell->column; + week_view->selection_end_day = cell->row * 7 + cell->column; + gtk_widget_queue_draw (week_view->main_canvas); + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (week_view)); + if (GTK_WIDGET_TOPLEVEL (toplevel)) + gtk_window_present (GTK_WINDOW (toplevel)); + + return TRUE; } diff --git a/a11y/calendar/ea-week-view-main-item.c b/a11y/calendar/ea-week-view-main-item.c index 073ec7e10c..2d013dc802 100644 --- a/a11y/calendar/ea-week-view-main-item.c +++ b/a11y/calendar/ea-week-view-main-item.c @@ -28,6 +28,7 @@ #include "ea-week-view.h" #include "ea-week-view-cell.h" #include "ea-cell-table.h" +#include /* EaWeekViewMainItem */ static void ea_week_view_main_item_class_init (EaWeekViewMainItemClass *klass); @@ -242,6 +243,7 @@ ea_week_view_main_item_new (GObject *obj) NULL)); atk_object_initialize (accessible, obj); + accessible->role = ATK_ROLE_TABLE; #ifdef ACC_DEBUG ++n_ea_week_view_main_item_created; @@ -296,7 +298,7 @@ ea_week_view_main_item_get_name (AtkObject *accessible) static G_CONST_RETURN gchar* ea_week_view_main_item_get_description (AtkObject *accessible) { - return "a table to view and select the current time range"; + return _("a table to view and select the current time range"); } static gint @@ -445,11 +447,14 @@ ea_week_view_main_item_time_change_cb (EWeekView *week_view, gpointer data) state_set = atk_object_ref_state_set (item_cell); atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); g_object_unref (state_set); - } - g_signal_emit_by_name (ea_main_item, + + g_signal_emit_by_name (ea_main_item, "active-descendant-changed", item_cell); - g_signal_emit_by_name (data, "selection_changed"); + g_signal_emit_by_name (data, "selection_changed"); + atk_focus_tracker_notify (item_cell); + g_object_unref (item_cell); + } } /* helpers */ diff --git a/a11y/calendar/ea-week-view.c b/a11y/calendar/ea-week-view.c index 23e6e649c3..3d84f422bc 100644 --- a/a11y/calendar/ea-week-view.c +++ b/a11y/calendar/ea-week-view.c @@ -29,6 +29,7 @@ #include "ea-calendar-helpers.h" #include "calendar-commands.h" #include +#include static void ea_week_view_class_init (EaWeekViewClass *klass); @@ -142,19 +143,22 @@ ea_week_view_get_name (AtkObject *accessible) n_events = atk_object_get_n_accessible_children (accessible); /* the child main item is always there */ --n_events; - if (n_events > 0) + if (n_events = 1) g_snprintf (buffer, sizeof (buffer), - ", %d events", n_events); + _(", %d event"), n_events); + if (n_events > 1) + g_snprintf (buffer, sizeof (buffer), + _(", %d events"), n_events); view_type = gnome_calendar_get_view (gcal); if (view_type == GNOME_CAL_MONTH_VIEW) - accessible->name = g_strconcat ("month view :", + accessible->name = g_strconcat (_("month view :"), label_text, buffer, NULL); else - accessible->name = g_strconcat ("week view :", + accessible->name = g_strconcat (_("week view :"), label_text, buffer, NULL); return accessible->name; @@ -181,9 +185,9 @@ ea_week_view_get_description (AtkObject *accessible) view_type = gnome_calendar_get_view (gcal); if (view_type == GNOME_CAL_MONTH_VIEW) - return "calendar view for a month"; + return _("calendar view for a month"); else - return "calendar view for one or more weeks"; + return _("calendar view for one or more weeks"); } } diff --git a/a11y/widgets/ea-calendar-cell.c b/a11y/widgets/ea-calendar-cell.c index 41c75f64ac..682485605f 100644 --- a/a11y/widgets/ea-calendar-cell.c +++ b/a11y/widgets/ea-calendar-cell.c @@ -172,7 +172,7 @@ ea_calendar_cell_new (GObject *obj) object = g_object_new (EA_TYPE_CALENDAR_CELL, NULL); atk_object = ATK_OBJECT (object); atk_object_initialize (atk_object, obj); - atk_object->role = ATK_ROLE_TABLE_CELL; + atk_object->role = ATK_ROLE_UNKNOWN; #ifdef ACC_DEBUG ++n_ea_calendar_cell_created; diff --git a/a11y/widgets/ea-calendar-item.c b/a11y/widgets/ea-calendar-item.c index 50cbafa08c..ac5eb1ff41 100644 --- a/a11y/widgets/ea-calendar-item.c +++ b/a11y/widgets/ea-calendar-item.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "ea-calendar-item.h" #include "ea-calendar-cell.h" #include "ea-cell-table.h" @@ -42,6 +44,7 @@ static G_CONST_RETURN gchar* ea_calendar_item_get_name (AtkObject *accessible); static G_CONST_RETURN gchar* ea_calendar_item_get_description (AtkObject *accessible); static gint ea_calendar_item_get_n_children (AtkObject *accessible); static AtkObject *ea_calendar_item_ref_child (AtkObject *accessible, gint index); +static AtkStateSet* ea_calendar_item_ref_state_set (AtkObject *accessible); /* atk table interface */ static void atk_table_interface_init (AtkTableIface *iface); @@ -201,6 +204,7 @@ ea_calendar_item_class_init (EaCalendarItemClass *klass) class->get_name = ea_calendar_item_get_name; class->get_description = ea_calendar_item_get_description; + class->ref_state_set = ea_calendar_item_ref_state_set; class->get_n_children = ea_calendar_item_get_n_children; class->ref_child = ea_calendar_item_ref_child; @@ -264,6 +268,10 @@ ea_calendar_item_get_name (AtkObject *accessible) gint start_year, start_month, start_day; gint end_year, end_month, end_day; static gchar new_name[256] = ""; + gchar buffer_start[128] = ""; + gchar buffer_end[128] = ""; + struct tm day_start = { 0 }; + struct tm day_end = { 0 }; g_return_val_if_fail (EA_IS_CALENDAR_ITEM (accessible), NULL); @@ -276,13 +284,26 @@ ea_calendar_item_get_name (AtkObject *accessible) calitem = E_CALENDAR_ITEM (g_obj); if (e_calendar_item_get_date_range (calitem, &start_year, &start_month, &start_day, - &end_year, &end_month, &end_day)) { - ++start_month; - ++end_month; - sprintf (new_name, "calendar (from %d-%d-%d to %d-%d-%d)", - start_year, start_month, start_day, - end_year, end_month, end_day); - } + &end_year, &end_month, &end_day)) { + + day_start.tm_year = start_year - 1900; + day_start.tm_mon = start_month; + day_start.tm_mday = start_day; + day_start.tm_isdst = -1; + e_utf8_strftime (buffer_start, sizeof (buffer_start), _(" %d %B %Y"), &day_start); + + day_end.tm_year = end_year - 1900; + day_end.tm_mon = end_month; + day_end.tm_mday = end_day; + day_end.tm_isdst = -1; + e_utf8_strftime (buffer_end, sizeof (buffer_end), _(" %d %B %Y"), &day_end); + + strcat (new_name, _("calendar (from ")); + strcat (new_name, buffer_start); + strcat (new_name, _(" to ")); + strcat (new_name, buffer_end); + strcat (new_name, _(")")); + } #if 0 if (e_calendar_item_get_selection (calitem, &select_start, &select_end)) { @@ -313,7 +334,24 @@ ea_calendar_item_get_description (AtkObject *accessible) if (accessible->description) return accessible->description; - return "evolution calendar item"; + return _("evolution calendar item"); +} + +static AtkStateSet* +ea_calendar_item_ref_state_set (AtkObject *accessible) +{ + AtkStateSet *state_set; + GObject *g_obj; + + state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible); + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible)); + if (!g_obj) + return state_set; + + atk_state_set_add_state (state_set, ATK_STATE_ENABLED); + atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE); + + return state_set; } static gint @@ -1039,9 +1077,9 @@ ea_calendar_item_destory_cell_data (EaCalendarItem *ea_calitem) cell_data = g_object_get_data (G_OBJECT(ea_calitem), "ea-calendar-cell-table"); if (cell_data) { - ea_cell_table_destroy (cell_data); g_object_set_data (G_OBJECT(ea_calitem), "ea-calendar-cell-table", NULL); + ea_cell_table_destroy (cell_data); } } -- cgit v1.2.3