Re: [evolution-patches] Patch about a11y bugs
- From: Li Yuan <Li Yuan Sun COM>
- To: Rodrigo Moya <rodrigo novell com>
- Cc: evolution-patches ximian com
- Subject: Re: [evolution-patches] Patch about a11y bugs
- Date: Fri, 24 Sep 2004 22:31:10 +0800
Hi,
Attach is a new patch. Is it OK now?
Sorry, I think I forgot to cc to evolution-patches.
Li
Rodrigo Moya wrote:
On Thu, 2004-09-23 at 12:38 +0200, Rodrigo Moya wrote:
On Thu, 2004-09-23 at 12:14 +0800, Li Yuan wrote:
Hi, JP and Rodrigo
Now I have a patch in a11y directory for cvs HEAD. It fixes some a11y
bugs. The patch has passed our internel review.
I understood last time you were going to have Sun approvals going also
to the e-p list, wasn't it that what we decided last time?
Please help me to review it. Thanks a lot.
@@ -143,14 +144,14 @@
--n_events;
if (n_events > 0)
g_snprintf (buffer, sizeof (buffer),
- ", %d events", n_events);
+ _(", %d events"), n_events);
I think translators will complain about this string, because of
different usage of singular/plural in many languages.
@@ -144,17 +145,17 @@
--n_events;
if (n_events > 0)
g_snprintf (buffer, sizeof (buffer),
- ", %d events", n_events);
+ _(", %d events"), n_events);
ditto here
@@ -279,7 +282,7 @@
&end_year, &end_month,
&end_day)) {
++start_month;
++end_month;
- sprintf (new_name, "calendar (from %d-%d-%d to %d-%d-%
d)",
+ sprintf (new_name, _("calendar (from %d-%d-%d to %d-%
d-%d)"),
and here something similar might happen, due to the differences in date
formats.
The rest looks ok to me code-wise, not sure about the a11y correctness,
but if it passed your internal review, I guess you can commit to HEAD.
...after fixing the above mentioned problems :)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/a11y/ChangeLog,v
retrieving revision 1.19
diff -u -r1.19 ChangeLog
--- ChangeLog 30 Apr 2004 02:49:01 -0000 1.19
+++ ChangeLog 24 Sep 2004 14:06:03 -0000
@@ -1,3 +1,62 @@
+2004-09-23 Li Yuan <li yuan sun com>
+
+ * 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 <dobey ximian com>
* calendar/Makefile.am (INCLUDES): Add $(top_srcdir)/widgets/misc
Index: calendar/ea-cal-view-event.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-cal-view-event.c,v
retrieving revision 1.9
diff -u -r1.9 ea-cal-view-event.c
--- calendar/ea-cal-view-event.c 10 Dec 2003 03:56:30 -0000 1.9
+++ calendar/ea-cal-view-event.c 24 Sep 2004 14:06:04 -0000
@@ -28,6 +28,7 @@
#include "ea-day-view.h"
#include "ea-week-view.h"
#include <gal/e-text/e-text.h>
+#include <libgnome/gnome-i18n.h>
static void ea_cal_view_event_class_init (EaCalViewEventClass *klass);
@@ -41,6 +42,12 @@
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 @@
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 @@
"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 @@
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 @@
}
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 @@
if (accessible->description)
return accessible->description;
- return "calendar view event";
+ return _("calendar view event");
}
static AtkObject *
@@ -480,3 +498,51 @@
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;
+}
+
Index: calendar/ea-cal-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-cal-view.c,v
retrieving revision 1.5
diff -u -r1.5 ea-cal-view.c
--- calendar/ea-cal-view.c 9 Dec 2003 01:28:57 -0000 1.5
+++ calendar/ea-cal-view.c 24 Sep 2004 14:06:04 -0000
@@ -30,6 +30,7 @@
#include "calendar-commands.h"
#include "goto.h"
#include <glib/gstrfuncs.h>
+#include <libgnome/gnome-i18n.h>
static void ea_cal_view_class_init (EaCalViewClass *klass);
@@ -302,11 +303,11 @@
#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
Index: calendar/ea-day-view-cell.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-day-view-cell.c,v
retrieving revision 1.2
diff -u -r1.2 ea-day-view-cell.c
--- calendar/ea-day-view-cell.c 10 Dec 2003 03:56:30 -0000 1.2
+++ calendar/ea-day-view-cell.c 24 Sep 2004 14:06:04 -0000
@@ -103,6 +103,8 @@
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 @@
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 @@
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 @@
*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;
+}
+
Index: calendar/ea-day-view-main-item.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-day-view-main-item.c,v
retrieving revision 1.3
diff -u -r1.3 ea-day-view-main-item.c
--- calendar/ea-day-view-main-item.c 10 Dec 2003 03:56:30 -0000 1.3
+++ calendar/ea-day-view-main-item.c 24 Sep 2004 14:06:05 -0000
@@ -28,6 +28,7 @@
#include "ea-day-view.h"
#include "ea-day-view-cell.h"
#include "ea-cell-table.h"
+#include <libgnome/gnome-i18n.h>
/* EaDayViewMainItem */
static void ea_day_view_main_item_class_init (EaDayViewMainItemClass *klass);
@@ -295,7 +296,7 @@
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 @@
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 */
Index: calendar/ea-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-day-view.c,v
retrieving revision 1.4
diff -u -r1.4 ea-day-view.c
--- calendar/ea-day-view.c 7 Nov 2003 07:12:35 -0000 1.4
+++ calendar/ea-day-view.c 24 Sep 2004 14:06:05 -0000
@@ -29,6 +29,7 @@
#include "ea-calendar-helpers.h"
#include "calendar-commands.h"
#include <glib/gstrfuncs.h>
+#include <libgnome/gnome-i18n.h>
static void ea_day_view_class_init (EaDayViewClass *klass);
@@ -141,16 +142,19 @@
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 @@
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");
}
}
Index: calendar/ea-gnome-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-gnome-calendar.c,v
retrieving revision 1.4
diff -u -r1.4 ea-gnome-calendar.c
--- calendar/ea-gnome-calendar.c 4 Nov 2003 08:15:56 -0000 1.4
+++ calendar/ea-gnome-calendar.c 24 Sep 2004 14:06:05 -0000
@@ -26,6 +26,7 @@
#include "ea-gnome-calendar.h"
#include "calendar-commands.h"
#include <gtk/gtknotebook.h>
+#include <libgnome/gnome-i18n.h>
static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
@@ -139,7 +140,7 @@
{
if (accessible->name)
return accessible->name;
- return "Gnome Calendar";
+ return _("Gnome Calendar");
}
static G_CONST_RETURN gchar*
@@ -147,7 +148,7 @@
{
if (accessible->description)
return accessible->description;
- return "Gnome Calendar";
+ return _("Gnome Calendar");
}
static gint
@@ -182,8 +183,8 @@
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 */
Index: calendar/ea-jump-button.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-jump-button.c,v
retrieving revision 1.1
diff -u -r1.1 ea-jump-button.c
--- calendar/ea-jump-button.c 9 Dec 2003 07:09:24 -0000 1.1
+++ calendar/ea-jump-button.c 24 Sep 2004 14:06:05 -0000
@@ -28,6 +28,7 @@
#include "ea-week-view.h"
#include "e-week-view.h"
#include <libgnomecanvas/gnome-canvas.h>
+#include <libgnome/gnome-i18n.h>
static void ea_jump_button_class_init (EaJumpButtonClass *klass);
@@ -145,7 +146,7 @@
if (accessible->name)
return accessible->name;
- return "Jump";
+ return _("Jump button");
}
static G_CONST_RETURN gchar*
@@ -154,7 +155,7 @@
if (accessible->description)
return accessible->description;
- return "Click here, you can find more events.";
+ return _("Click here, you can find more events.");
}
static void
Index: calendar/ea-week-view-cell.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-week-view-cell.c,v
retrieving revision 1.1
diff -u -r1.1 ea-week-view-cell.c
--- calendar/ea-week-view-cell.c 9 Dec 2003 07:09:24 -0000 1.1
+++ calendar/ea-week-view-cell.c 24 Sep 2004 14:06:06 -0000
@@ -103,6 +103,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
}
Index: calendar/ea-week-view-main-item.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-week-view-main-item.c,v
retrieving revision 1.1
diff -u -r1.1 ea-week-view-main-item.c
--- calendar/ea-week-view-main-item.c 9 Dec 2003 07:09:24 -0000 1.1
+++ calendar/ea-week-view-main-item.c 24 Sep 2004 14:06:07 -0000
@@ -28,6 +28,7 @@
#include "ea-week-view.h"
#include "ea-week-view-cell.h"
#include "ea-cell-table.h"
+#include <libgnome/gnome-i18n.h>
/* EaWeekViewMainItem */
static void ea_week_view_main_item_class_init (EaWeekViewMainItemClass *klass);
@@ -242,6 +243,7 @@
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 @@
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 @@
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 */
Index: calendar/ea-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/calendar/ea-week-view.c,v
retrieving revision 1.7
diff -u -r1.7 ea-week-view.c
--- calendar/ea-week-view.c 23 Apr 2004 07:04:33 -0000 1.7
+++ calendar/ea-week-view.c 24 Sep 2004 14:06:08 -0000
@@ -29,6 +29,7 @@
#include "ea-calendar-helpers.h"
#include "calendar-commands.h"
#include <gal/e-text/e-text.h>
+#include <libgnome/gnome-i18n.h>
static void ea_week_view_class_init (EaWeekViewClass *klass);
@@ -142,19 +143,22 @@
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 @@
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");
}
}
Index: widgets/ea-calendar-cell.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/widgets/ea-calendar-cell.c,v
retrieving revision 1.2
diff -u -r1.2 ea-calendar-cell.c
--- widgets/ea-calendar-cell.c 10 Dec 2003 03:56:31 -0000 1.2
+++ widgets/ea-calendar-cell.c 24 Sep 2004 14:06:09 -0000
@@ -172,7 +172,7 @@
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;
Index: widgets/ea-calendar-item.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/widgets/ea-calendar-item.c,v
retrieving revision 1.4
diff -u -r1.4 ea-calendar-item.c
--- widgets/ea-calendar-item.c 10 Dec 2003 03:56:31 -0000 1.4
+++ widgets/ea-calendar-item.c 24 Sep 2004 14:06:10 -0000
@@ -28,6 +28,8 @@
#include <string.h>
#include <libgnomecanvas/gnome-canvas.h>
#include <glib/gdate.h>
+#include <gal/util/e-util.h>
+#include <libgnome/gnome-i18n.h>
#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_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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]