[evolution-patches] seek review for accessibility patch for evolution calendar
- From: Bolian Yin <bolian yin sun com>
- To: JP Rosevear <jpr ximian com>, Rodrigo Moya <rodrigo ximian com>, EvolutionAcc <sceri-evolution-acc sun com>, Evolution Patches <evolution-patches ximian com>
- Subject: [evolution-patches] seek review for accessibility patch for evolution calendar
- Date: Thu, 31 Jul 2003 13:53:08 +0800
Hi Rodrigo and JP,
Here is complete current patch for evolution calendar accessibility. It
can be divided into three parts (see the attachment):
1. toplevel part: changes to configure.in and Makefile.am in
evolution top src dir.
2. gui part: changes to support a11y in calendar/gui
3. a11y part: the new a11y dir added for a11y code.
I have sent the part 3 (a11y part ) to Padraig, who is a accessibility
expert.
Please review the whole patch needed to be checked, especially the first
two parts.
Thanks,
Bolian Yin
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.598
diff -u -r1.598 configure.in
--- configure.in 27 Jul 2003 00:03:02 -0000 1.598
+++ configure.in 31 Jul 2003 05:39:13 -0000
@@ -251,6 +251,13 @@
dnl **************************************************
+dnl * Accessibility support
+dnl **************************************************
+PKG_CHECK_MODULES(A11Y, atk)
+AC_SUBST(A11Y_CFLAGS)
+AC_SUBST(A11Y_LIBS)
+
+dnl **************************************************
dnl * IPv6 support
dnl **************************************************
AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[no/yes] Enable support for resolving IPv6 addresses.],,enable_ipv6=no)
@@ -1297,6 +1304,8 @@
AC_OUTPUT([ po/Makefile.in
Makefile
+a11y/Makefile
+a11y/calendar/Makefile
addressbook/Makefile
addressbook/gui/Makefile
addressbook/gui/component/Makefile
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/Makefile.am,v
retrieving revision 1.83
diff -u -r1.83 Makefile.am
--- Makefile.am 23 Jul 2003 16:38:42 -0000 1.83
+++ Makefile.am 31 Jul 2003 05:39:13 -0000
@@ -34,6 +34,7 @@
camel \
filter \
addressbook \
+ a11y \
calendar \
my-evolution \
art \
Index: calendar/gui/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/Makefile.am,v
retrieving revision 1.269
diff -u -r1.269 Makefile.am
--- calendar/gui/Makefile.am 18 Jul 2003 10:37:44 -0000 1.269
+++ calendar/gui/Makefile.am 31 Jul 2003 05:37:11 -0000
@@ -73,6 +73,7 @@
-I$(top_srcdir)/addressbook/backend \
-I$(top_builddir)/addressbook/backend \
-I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/a11y/calendar \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
@@ -190,6 +191,7 @@
$(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/a11y/libevolution-a11y.la \
$(EVOLUTION_CALENDAR_LIBS)
libevolution_calendar_la_LDFLAGS = -avoid-version -module
Index: calendar/gui/calendar-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-commands.c,v
retrieving revision 1.125
diff -u -r1.125 calendar-commands.c
--- calendar/gui/calendar-commands.c 24 Jul 2003 14:58:40 -0000 1.125
+++ calendar/gui/calendar-commands.c 31 Jul 2003 05:37:11 -0000
@@ -419,16 +419,15 @@
return shell_view;
}
-/* Displays the currently displayed time range in the folder bar label on the
- shell view, according to which view we are showing. */
-void
-calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
+const gchar *
+calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal)
{
icaltimezone *zone;
struct icaltimetype start_tt, end_tt;
time_t start_time, end_time;
struct tm start_tm, end_tm;
- char buffer[512], end_buffer[256];
+ static char buffer[512];
+ char end_buffer[256];
GnomeCalendarViewType view;
gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time);
@@ -512,8 +511,17 @@
break;
default:
g_assert_not_reached ();
+ return NULL;
}
+ return buffer;
+}
+/* Displays the currently displayed time range in the folder bar label on the
+ shell view, according to which view we are showing. */
+void
+calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
+{
+ char *buffer = (char *)calendar_get_text_for_folder_bar_label (gcal);
control_util_set_folder_bar_label (control, buffer);
}
Index: calendar/gui/calendar-commands.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-commands.h,v
retrieving revision 1.25
diff -u -r1.25 calendar-commands.h
--- calendar/gui/calendar-commands.h 18 Apr 2002 19:00:20 -0000 1.25
+++ calendar/gui/calendar-commands.h 31 Jul 2003 05:37:11 -0000
@@ -42,6 +42,7 @@
void calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control);
+const gchar * calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal);
/* Used by calendar and tasks control to set the folder title bar label. */
void control_util_set_folder_bar_label (BonoboControl *control, char *label);
Index: calendar/gui/e-cal-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-view.c,v
retrieving revision 1.11
diff -u -r1.11 e-cal-view.c
--- calendar/gui/e-cal-view.c 24 Jul 2003 16:02:54 -0000 1.11
+++ calendar/gui/e-cal-view.c 31 Jul 2003 05:37:12 -0000
@@ -42,6 +42,7 @@
#include "dialogs/recur-comp.h"
#include "print.h"
#include "goto.h"
+#include "ea-calendar.h"
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
@@ -82,6 +83,8 @@
enum {
SELECTION_CHANGED,
TIMEZONE_CHANGED,
+ EVENT_CHANGED,
+ EVENT_ADDED,
LAST_SIGNAL
};
@@ -113,10 +116,33 @@
cal_util_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+ e_cal_view_signals[EVENT_CHANGED] =
+ g_signal_new ("event_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalViewClass, event_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
+ e_cal_view_signals[EVENT_ADDED] =
+ g_signal_new ("event_added",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ECalViewClass, event_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
/* Method override */
object_class->destroy = e_cal_view_destroy;
klass->selection_changed = NULL;
+ klass->event_changed = NULL;
+ klass->event_added = NULL;
+
klass->get_selected_events = NULL;
klass->get_selected_time_range = NULL;
klass->set_selected_time_range = NULL;
@@ -126,6 +152,9 @@
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+
+ /* init the accessibility support for e_day_view */
+ e_cal_view_a11y_init ();
}
static void
Index: calendar/gui/e-cal-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-view.h,v
retrieving revision 1.9
diff -u -r1.9 e-cal-view.h
--- calendar/gui/e-cal-view.h 24 Jul 2003 16:02:54 -0000 1.9
+++ calendar/gui/e-cal-view.h 31 Jul 2003 05:37:12 -0000
@@ -76,6 +76,8 @@
/* Notification signals */
void (* selection_changed) (ECalView *cal_view);
void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
+ void (* event_changed) (ECalView *day_view, ECalViewEvent *event);
+ void (* event_added) (ECalView *day_view, ECalViewEvent *event);
/* Virtual methods */
GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
Index: calendar/gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.213
diff -u -r1.213 e-day-view.c
--- calendar/gui/e-day-view.c 29 Jul 2003 05:21:39 -0000 1.213
+++ calendar/gui/e-day-view.c 31 Jul 2003 05:37:22 -0000
@@ -29,6 +29,7 @@
#include <config.h>
#include "e-day-view.h"
+#include "ea-calendar.h"
#include <math.h>
#include <time.h>
@@ -283,10 +284,6 @@
gint *day_return,
gint *row_return,
gint *event_num_return);
-static gboolean e_day_view_find_event_from_item (EDayView *day_view,
- GnomeCanvasItem *item,
- gint *day_return,
- gint *event_num_return);
static gboolean e_day_view_find_event_from_uid (EDayView *day_view,
const gchar *uid,
gint *day_return,
@@ -437,7 +434,6 @@
static void e_day_view_cancel_layout (EDayView *day_view);
static gboolean e_day_view_layout_timeout_cb (gpointer data);
-
static GtkTableClass *parent_class;
E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init,
@@ -473,6 +469,9 @@
view_class->set_selected_time_range = e_day_view_set_selected_time_range;
view_class->get_visible_time_range = e_day_view_get_visible_time_range;
view_class->update_query = e_day_view_update_query;
+
+ /* init the accessibility support for e_day_view */
+ e_day_view_a11y_init ();
}
static void
@@ -1640,6 +1639,10 @@
e_day_view_update_event_label (day_view, day, event_num);
e_day_view_reshape_day_event (day_view, day, event_num);
}
+
+ g_signal_emit_by_name (G_OBJECT(day_view),
+ "event_changed", event);
+
return TRUE;
}
@@ -1892,7 +1895,7 @@
/* Finds the day and index of the event with the given canvas item.
If is is a long event, -1 is returned as the day.
Returns TRUE if the event was found. */
-static gboolean
+gboolean
e_day_view_find_event_from_item (EDayView *day_view,
GnomeCanvasItem *item,
gint *day_return,
@@ -4480,6 +4483,9 @@
NULL);
g_signal_connect (event->canvas_item, "event",
G_CALLBACK (e_day_view_on_text_item_event), day_view);
+ g_signal_emit_by_name (G_OBJECT(day_view),
+ "event_added", event);
+
e_day_view_update_long_event_label (day_view, event_num);
}
@@ -4638,6 +4644,9 @@
NULL);
g_signal_connect (event->canvas_item, "event",
G_CALLBACK (e_day_view_on_text_item_event), day_view);
+ g_signal_emit_by_name (G_OBJECT(day_view),
+ "event_added", event);
+
e_day_view_update_event_label (day_view, day, event_num);
}
@@ -5045,9 +5054,10 @@
}
if (new_day != E_DAY_VIEW_LONG_EVENT && new_day != -1) {
- if (e_day_view_get_event_rows (day_view, new_day, new_event_num,
+ if (e_day_view_get_event_rows (day_view, new_day,
+ new_event_num,
&start_row, &end_row))
- /* ajust the scrollbar to ensure the event to be seen */
+ /* ensure the event to be seen */
e_day_view_ensure_rows_visible (day_view,
start_row, end_row);
}
Index: calendar/gui/e-day-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.h,v
retrieving revision 1.49
diff -u -r1.49 e-day-view.h
--- calendar/gui/e-day-view.h 24 Jul 2003 16:02:54 -0000 1.49
+++ calendar/gui/e-day-view.h 31 Jul 2003 05:37:23 -0000
@@ -588,6 +588,11 @@
gint e_day_view_event_sort_func (const void *arg1,
const void *arg2);
+gboolean e_day_view_find_event_from_item (EDayView *day_view,
+ GnomeCanvasItem *item,
+ gint *day_return,
+ gint *event_num_return);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: calendar/gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.179
diff -u -r1.179 e-week-view.c
--- calendar/gui/e-week-view.c 29 Jul 2003 05:21:39 -0000 1.179
+++ calendar/gui/e-week-view.c 31 Jul 2003 05:37:26 -0000
@@ -30,6 +30,7 @@
#include <config.h>
#include "e-week-view.h"
+#include "ea-calendar.h"
#include <math.h>
#include <gdk/gdkkeysyms.h>
@@ -154,10 +155,6 @@
GnomeCanvasItem *item);
static void e_week_view_on_editing_stopped (EWeekView *week_view,
GnomeCanvasItem *item);
-static gboolean e_week_view_find_event_from_item (EWeekView *week_view,
- GnomeCanvasItem *item,
- gint *event_num,
- gint *span_num);
static gboolean e_week_view_find_event_from_uid (EWeekView *week_view,
const gchar *uid,
gint *event_num_return);
@@ -228,6 +225,9 @@
view_class->set_selected_time_range = e_week_view_set_selected_time_range;
view_class->get_visible_time_range = e_week_view_get_visible_time_range;
view_class->update_query = e_week_view_update_query;
+
+ /* init the accessibility support for e_week_view */
+ e_week_view_a11y_init ();
}
static void
@@ -1888,6 +1888,9 @@
span_num);
}
}
+ g_signal_emit_by_name (G_OBJECT(week_view),
+ "event_changed", event);
+
return TRUE;
}
@@ -2366,7 +2369,6 @@
week_view->day_starts[0], week_view->day_starts[num_days],
start, end);
#endif
-
g_return_val_if_fail (start <= end, TRUE);
g_return_val_if_fail (start < week_view->day_starts[num_days], TRUE);
g_return_val_if_fail (end > week_view->day_starts[0], TRUE);
@@ -2632,6 +2634,9 @@
g_signal_connect (span->text_item, "event",
G_CALLBACK (e_week_view_on_text_item_event),
week_view);
+ g_signal_emit_by_name (G_OBJECT(week_view),
+ "event_added", event);
+
}
/* Calculate the position of the text item.
@@ -3203,7 +3208,7 @@
}
-static gboolean
+gboolean
e_week_view_find_event_from_item (EWeekView *week_view,
GnomeCanvasItem *item,
gint *event_num_return,
Index: calendar/gui/e-week-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.h,v
retrieving revision 1.44
diff -u -r1.44 e-week-view.h
--- calendar/gui/e-week-view.h 24 Jul 2003 16:02:54 -0000 1.44
+++ calendar/gui/e-week-view.h 31 Jul 2003 05:37:27 -0000
@@ -435,6 +435,10 @@
gint e_week_view_event_sort_func (const void *arg1,
const void *arg2);
+gboolean e_week_view_find_event_from_item (EWeekView *week_view,
+ GnomeCanvasItem *item,
+ gint *event_num_return,
+ gint *span_num_return);
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: calendar/gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.254
diff -u -r1.254 gnome-cal.c
--- calendar/gui/gnome-cal.c 24 Jul 2003 16:02:54 -0000 1.254
+++ calendar/gui/gnome-cal.c 31 Jul 2003 05:37:31 -0000
@@ -57,6 +57,7 @@
#include "calendar-view-factory.h"
#include "tag-calendar.h"
#include "misc.h"
+#include "ea-calendar.h"
extern ECompEditorRegistry *comp_editor_registry;
@@ -353,6 +354,9 @@
"goto_date",1,
G_TYPE_ENUM,
GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK);
+ /* init the accessibility support for gnome_calendar */
+ gnome_calendar_a11y_init ();
+
}
/* Callback used when the calendar query reports of an updated object */
@@ -3116,3 +3120,26 @@
return E_CALENDAR_TABLE (gcal->priv->todo);
}
+GtkWidget *
+gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+
+ return GTK_WIDGET(gcal->priv->date_navigator);
+}
+
+GtkWidget *
+gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+
+ return GTK_WIDGET(gcal->priv->search_bar);
+}
+
+GtkWidget *
+gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+
+ return GTK_WIDGET(gcal->priv->notebook);
+}
Index: calendar/gui/gnome-cal.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.h,v
retrieving revision 1.85
diff -u -r1.85 gnome-cal.h
--- calendar/gui/gnome-cal.h 23 Jul 2003 15:52:08 -0000 1.85
+++ calendar/gui/gnome-cal.h 31 Jul 2003 05:37:31 -0000
@@ -87,7 +87,7 @@
void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in);
void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in);
- void (* goto_date) (GnomeCalendar *day_view,
+ void (* goto_date) (GnomeCalendar *gcal,
GnomeCalendarGotoDateType date);
};
@@ -101,8 +101,6 @@
void gnome_calendar_set_ui_component (GnomeCalendar *cal,
BonoboUIComponent *ui_component);
-ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
-
CalClient *gnome_calendar_get_cal_client (GnomeCalendar *gcal);
CalClient *gnome_calendar_get_task_pad_cal_client(GnomeCalendar *gcal);
@@ -124,6 +122,12 @@
gboolean range_selected, gboolean grab_focus);
GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal);
+
+ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
+GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal);
+GtkWidget *gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal);
+GtkWidget *gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal);
+
void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic);
void gnome_calendar_discard_view_menus (GnomeCalendar *gcal);
Index: a11y/ChangeLog
===================================================================
RCS file: a11y/ChangeLog
diff -N a11y/ChangeLog
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/ChangeLog 31 Jul 2003 05:31:31 -0000
@@ -0,0 +1,15 @@
+2003-07-31 Bolian Yin <bolian yin sun com>
+ setup the a11y directory for evolution accessibility work
+ New files are:
+ ea-factory.h
+ Makefile.am
+ calendar/ea-calendar.c
+ calendar/ea-calendar.h
+ calendar/ea-day-view-event-factory.c
+ calendar/ea-day-view-event-factory.h
+ calendar/ea-day-view-event.c
+ calendar/ea-day-view-event.h
+ calendar/ea-day-view.c
+ calendar/ea-day-view.h
+ calendar/ea-gnome-calendar.c
+ calendar/ea-gnome-calendar.h
Index: a11y/Makefile.am
===================================================================
RCS file: a11y/Makefile.am
diff -N a11y/Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/Makefile.am 31 Jul 2003 05:31:31 -0000
@@ -0,0 +1,34 @@
+# Calendar IDL files
+
+CALENDAR_IDLS = $(top_srcdir)/calendar/idl/evolution-calendar.idl
+
+CALENDAR_IDL_GENERATED_H = evolution-calendar.h
+
+$(CALENDAR_IDL_GENERATED_H): $(CALENDAR_IDLS)
+ $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
+ $(top_srcdir)/calendar/idl/evolution-calendar.idl
+
+SUBDIRS = calendar
+
+INCLUDES = \
+ -DPREFIX=\"$(prefix)\" \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBDIR=\"$(libdir)\" \
+ -DG_LOG_DOMAIN=\"evolution-a11y\" \
+ -I$(top_srcdir) \
+ -DG_DISABLE_DEPRECATED \
+ -DLIBGNOME_DISABLE_DEPRECATED \
+ $(EVOLUTION_CALENDAR_CFLAGS) \
+ $(A11Y_CFLAGS)
+
+privlib_LTLIBRARIES = libevolution-a11y.la
+
+libevolution_a11y_la_SOURCES = \
+ $(CALENDAR_IDL_GENERATED_H)
+
+BUILT_SOURCES = $(CALENDAR_IDL_GENERATED_H)
+
+libevolution_a11y_la_LIBADD = \
+ $(A11Y_LIBS) \
+ $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la
Index: a11y/ea-factory.h
===================================================================
RCS file: a11y/ea-factory.h
diff -N a11y/ea-factory.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/ea-factory.h 31 Jul 2003 05:31:31 -0000
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-factory.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+/* Evolution Accessibility
+*/
+
+#ifndef _EA_FACTORY_H__
+#define _EA_FACTORY_H__
+
+#include <glib-object.h>
+#include <atk/atkobject.h>
+
+#define EA_FACTORY(type, type_as_function, opt_create_accessible) \
+ \
+static GType \
+type_as_function ## _factory_get_accessible_type (void) \
+{ \
+ return type; \
+} \
+ \
+static AtkObject* \
+type_as_function ## _factory_create_accessible (GObject *obj) \
+{ \
+ GtkWidget *widget; \
+ AtkObject *accessible; \
+ \
+ g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \
+ \
+ widget = GTK_WIDGET (obj); \
+ \
+ accessible = opt_create_accessible (widget); \
+ \
+ return accessible; \
+} \
+ \
+static void \
+type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
+{ \
+ klass->create_accessible = type_as_function ## _factory_create_accessible; \
+ klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
+} \
+ \
+static GType \
+type_as_function ## _factory_get_type (void) \
+{ \
+ static GType t = 0; \
+ \
+ if (!t) \
+ { \
+ char *name; \
+ static const GTypeInfo tinfo = \
+ { \
+ sizeof (AtkObjectFactoryClass), \
+ NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
+ NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
+ }; \
+ \
+ name = g_strconcat (g_type_name (type), "Factory", NULL); \
+ t = g_type_register_static ( \
+ ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
+ g_free (name); \
+ } \
+ \
+ return t; \
+}
+
+#define EA_SET_FACTORY(widget_type, type_as_function) \
+ atk_registry_set_factory_type (atk_get_default_registry (), \
+ widget_type, \
+ type_as_function ## _factory_get_type ())
+
+#endif /* _EA_FACTORY_H__ */
Index: a11y/calendar/Makefile.am
===================================================================
RCS file: a11y/calendar/Makefile.am
diff -N a11y/calendar/Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/Makefile.am 31 Jul 2003 05:31:31 -0000
@@ -0,0 +1,38 @@
+
+noinst_LTLIBRARIES = libevolution-calendar-a11y.la
+
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"evolution-a11y\" \
+ -I$(top_srcdir)/shell \
+ -I$(top_srcdir)/calendar \
+ -I$(top_srcdir)/calendar/cal-client \
+ -I$(top_srcdir)/libical/src/libical \
+ -I$(top_srcdir)/calendar/gui \
+ -I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/a11y \
+ -DEVOLUTION_DATADIR=\""$(datadir)"\" \
+ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
+ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
+ -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
+ -DG_DISABLE_DEPRECATED \
+ -DPREFIX=\""$(prefix)"\" \
+ $(A11Y_CFLAGS) \
+ $(EVOLUTION_CALENDAR_CFLAGS)
+
+libevolution_calendar_a11y_la_SOURCES = \
+ ea-calendar.c \
+ ea-calendar.h \
+ ea-calendar-helpers.c \
+ ea-calendar-helpers.h \
+ ea-cal-view.c \
+ ea-cal-view.h \
+ ea-cal-view-event.c \
+ ea-cal-view-event.h \
+ ea-day-view.c \
+ ea-day-view.h \
+ ea-week-view.c \
+ ea-week-view.h \
+ ea-gnome-calendar.c \
+ ea-gnome-calendar.h
Index: a11y/calendar/ea-cal-view-event.c
===================================================================
RCS file: a11y/calendar/ea-cal-view-event.c
diff -N a11y/calendar/ea-cal-view-event.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-cal-view-event.c 31 Jul 2003 05:31:32 -0000
@@ -0,0 +1,333 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-cal-view-event.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-cal-view-event.h"
+#include "ea-calendar-helpers.h"
+#include "ea-day-view.h"
+#include "ea-week-view.h"
+#include <gal/e-text/e-text.h>
+
+static void ea_cal_view_event_class_init (EaCalViewEventClass *klass);
+
+static G_CONST_RETURN gchar* ea_cal_view_event_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_cal_view_event_get_description (AtkObject *accessible);
+static AtkObject* ea_cal_view_event_get_parent (AtkObject *accessible);
+static gint ea_cal_view_event_get_index_in_parent (AtkObject *accessible);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_cal_view_event_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+
+ if (!type) {
+ static GTypeInfo tinfo = {
+ sizeof (EaCalViewEventClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_cal_view_event_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaCalViewEvent), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (atk object for E_TEXT, in this case)
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ E_TYPE_TEXT);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ /* we inherit the component, text and other interfaces from E_TEXT */
+ type = g_type_register_static (derived_atk_type,
+ "EaCalViewEvent", &tinfo, 0);
+ }
+
+ return type;
+}
+
+static void
+ea_cal_view_event_class_init (EaCalViewEventClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+
+ class->get_name = ea_cal_view_event_get_name;
+ class->get_description = ea_cal_view_event_get_description;
+ class->get_parent = ea_cal_view_event_get_parent;
+ class->get_index_in_parent = ea_cal_view_event_get_index_in_parent;
+
+}
+
+AtkObject*
+ea_cal_view_event_new (GObject *obj)
+{
+ AtkObject *atk_obj = NULL;
+ GObject *target_obj;
+ ECalView *cal_view;
+
+
+ g_return_val_if_fail (E_IS_TEXT (obj), NULL);
+ cal_view = ea_calendar_helpers_get_cal_view_from (GNOME_CANVAS_ITEM (obj));
+ if (E_IS_WEEK_VIEW (cal_view)) {
+ gint event_num, span_num;
+ EWeekViewEvent *week_view_event;
+ EWeekViewEventSpan *event_span;
+ EWeekView *week_view = E_WEEK_VIEW (cal_view);
+
+ /* for week view, we need to check if a atkobject exists for
+ * the first span of the same event
+ */
+ if (!e_week_view_find_event_from_item (week_view,
+ GNOME_CANVAS_ITEM (obj),
+ &event_num,
+ &span_num))
+ return NULL;
+ week_view_event = &g_array_index (week_view->events,
+ EWeekViewEvent,
+ event_num);
+ /* get the first span */
+ event_span = &g_array_index (week_view->spans,
+ EWeekViewEventSpan,
+ week_view_event->spans_index);
+ target_obj = G_OBJECT (event_span->text_item);
+ atk_obj = g_object_get_data (target_obj, "accessible-object");
+
+ }
+ else
+ target_obj = obj;
+
+ if (!atk_obj) {
+ atk_obj = ATK_OBJECT (g_object_new (EA_TYPE_CAL_VIEW_EVENT,
+ NULL));
+ atk_object_initialize (atk_obj, target_obj);
+ atk_obj->role = ATK_ROLE_TEXT;
+#ifdef ACC_DEBUG
+ printf ("EvoAcc: ea_cal_view_event created %p for item=%p\n",
+ atk_obj, target_obj);
+#endif
+ }
+
+ /* the registered factory for E_TEXT is cannot create a EaCalViewEvent,
+ * we should save the EaCalViewEvent object in it.
+ */
+ g_object_set_data (obj, "accessible-object", atk_obj);
+
+ return atk_obj;
+}
+
+static G_CONST_RETURN gchar*
+ea_cal_view_event_get_name (AtkObject *accessible)
+{
+ g_return_val_if_fail (EA_IS_CAL_VIEW_EVENT (accessible), NULL);
+
+ if (accessible->name)
+ return accessible->name;
+ else {
+ AtkGObjectAccessible *atk_gobj;
+ GObject *g_obj;
+ ECalViewEvent *event;
+ gchar *tmp_name;
+ gchar *new_name = g_strdup ("");
+ CalComponentText comp_text;
+
+ atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible);
+ g_obj = atk_gobject_accessible_get_object (atk_gobj);
+ if (!g_obj || !E_IS_TEXT (g_obj))
+ return NULL;
+ event = ea_calendar_helpers_get_cal_view_event_from (GNOME_CANVAS_ITEM(g_obj));
+
+ if (event && event->comp) {
+ CalComponent *comp = event->comp;
+
+ if (cal_component_has_alarms (comp)) {
+ tmp_name = new_name;
+ new_name = g_strconcat (new_name, "alarm ", NULL);
+ g_free (tmp_name);
+ }
+
+ if (cal_component_has_recurrences (comp)) {
+ tmp_name = new_name;
+ 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);
+ g_free (tmp_name);
+ }
+
+ if (cal_component_has_organizer (comp)) {
+ tmp_name = new_name;
+ 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);
+ g_free (tmp_name);
+
+ cal_component_get_summary (event->comp, &comp_text);
+ if (comp_text.value) {
+ tmp_name = new_name;
+ char *text = (char*) comp_text.value;
+ new_name = g_strconcat (new_name, text, NULL);
+ g_free (tmp_name);
+ }
+ else {
+ tmp_name = new_name;
+ new_name = g_strconcat (new_name, "empty", NULL);
+ g_free (tmp_name);
+ }
+
+ ATK_OBJECT_CLASS (parent_class)->set_name (accessible, new_name);
+#ifdef ACC_DEBUG
+ printf("EvoAcc: name for event accobj=%p, is %s\n",
+ accessible, new_name);
+#endif
+ g_free (new_name);
+ return accessible->name;
+ }
+}
+
+static G_CONST_RETURN gchar*
+ea_cal_view_event_get_description (AtkObject *accessible)
+{
+ if (accessible->description)
+ return accessible->description;
+
+ return "calendar view event";
+}
+
+static AtkObject *
+ea_cal_view_event_get_parent (AtkObject *accessible)
+{
+ AtkGObjectAccessible *atk_gobj;
+ GObject *g_obj;
+ GnomeCanvasItem *canvas_item;
+ ECalView *cal_view;
+
+ g_return_val_if_fail (EA_IS_CAL_VIEW_EVENT (accessible), NULL);
+ atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible);
+
+ g_obj = atk_gobject_accessible_get_object (atk_gobj);
+ if (g_obj == NULL)
+ /* Object is defunct */
+ return NULL;
+ canvas_item = GNOME_CANVAS_ITEM (g_obj);
+
+ cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
+
+ if (!cal_view)
+ return NULL;
+
+ return gtk_widget_get_accessible (GTK_WIDGET (cal_view));
+}
+
+static gint
+ea_cal_view_event_get_index_in_parent (AtkObject *accessible)
+{
+ GObject *g_obj;
+ GnomeCanvasItem *canvas_item;
+ ECalView *cal_view;
+ ECalViewEvent *cal_view_event;
+
+ g_return_val_if_fail (EA_IS_CAL_VIEW_EVENT (accessible), -1);
+ g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible));
+ if (!g_obj)
+ /* defunct object*/
+ return -1;
+
+ canvas_item = GNOME_CANVAS_ITEM (g_obj);
+ cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
+ if (!cal_view)
+ return -1;
+
+ cal_view_event = ea_calendar_helpers_get_cal_view_event_from (canvas_item);
+ if (!cal_view_event)
+ return -1;
+
+ if (E_IS_DAY_VIEW (cal_view)) {
+ gint day, event_num, num_before;
+ EDayViewEvent *day_view_event;
+ EDayView *day_view = E_DAY_VIEW (cal_view);
+
+ /* the long event comes first in the order */
+ for (event_num = day_view->long_events->len - 1; event_num >= 0;
+ --event_num) {
+ day_view_event = &g_array_index (day_view->long_events,
+ EDayViewEvent, event_num);
+ if (cal_view_event == (ECalViewEvent*)day_view_event)
+ return event_num;
+
+ }
+ num_before = day_view->long_events->len;
+
+ for (day = 0; day < day_view->days_shown; ++day) {
+ for (event_num = day_view->events[day]->len - 1; event_num >= 0;
+ --event_num) {
+ day_view_event = &g_array_index (day_view->events[day],
+ EDayViewEvent, event_num);
+ if (cal_view_event == (ECalViewEvent*)day_view_event)
+ return num_before + event_num;
+ }
+ num_before += day_view->events[day]->len;
+ }
+ }
+ else if (E_IS_WEEK_VIEW (cal_view)) {
+ gint index;
+ EWeekViewEvent *week_view_event;
+ EWeekView *week_view = E_WEEK_VIEW (cal_view);
+
+ for (index = week_view->events->len - 1; index >= 0; --index) {
+ week_view_event = &g_array_index (week_view->events,
+ EWeekViewEvent, index);
+ if (cal_view_event == (ECalViewEvent*)week_view_event)
+ return index;
+ }
+ }
+ else {
+ g_assert_not_reached ();
+ return -1;
+ }
+ return -1;
+}
Index: a11y/calendar/ea-cal-view-event.h
===================================================================
RCS file: a11y/calendar/ea-cal-view-event.h
diff -N a11y/calendar/ea-cal-view-event.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-cal-view-event.h 31 Jul 2003 05:31:32 -0000
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-cal-view-event.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_CAL_VIEW_EVENT_H__
+#define __EA_CAL_VIEW_EVENT_H__
+
+#include <atk/atkgobjectaccessible.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_CAL_VIEW_EVENT (ea_cal_view_event_get_type ())
+#define EA_CAL_VIEW_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_CAL_VIEW_EVENT, EaCalViewEvent))
+#define EA_CAL_VIEW_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_CAL_VIEW_EVENT, EaCalViewEventClass))
+#define EA_IS_CAL_VIEW_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_CAL_VIEW_EVENT))
+#define EA_IS_CAL_VIEW_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_CAL_VIEW_EVENT))
+#define EA_CAL_VIEW_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_CAL_VIEW_EVENT, EaCalViewEventClass))
+
+typedef struct _EaCalViewEvent EaCalViewEvent;
+typedef struct _EaCalViewEventClass EaCalViewEventClass;
+
+struct _EaCalViewEvent
+{
+ AtkGObjectAccessible parent;
+};
+
+GType ea_cal_view_event_get_type (void);
+
+struct _EaCalViewEventClass
+{
+ AtkGObjectAccessibleClass parent_class;
+};
+
+AtkObject *ea_cal_view_event_new (GObject *obj);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_CAL_VIEW_EVENT_H__ */
Index: a11y/calendar/ea-cal-view.c
===================================================================
RCS file: a11y/calendar/ea-cal-view.c
diff -N a11y/calendar/ea-cal-view.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-cal-view.c 31 Jul 2003 05:31:32 -0000
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-cal-view.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-cal-view.h"
+#include "ea-calendar-helpers.h"
+#include "e-day-view.h"
+#include "e-week-view.h"
+#include "calendar-commands.h"
+#include <glib/gstrfuncs.h>
+
+static void ea_cal_view_class_init (EaCalViewClass *klass);
+
+static AtkObject* ea_cal_view_get_parent (AtkObject *accessible);
+static gint ea_cal_view_get_index_in_parent (AtkObject *accessible);
+static void ea_cal_view_real_initialize (AtkObject *accessible, gpointer data);
+
+static void ea_cal_view_event_changed_cb (ECalView *cal_view,
+ ECalViewEvent *event, gpointer data);
+static void ea_cal_view_event_added_cb (ECalView *cal_view,
+ ECalViewEvent *event, gpointer data);
+
+static void ea_cal_view_dates_change_cb (GnomeCalendar *gcal, gpointer data);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_cal_view_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ if (!type) {
+ static GTypeInfo tinfo = {
+ sizeof (EaCalViewClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_cal_view_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaCalView), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (GailWidget, in this case)
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ GTK_TYPE_WIDGET);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type,
+ "EaCalView", &tinfo, 0);
+ }
+
+ return type;
+}
+
+static void
+ea_cal_view_class_init (EaCalViewClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ class->get_parent = ea_cal_view_get_parent;
+ class->get_index_in_parent = ea_cal_view_get_index_in_parent;
+ class->initialize = ea_cal_view_real_initialize;
+}
+
+AtkObject*
+ea_cal_view_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ g_return_val_if_fail (E_IS_CAL_VIEW (widget), NULL);
+
+ object = g_object_new (EA_TYPE_CAL_VIEW, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+ return accessible;
+}
+
+static void
+ea_cal_view_real_initialize (AtkObject *accessible, gpointer data)
+{
+ ECalView *cal_view;
+ GnomeCalendar *gcal;
+
+ g_return_if_fail (EA_IS_CAL_VIEW (accessible));
+ g_return_if_fail (E_IS_CAL_VIEW (data));
+
+ ATK_OBJECT_CLASS (parent_class)->initialize (accessible, data);
+ accessible->role = ATK_ROLE_CANVAS;
+ cal_view = E_CAL_VIEW (data);
+
+ /* add listener for event_changed, event_added
+ * we don't need to listen on event_removed. When the e_text
+ * of the event is removed, the cal_view_event will go to the state
+ * of "defunct" (changed by weak ref callback of atkgobjectaccessible
+ */
+ g_signal_connect (G_OBJECT(cal_view), "event_changed",
+ G_CALLBACK (ea_cal_view_event_changed_cb), NULL);
+ g_signal_connect (G_OBJECT(cal_view), "event_added",
+ G_CALLBACK (ea_cal_view_event_added_cb), NULL);
+
+ /* listen for date changes of calendar */
+ gcal = e_cal_view_get_calendar (cal_view);
+
+ if (gcal)
+ g_signal_connect (gcal, "dates_shown_changed",
+ G_CALLBACK (ea_cal_view_dates_change_cb),
+ accessible);
+}
+
+static AtkObject*
+ea_cal_view_get_parent (AtkObject *accessible)
+{
+ ECalView *cal_view;
+ GnomeCalendar *gnomeCalendar;
+
+ g_return_val_if_fail (EA_IS_CAL_VIEW (accessible), NULL);
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ cal_view = E_CAL_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ gnomeCalendar = e_cal_view_get_calendar (cal_view);
+
+ return gtk_widget_get_accessible (GTK_WIDGET(gnomeCalendar));
+}
+
+static gint
+ea_cal_view_get_index_in_parent (AtkObject *accessible)
+{
+ return 1;
+}
+
+static void
+ea_cal_view_event_changed_cb (ECalView *cal_view, ECalViewEvent *event,
+ gpointer data)
+{
+ AtkObject *atk_obj;
+ EaCalView *ea_cal_view;
+ AtkObject *event_atk_obj = NULL;
+
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ atk_obj = gtk_widget_get_accessible (GTK_WIDGET(cal_view));
+ if (!EA_IS_CAL_VIEW (atk_obj))
+ return;
+ ea_cal_view = EA_CAL_VIEW (atk_obj);
+
+ if ((E_IS_DAY_VIEW (cal_view)) && event && event->canvas_item) {
+ event_atk_obj =
+ ea_calendar_helpers_get_accessible_for (event->canvas_item);
+ }
+ else if ((E_IS_WEEK_VIEW (cal_view)) && event) {
+ EWeekViewEventSpan *span;
+ EWeekViewEvent *week_view_event = (EWeekViewEvent *)event;
+ EWeekView *week_view = E_WEEK_VIEW (cal_view);
+ /* get the first span of the event */
+ span = &g_array_index (week_view->spans, EWeekViewEventSpan,
+ week_view_event->spans_index);
+ if (span && span->text_item)
+ event_atk_obj = ea_calendar_helpers_get_accessible_for (span->text_item);
+ }
+ if (event_atk_obj) {
+#ifdef ACC_DEBUG
+ printf ("AccDebug: event=%p changed\n", event);
+#endif
+ g_object_notify (G_OBJECT(event_atk_obj), "accessible-name");
+ g_signal_emit_by_name (event_atk_obj, "visible_data_changed");
+ }
+
+}
+
+static void
+ea_cal_view_event_added_cb (ECalView *cal_view, ECalViewEvent *event,
+ gpointer data)
+{
+ AtkObject *atk_obj;
+ EaCalView *ea_cal_view;
+ AtkObject *event_atk_obj = NULL;
+ gint index;
+
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ atk_obj = gtk_widget_get_accessible (GTK_WIDGET(cal_view));
+ if (!EA_IS_CAL_VIEW (atk_obj))
+ return;
+ ea_cal_view = EA_CAL_VIEW (atk_obj);
+
+ if ((E_IS_DAY_VIEW (cal_view)) && event && event->canvas_item) {
+ event_atk_obj =
+ ea_calendar_helpers_get_accessible_for (event->canvas_item);
+ }
+ else if ((E_IS_WEEK_VIEW (cal_view)) && event) {
+ EWeekViewEventSpan *span;
+ EWeekViewEvent *week_view_event = (EWeekViewEvent *)event;
+ EWeekView *week_view = E_WEEK_VIEW (cal_view);
+ /* get the first span of the event */
+ span = &g_array_index (week_view->spans, EWeekViewEventSpan,
+ week_view_event->spans_index);
+ if (span && span->text_item)
+ event_atk_obj = ea_calendar_helpers_get_accessible_for (span->text_item);
+
+ }
+ if (event_atk_obj) {
+ index = atk_object_get_index_in_parent (event_atk_obj);
+ if (index < 0)
+ return;
+#ifdef ACC_DEBUG
+ printf ("AccDebug: event=%p added\n", event);
+#endif
+ g_signal_emit_by_name (atk_obj, "children_changed::add",
+ index, event_atk_obj, NULL);
+ }
+}
+
+static void
+ea_cal_view_dates_change_cb (GnomeCalendar *gcal, gpointer data)
+{
+ AtkObject *atk_obj;
+
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (data);
+ g_return_if_fail (EA_IS_CAL_VIEW (data));
+
+ atk_obj = ATK_OBJECT(data);
+ if (atk_obj->name) {
+ g_free (atk_obj->name);
+ atk_obj->name = NULL;
+ }
+ g_object_notify (G_OBJECT (data), "accessible-name");
+ g_signal_emit_by_name (data, "visible_data_changed");
+}
Index: a11y/calendar/ea-cal-view.h
===================================================================
RCS file: a11y/calendar/ea-cal-view.h
diff -N a11y/calendar/ea-cal-view.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-cal-view.h 31 Jul 2003 05:31:32 -0000
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-cal-view.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_CAL_VIEW_H__
+#define __EA_CAL_VIEW_H__
+
+#include <gtk/gtkaccessible.h>
+#include "e-cal-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_CAL_VIEW (ea_cal_view_get_type ())
+#define EA_CAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_CAL_VIEW, EaCalView))
+#define EA_CAL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_CAL_VIEW, EaCalViewClass))
+#define EA_IS_CAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_CAL_VIEW))
+#define EA_IS_CAL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_CAL_VIEW))
+#define EA_CAL_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_CAL_VIEW, EaCalViewClass))
+
+typedef struct _EaCalView EaCalView;
+typedef struct _EaCalViewClass EaCalViewClass;
+
+struct _EaCalView
+{
+ GtkAccessible parent;
+};
+
+GType ea_cal_view_get_type (void);
+
+struct _EaCalViewClass
+{
+ GtkAccessibleClass parent_class;
+};
+
+AtkObject* ea_cal_view_new (GtkWidget *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __EA_CAL_VIEW_H__ */
Index: a11y/calendar/ea-calendar-helpers.c
===================================================================
RCS file: a11y/calendar/ea-calendar-helpers.c
diff -N a11y/calendar/ea-calendar-helpers.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-calendar-helpers.c 31 Jul 2003 05:31:32 -0000
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-calendar-helpers.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-calendar-helpers.h"
+#include "ea-cal-view-event.h"
+#include "e-day-view.h"
+#include "e-week-view.h"
+
+#include <gal/e-text/e-text.h>
+
+/**
+ * ea_calendar_helpers_get_accessible_for
+ * @canvas_item: the canvas item (e_text) for a event
+ * @returns: the atk object for the canvas_item
+ *
+ **/
+AtkObject *
+ea_calendar_helpers_get_accessible_for (GnomeCanvasItem *canvas_item)
+{
+ AtkObject *atk_obj = NULL;
+ GObject *g_obj;
+
+ g_return_val_if_fail (E_IS_TEXT (canvas_item), NULL);
+
+ g_obj = G_OBJECT (canvas_item);
+ /* we cannot use atk_gobject_accessible_for_object here,
+ * EaDayViewEvent/EaWeekViewEvent cannot be created by the
+ * registered facotry of E_TEXT
+ */
+ atk_obj = g_object_get_data (g_obj, "accessible-object");
+ if (!atk_obj)
+ atk_obj = ea_cal_view_event_new (g_obj);
+ return atk_obj;
+}
+
+/**
+ * ea_calendar_helpers_get_view_widget_from:
+ * @canvas_item: the canvas item (e_text) for a event
+ * @returns: the cal view widget if exists
+ *
+ * Get the cal view widget contains the canvas_item.
+ *
+ **/
+ECalView *
+ea_calendar_helpers_get_cal_view_from (GnomeCanvasItem *canvas_item)
+{
+ GnomeCanvas *canvas;
+ GtkWidget *view_widget = NULL;
+
+ g_return_val_if_fail (canvas_item, NULL);
+ g_return_val_if_fail (E_IS_TEXT (canvas_item), NULL);
+
+ /* canvas_item is the e_text for the event */
+ /* canvas_item->canvas is the ECanvas for day view */
+ /* parent of canvas_item->canvas is the EDayView or EWeekView widget */
+ canvas = canvas_item->canvas;
+ view_widget = gtk_widget_get_parent (GTK_WIDGET(canvas));
+ if (!view_widget || !E_IS_CAL_VIEW (view_widget))
+ return NULL;
+ return E_CAL_VIEW (view_widget);
+}
+
+/**
+ * ea_calendar_helpers_get_cal_view_event_from
+ * @canvas_item: the cavas_item (e_text) for the event
+ * @returns: the ECalViewEvent
+ *
+ * Get the ECalViewEvent for the canvas_item.
+ *
+ **/
+ECalViewEvent *
+ea_calendar_helpers_get_cal_view_event_from (GnomeCanvasItem *canvas_item)
+{
+ ECalView *cal_view;
+ gboolean event_found;
+ ECalViewEvent *cal_view_event;
+
+ g_return_val_if_fail (E_IS_TEXT (canvas_item), NULL);
+
+ cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
+
+ if (!cal_view)
+ return NULL;
+
+ if (E_IS_DAY_VIEW (cal_view)) {
+ gint event_day, event_num;
+ EDayViewEvent *day_view_event;
+ EDayView *day_view = E_DAY_VIEW (cal_view);
+ event_found = e_day_view_find_event_from_item (day_view, canvas_item,
+ &event_day, &event_num);
+ if (!event_found)
+ return NULL;
+ if (event_day == E_DAY_VIEW_LONG_EVENT) {
+ /* a long event */
+ day_view_event = &g_array_index (day_view->long_events,
+ EDayViewEvent, event_num);
+ }
+ else {
+ /* a main canvas event */
+ day_view_event = &g_array_index (day_view->events[event_day],
+ EDayViewEvent, event_num);
+ }
+ cal_view_event = (ECalViewEvent *) day_view_event;
+ }
+ else if (E_IS_WEEK_VIEW (cal_view)) {
+ gint event_num, span_num;
+ EWeekViewEvent *week_view_event;
+ EWeekView *week_view = E_WEEK_VIEW (cal_view);
+ event_found = e_week_view_find_event_from_item (week_view,
+ canvas_item,
+ &event_num,
+ &span_num);
+ if (!event_found)
+ return NULL;
+
+ week_view_event = &g_array_index (week_view->events, EWeekViewEvent,
+ event_num);
+
+ cal_view_event = (ECalViewEvent *)week_view_event;
+ }
+ else {
+ g_assert_not_reached ();
+ return NULL;
+ }
+ return cal_view_event;
+}
Index: a11y/calendar/ea-calendar-helpers.h
===================================================================
RCS file: a11y/calendar/ea-calendar-helpers.h
diff -N a11y/calendar/ea-calendar-helpers.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-calendar-helpers.h 31 Jul 2003 05:31:32 -0000
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-calendar-helpers.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+/* Evolution Accessibility
+ */
+
+#ifndef _EA_CALENDAR_HELPERS_H__
+#define _EA_CALENDAR_HELPERS_H__
+
+#include "ea-cal-view.h"
+
+AtkObject *
+ea_calendar_helpers_get_accessible_for (GnomeCanvasItem *canvas_item);
+
+ECalView *
+ea_calendar_helpers_get_cal_view_from (GnomeCanvasItem *canvas_item);
+
+ECalViewEvent *
+ea_calendar_helpers_get_cal_view_event_from (GnomeCanvasItem *canvas_item);
+
+#endif /* _EA_CALENDAR_HELPERS_H__ */
Index: a11y/calendar/ea-calendar.c
===================================================================
RCS file: a11y/calendar/ea-calendar.c
diff -N a11y/calendar/ea-calendar.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-calendar.c 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-calendar.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include <gal/e-text/e-text.h>
+#include "ea-calendar-helpers.h"
+#include "ea-factory.h"
+#include "ea-calendar.h"
+
+#include "calendar/ea-cal-view.h"
+#include "calendar/ea-cal-view-event.h"
+#include "calendar/ea-day-view.h"
+#include "calendar/ea-week-view.h"
+#include "calendar/ea-gnome-calendar.h"
+
+
+EA_FACTORY (EA_TYPE_CAL_VIEW, ea_cal_view, ea_cal_view_new);
+EA_FACTORY (EA_TYPE_DAY_VIEW, ea_day_view, ea_day_view_new);
+EA_FACTORY (EA_TYPE_WEEK_VIEW, ea_week_view, ea_week_view_new);
+EA_FACTORY (EA_TYPE_GNOME_CALENDAR, ea_gnome_calendar, ea_gnome_calendar_new);
+
+static gboolean ea_calendar_focus_watcher (GSignalInvocationHint *ihint,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer data);
+
+void
+gnome_calendar_a11y_init (void)
+{
+ EA_SET_FACTORY (gnome_calendar_get_type(), ea_gnome_calendar);
+ /* we only add focus watcher when accessibility is enabled
+ */
+ if (atk_get_root ())
+ g_signal_add_emission_hook (g_signal_lookup ("event", E_TYPE_TEXT),
+ 0, ea_calendar_focus_watcher,
+ NULL, (GDestroyNotify) NULL);
+}
+
+void
+e_cal_view_a11y_init (void)
+{
+ EA_SET_FACTORY (e_cal_view_get_type(), ea_cal_view);
+ /* we only add focus watcher when accessibility is enabled
+ */
+#if 0
+ if (atk_get_root ())
+ g_signal_add_emission_hook (g_signal_lookup ("selection_time_changed",
+ e_cal_view_get_type ()),
+ 0, ea_calendar_focus_watcher,
+ NULL, (GDestroyNotify) NULL);
+#endif
+}
+
+void
+e_day_view_a11y_init (void)
+{
+ EA_SET_FACTORY (e_day_view_get_type(), ea_day_view);
+}
+
+void
+e_week_view_a11y_init (void)
+{
+ EA_SET_FACTORY (e_week_view_get_type(), ea_week_view);
+}
+
+gboolean
+ea_calendar_focus_watcher (GSignalInvocationHint *ihint,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer data)
+{
+ GObject *object;
+ GdkEvent *event;
+
+ object = g_value_get_object (param_values + 0);
+ event = g_value_get_boxed (param_values + 1);
+
+ if (E_IS_TEXT (object)) {
+ /* "event" signal on canvas item
+ */
+ GnomeCanvasItem *canvas_item;
+ AtkObject *ea_event;
+
+ canvas_item = GNOME_CANVAS_ITEM (object);
+ if (event->type == GDK_FOCUS_CHANGE) {
+ 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 0
+ else if (E_IS_DAY_VIEW (object)) {
+ /* "selection_time_changed" signal on day_view
+ */
+ if (ATK_IS_SELECTION (object)) {
+ AtkSelection *atk_selection;
+ AtkObject *atk_obj;
+ atk_selection = ATK_SELECTION (object);
+ atk_obj = atk_selection_ref_selection (atk_selection, 0);
+
+#ifdef ACC_DEBUG
+ printf ("EvoAcc: ref a selection %p\n", atk_selection);
+#endif
+ atk_focus_tracker_notify (atk_obj);
+ }
+ }
+#endif
+ return TRUE;
+}
Index: a11y/calendar/ea-calendar.h
===================================================================
RCS file: a11y/calendar/ea-calendar.h
diff -N a11y/calendar/ea-calendar.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-calendar.h 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-calendar.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+/* Evolution Accessibility
+*/
+
+#ifndef _EA_CALENDAR_H__
+#define _EA_CALENDAR_H__
+
+void gnome_calendar_a11y_init (void);
+void e_cal_view_a11y_init (void);
+void e_day_view_a11y_init (void);
+void e_week_view_a11y_init (void);
+
+#endif /* _EA_CALENDAR_H__ */
Index: a11y/calendar/ea-day-view.c
===================================================================
RCS file: a11y/calendar/ea-day-view.c
diff -N a11y/calendar/ea-day-view.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view.c 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,245 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-day-view.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-day-view.h"
+#include "ea-cal-view-event.h"
+
+#include "ea-calendar-helpers.h"
+#include "calendar-commands.h"
+#include <glib/gstrfuncs.h>
+
+static void ea_day_view_class_init (EaDayViewClass *klass);
+
+static G_CONST_RETURN gchar* ea_day_view_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_day_view_get_description (AtkObject *accessible);
+static gint ea_day_view_get_n_children (AtkObject *obj);
+static AtkObject* ea_day_view_ref_child (AtkObject *obj,
+ gint i);
+static gpointer parent_class = NULL;
+
+GType
+ea_day_view_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ if (!type) {
+ static GTypeInfo tinfo = {
+ sizeof (EaDayViewClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_day_view_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaDayView), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (EaCalView, in this case)
+ *
+ * Note: we must still use run-time deriving here, because
+ * our parent class EaCalView is run-time deriving.
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ e_cal_view_get_type());
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type,
+ "EaDayView", &tinfo, 0);
+ }
+
+ return type;
+}
+
+static void
+ea_day_view_class_init (EaDayViewClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ class->get_name = ea_day_view_get_name;
+ class->get_description = ea_day_view_get_description;
+
+ class->get_n_children = ea_day_view_get_n_children;
+ class->ref_child = ea_day_view_ref_child;
+}
+
+AtkObject*
+ea_day_view_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ g_return_val_if_fail (E_IS_DAY_VIEW (widget), NULL);
+
+ object = g_object_new (EA_TYPE_DAY_VIEW, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+#ifdef ACC_DEBUG
+ printf ("EvoAcc: ea_day_view created %p\n", accessible);
+#endif
+
+ return accessible;
+}
+
+static G_CONST_RETURN gchar*
+ea_day_view_get_name (AtkObject *accessible)
+{
+ EDayView *day_view;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ if (!accessible->name) {
+ GnomeCalendar *gcal;
+ const gchar *label_text;
+ GnomeCalendarViewType view_type;
+
+ gcal = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ label_text = calendar_get_text_for_folder_bar_label (gcal);
+
+ view_type = gnome_calendar_get_view (gcal);
+ if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
+ accessible->name = g_strconcat ("work week view :",
+ label_text,
+ NULL);
+ else
+ accessible->name = g_strconcat ("day view :",
+ label_text, NULL);
+ }
+ return accessible->name;
+}
+
+static G_CONST_RETURN gchar*
+ea_day_view_get_description (AtkObject *accessible)
+{
+ EDayView *day_view;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ if (accessible->description)
+ return accessible->description;
+ else {
+ GnomeCalendar *gcal;
+ GnomeCalendarViewType view_type;
+
+ gcal = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ view_type = gnome_calendar_get_view (gcal);
+
+ if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
+ return "calendar view for a work week";
+ else
+ return "calendar view for one or more days";
+ }
+}
+
+static gint
+ea_day_view_get_n_children (AtkObject *accessible)
+{
+ EDayView *day_view;
+ gint day;
+ gint child_num = 0;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), -1);
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return -1;
+
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ child_num += day_view->long_events->len;
+
+ for (day = 0; day < day_view->days_shown; day++) {
+ child_num += day_view->events[day]->len;
+ }
+
+ return child_num;
+}
+
+static AtkObject *
+ea_day_view_ref_child (AtkObject *accessible, gint index)
+{
+ EDayView *day_view;
+ gint child_num;
+ gint day;
+ AtkObject *atk_object = NULL;
+ EDayViewEvent *event = NULL;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ child_num = atk_object_get_n_accessible_children (accessible);
+ if (child_num <= 0 || index < 0 || index >= child_num)
+ return NULL;
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ /* a long event */
+ if (index < day_view->long_events->len) {
+ event = &g_array_index (day_view->long_events,
+ EDayViewEvent, index);
+ }
+ else {
+ index -= day_view->long_events->len;
+ day = 0;
+ while (index >= day_view->events[day]->len) {
+ index -= day_view->events[day]->len;
+ ++day;
+ }
+
+ event = &g_array_index (day_view->events[day],
+ EDayViewEvent, index);
+ }
+ if (event && event->canvas_item) {
+ /* Not use atk_gobject_accessible_for_object here,
+ * we need to do special thing here
+ */
+ atk_object = ea_calendar_helpers_get_accessible_for (event->canvas_item);
+ g_object_ref (atk_object);
+ }
+ return atk_object;
+}
Index: a11y/calendar/ea-day-view.h
===================================================================
RCS file: a11y/calendar/ea-day-view.h
diff -N a11y/calendar/ea-day-view.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view.h 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-day-view.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_DAY_VIEW_H__
+#define __EA_DAY_VIEW_H__
+
+#include "ea-cal-view.h"
+#include "e-day-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_DAY_VIEW (ea_day_view_get_type ())
+#define EA_DAY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_DAY_VIEW, EaDayView))
+#define EA_DAY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_DAY_VIEW, EaDayViewClass))
+#define EA_IS_DAY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_DAY_VIEW))
+#define EA_IS_DAY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_DAY_VIEW))
+#define EA_DAY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_DAY_VIEW, EaDayViewClass))
+
+typedef struct _EaDayView EaDayView;
+typedef struct _EaDayViewClass EaDayViewClass;
+
+struct _EaDayView
+{
+ EaCalView parent;
+};
+
+GType ea_day_view_get_type (void);
+
+struct _EaDayViewClass
+{
+ EaCalViewClass parent_class;
+};
+
+AtkObject* ea_day_view_new (GtkWidget *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __EA_DAY_VIEW_H__ */
Index: a11y/calendar/ea-gnome-calendar.c
===================================================================
RCS file: a11y/calendar/ea-gnome-calendar.c
diff -N a11y/calendar/ea-gnome-calendar.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-gnome-calendar.c 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,234 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-gnome-calendar.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-gnome-calendar.h"
+#include "calendar-commands.h"
+#include <gtk/gtknotebook.h>
+
+static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
+
+static G_CONST_RETURN gchar* ea_gnome_calendar_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_gnome_calendar_get_description (AtkObject *accessible);
+static gint ea_gnome_calendar_get_n_children (AtkObject* obj);
+static AtkObject * ea_gnome_calendar_ref_child (AtkObject *obj, gint i);
+
+static void ea_gcal_switch_view_cb (GtkNotebook *widget, GtkNotebookPage *page,
+ guint index, gpointer data);
+static void ea_gcal_dates_change_cb (GnomeCalendar *gcal, gpointer data);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_gnome_calendar_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ if (!type) {
+ static GTypeInfo tinfo = {
+ sizeof (EaGnomeCalendarClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_gnome_calendar_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaGnomeCalendar), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (GailWidget, in this case)
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ GTK_TYPE_WIDGET);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type,
+ "EaGnomeCalendar", &tinfo, 0);
+
+ }
+
+ return type;
+}
+
+static void
+ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ class->get_name = ea_gnome_calendar_get_name;
+ class->get_description = ea_gnome_calendar_get_description;
+
+ class->get_n_children = ea_gnome_calendar_get_n_children;
+ class->ref_child = ea_gnome_calendar_ref_child;
+}
+
+AtkObject*
+ea_gnome_calendar_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+ GnomeCalendar *gcal;
+ GtkWidget *notebook;
+
+ g_return_val_if_fail (GNOME_IS_CALENDAR (widget), NULL);
+
+ object = g_object_new (EA_TYPE_GNOME_CALENDAR, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+ accessible->role = ATK_ROLE_FILLER;
+
+ gcal = GNOME_CALENDAR (widget);
+
+ /* listen on view type change
+ */
+ notebook = gnome_calendar_get_view_notebook_widget (gcal);
+ if (notebook) {
+ g_signal_connect (notebook, "switch_page",
+ G_CALLBACK (ea_gcal_switch_view_cb),
+ accessible);
+ g_signal_connect (widget, "dates_shown_changed",
+ G_CALLBACK (ea_gcal_dates_change_cb),
+ accessible);
+ }
+
+#ifdef ACC_DEBUG
+ printf ("EvoAcc: ea-gnome-calendar created: %p\n", accessible);
+#endif
+
+ return accessible;
+}
+
+static G_CONST_RETURN gchar*
+ea_gnome_calendar_get_name (AtkObject *accessible)
+{
+ if (accessible->name)
+ return accessible->name;
+ return "Gnome Calendar";
+}
+
+static G_CONST_RETURN gchar*
+ea_gnome_calendar_get_description (AtkObject *accessible)
+{
+ if (accessible->description)
+ return accessible->description;
+ return "Gnome Calendar";
+}
+
+static gint
+ea_gnome_calendar_get_n_children (AtkObject* obj)
+{
+ g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), 0);
+
+ if (!GTK_ACCESSIBLE (obj)->widget)
+ return -1;
+ return 4;
+}
+
+static AtkObject *
+ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
+{
+ AtkObject * child = NULL;
+ GnomeCalendar * calendarWidget;
+ GtkWidget *childWidget;
+
+ g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), NULL);
+ /* valid child index range is [0-3] */
+ if (i < 0 || i >3 )
+ return NULL;
+
+ if (!GTK_ACCESSIBLE (obj)->widget)
+ return NULL;
+ calendarWidget = GNOME_CALENDAR (GTK_ACCESSIBLE (obj)->widget);
+
+ switch (i) {
+ case 0:
+ /* for the search bar */
+ 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");
+ break;
+ case 1:
+ /* for the day/week view */
+ childWidget = gnome_calendar_get_current_view_widget (calendarWidget);
+ child = gtk_widget_get_accessible (childWidget);
+ atk_object_set_parent (child, obj);
+ break;
+ case 2:
+ /* for calendar */
+ childWidget = gnome_calendar_get_e_calendar_widget (calendarWidget);
+ child = gtk_widget_get_accessible (childWidget);
+ break;
+ case 3:
+ /* for todo list */
+ childWidget = GTK_WIDGET (gnome_calendar_get_task_pad (calendarWidget));
+ child = gtk_widget_get_accessible (childWidget);
+ break;
+ default:
+ break;
+ }
+ if (child)
+ g_object_ref(child);
+ return child;
+}
+
+static void
+ea_gcal_switch_view_cb (GtkNotebook *widget, GtkNotebookPage *page,
+ guint index, gpointer data)
+{
+ g_signal_emit_by_name (G_OBJECT(data), "children_changed",
+ 0, NULL, NULL);
+#ifdef ACC_DEBUG
+ printf ("AccDebug: switch view: children_changed notified\n");
+#endif
+}
+
+static void
+ea_gcal_dates_change_cb (GnomeCalendar *gcal, gpointer data)
+{
+ const gchar *new_name;
+
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (data);
+ g_return_if_fail (EA_IS_GNOME_CALENDAR (data));
+
+ new_name = calendar_get_text_for_folder_bar_label (gcal);
+ atk_object_set_name (ATK_OBJECT(data), new_name);
+}
Index: a11y/calendar/ea-gnome-calendar.h
===================================================================
RCS file: a11y/calendar/ea-gnome-calendar.h
diff -N a11y/calendar/ea-gnome-calendar.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-gnome-calendar.h 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-gnome-calendar.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_GNOME_CALENDAR_H__
+#define __EA_GNOME_CALENDAR_H__
+
+#include <gtk/gtkaccessible.h>
+#include "gnome-cal.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_GNOME_CALENDAR (ea_gnome_calendar_get_type ())
+#define EA_GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendar))
+#define EA_GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendarClass))
+#define EA_IS_GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_GNOME_CALENDAR))
+#define EA_IS_GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_GNOME_CALENDAR))
+#define EA_GNOME_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendarClass))
+
+typedef struct _EaGnomeCalendar EaGnomeCalendar;
+typedef struct _EaGnomeCalendarClass EaGnomeCalendarClass;
+
+struct _EaGnomeCalendar
+{
+ GtkAccessible parent;
+};
+
+GType ea_gnome_calendar_get_type (void);
+
+struct _EaGnomeCalendarClass
+{
+ GtkAccessibleClass parent_class;
+};
+
+AtkObject* ea_gnome_calendar_new (GtkWidget *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_GNOME_CALENDAR_H__ */
Index: a11y/calendar/ea-week-view.c
===================================================================
RCS file: a11y/calendar/ea-week-view.c
diff -N a11y/calendar/ea-week-view.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-week-view.c 31 Jul 2003 05:31:35 -0000
@@ -0,0 +1,235 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-week-view.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-week-view.h"
+#include "ea-cal-view.h"
+#include "ea-cal-view-event.h"
+#include "ea-calendar-helpers.h"
+#include "calendar-commands.h"
+
+static void ea_week_view_class_init (EaWeekViewClass *klass);
+
+static G_CONST_RETURN gchar* ea_week_view_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_week_view_get_description (AtkObject *accessible);
+static gint ea_week_view_get_n_children (AtkObject *obj);
+static AtkObject* ea_week_view_ref_child (AtkObject *obj,
+ gint i);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_week_view_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ if (!type) {
+ static GTypeInfo tinfo = {
+ sizeof (EaWeekViewClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_week_view_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaWeekView), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (EaCalView, in this case)
+ *
+ * Note: we must still use run-time deriving here, because
+ * our parent class EaCalView is run-time deriving.
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ e_cal_view_get_type());
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type,
+ "EaWeekView", &tinfo, 0);
+
+ }
+
+ return type;
+}
+
+static void
+ea_week_view_class_init (EaWeekViewClass *klass)
+{
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ class->get_name = ea_week_view_get_name;
+ class->get_description = ea_week_view_get_description;
+
+ class->get_n_children = ea_week_view_get_n_children;
+ class->ref_child = ea_week_view_ref_child;
+}
+
+AtkObject*
+ea_week_view_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ object = g_object_new (EA_TYPE_WEEK_VIEW, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+#ifdef ACC_DEBUG
+ printf ("EvoAcc: ea_week_view created %p\n", accessible);
+#endif
+
+ return accessible;
+}
+
+static G_CONST_RETURN gchar*
+ea_week_view_get_name (AtkObject *accessible)
+{
+ EWeekView *week_view;
+
+ g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ if (!accessible->name) {
+ GnomeCalendar *gcal;
+ const gchar *label_text;
+ GnomeCalendarViewType view_type;
+
+ gcal = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ label_text = calendar_get_text_for_folder_bar_label (gcal);
+ view_type = gnome_calendar_get_view (gcal);
+
+ view_type = gnome_calendar_get_view (gcal);
+
+ if (view_type == GNOME_CAL_MONTH_VIEW)
+ accessible->name = g_strconcat ("month view :",
+ label_text,
+ NULL);
+
+
+ else
+ accessible->name = g_strconcat ("week view :",
+ label_text, NULL);
+ }
+ return accessible->name;
+}
+
+static G_CONST_RETURN gchar*
+ea_week_view_get_description (AtkObject *accessible)
+{
+ EWeekView *week_view;
+
+ g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ if (accessible->description)
+ return accessible->description;
+ else {
+ GnomeCalendar *gcal;
+ GnomeCalendarViewType view_type;
+
+ gcal = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ view_type = gnome_calendar_get_view (gcal);
+
+ if (view_type == GNOME_CAL_MONTH_VIEW)
+ return "calendar view for a month";
+ else
+ return "calendar view for one or more weeks";
+ }
+}
+
+static gint
+ea_week_view_get_n_children (AtkObject *accessible)
+{
+ EWeekView *week_view;
+
+ 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);
+
+ return week_view->events->len;
+}
+
+static AtkObject *
+ea_week_view_ref_child (AtkObject *accessible, gint index)
+{
+ EWeekView *week_view;
+ gint child_num;
+ AtkObject *atk_object = NULL;
+ EWeekViewEvent *event;
+ EWeekViewEventSpan *span;
+ gint span_num = 0;
+
+ g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
+
+ child_num = atk_object_get_n_accessible_children (accessible);
+ if (child_num <= 0 || index < 0 || index >= child_num)
+ return NULL;
+
+ if (!GTK_ACCESSIBLE (accessible)->widget)
+ return NULL;
+ week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ event = &g_array_index (week_view->events,
+ EWeekViewEvent, index);
+ span = &g_array_index (week_view->spans, EWeekViewEventSpan,
+ event->spans_index + span_num);
+
+ if (event) {
+ /* Not use atk_gobject_accessible_for_object here,
+ * we need to do special thing here
+ */
+ atk_object = ea_calendar_helpers_get_accessible_for (span->text_item);
+ g_object_ref (atk_object);
+ }
+#ifdef ACC_DEBUG
+ printf ("EvoAcc: ea_week_view_ref_child [%d]=%p\n",
+ index, atk_object);
+#endif
+ return atk_object;
+}
Index: a11y/calendar/ea-week-view.h
===================================================================
RCS file: a11y/calendar/ea-week-view.h
diff -N a11y/calendar/ea-week-view.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-week-view.h 31 Jul 2003 05:31:36 -0000
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-week-view.h
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_WEEK_VIEW_H__
+#define __EA_WEEK_VIEW_H__
+
+#include <gtk/gtkaccessible.h>
+#include "e-week-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_WEEK_VIEW (ea_week_view_get_type ())
+#define EA_WEEK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_WEEK_VIEW, EaWeekView))
+#define EA_WEEK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_WEEK_VIEW, EaWeekViewClass))
+#define EA_IS_WEEK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_WEEK_VIEW))
+#define EA_IS_WEEK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_WEEK_VIEW))
+#define EA_WEEK_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_WEEK_VIEW, EaWeekViewClass))
+
+typedef struct _EaWeekView EaWeekView;
+typedef struct _EaWeekViewClass EaWeekViewClass;
+
+struct _EaWeekView
+{
+ GtkAccessible parent;
+};
+
+GType ea_week_view_get_type (void);
+
+struct _EaWeekViewClass
+{
+ GtkAccessibleClass parent_class;
+};
+
+AtkObject* ea_week_view_new (GtkWidget *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_WEEK_VIEW_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]