[evolution-patches] provide a11y support for minicard of addressbook



 hi, Chris

This patch is based on the current HEAD of evolution.
It can provide a11y support for minicard  of addressbook.
pls, review it.
(I have sent it days before, but this one is the newest version synchronized with the newest HEAD)
thanks


leon

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1311
diff -u -r1.1311 ChangeLog
--- ChangeLog	24 Feb 2004 21:51:54 -0000	1.1311
+++ ChangeLog	27 Feb 2004 02:54:20 -0000
@@ -1,3 +1,7 @@
+2004-02-26 Leon Zhang <leon zhang sun com>
+
+	*  configure.in: add a11y/addressbook/Makefile
+
 2004-02-24  JP Rosevear <jpr ximian com>
 
 	* marshal.mk: make sure to use the srcdir to build the list
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.667
diff -u -r1.667 configure.in
--- configure.in	23 Feb 2004 20:22:09 -0000	1.667
+++ configure.in	27 Feb 2004 02:54:20 -0000
@@ -1285,6 +1285,7 @@
 AC_OUTPUT([ po/Makefile.in
 Makefile
 a11y/Makefile
+a11y/addressbook/Makefile
 a11y/calendar/Makefile
 a11y/widgets/Makefile
 addressbook/Makefile
Index: a11y/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/a11y/ChangeLog,v
retrieving revision 1.15
diff -u -r1.15 ChangeLog
--- a11y/ChangeLog	10 Dec 2003 03:56:29 -0000	1.15
+++ a11y/ChangeLog	27 Feb 2004 02:54:21 -0000
@@ -1,3 +1,24 @@
+2003-02-26 Leon Zhang <leon zhang sun com>
+
+	* 2003-11-13 Leon Zhang <leon zhang sun com>
+
+	* Makefile.am: add directory addressbook.
+
+	* implement basic accessbility addressbook's minicard.
+	add new directory and Files below:
+		addressbook/
+		addressbook/Makefile.am
+		addressbook/ea-addressbook.c
+		addressbook/ea-addressbook-view.c
+		addressbook/ea-minicard.c
+		addressbook/ea-minicard-label.c
+		addressbook/ea-minicard-view.c
+		addressbook/ea-addressbook.h
+		addressbook/ea-addressbook-view.h
+		addressbook/ea-minicard.h
+		addressbook/ea-minicard-label.h
+		addressbook/ea-minicard-view.h
+
 2003-12-10  Bolian Yin <bolian yin sun com>
 
 	* calendar/ea-cal-view-event.c (ea_cal_view_event_get_index_in_parent): corret index error in week view.
Index: a11y/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/a11y/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- a11y/Makefile.am	4 Nov 2003 08:15:56 -0000	1.5
+++ a11y/Makefile.am	27 Feb 2004 02:54:22 -0000
@@ -1,4 +1,4 @@
-SUBDIRS = . calendar widgets
+SUBDIRS = . calendar widgets addressbook
 
 # for debug
 #A11Y_CFLAGS += -pedantic -ansi -DACC_DEBUG -Werror
Index: a11y/addressbook/Makefile.am
===================================================================
RCS file: a11y/addressbook/Makefile.am
diff -N a11y/addressbook/Makefile.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/Makefile.am	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,33 @@
+privlib_LTLIBRARIES = libevolution-addressbook-a11y.la
+
+INCLUDES =						\
+	-DG_LOG_DOMAIN=\"evolution-a11y\"		\
+	-I$(top_srcdir)/a11y				\
+	-I$(top_srcdir)/a11y/addressbook		\
+	-I$(top_srcdir)/shell				\
+	-I$(top_srcdir)/addressbook			\
+	-I$(top_srcdir)/addressbook/gui			\
+	-I$(top_srcdir)/addressbook/gui/widgets		\
+	-I$(top_srcdir)/addressbook/gui/contact-editor	\
+	-I$(top_srcdir)/addressbook/backend             \
+	-I$(top_srcdir)/addressbook/backend/ebook       \
+	-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_ADDRESSBOOK_CFLAGS)
+
+libevolution_addressbook_a11y_la_SOURCES =		\
+			ea-minicard.c  			\
+			ea-minicard.h			\
+			ea-minicard-view.c		\
+			ea-minicard-view.h		\
+			ea-addressbook-view.c		\
+			ea-addressbook-view.h		\
+			ea-addressbook.c		\
+			ea-addressbook.h
Index: a11y/addressbook/ea-addressbook-view.c
===================================================================
RCS file: a11y/addressbook/ea-addressbook-view.c
diff -N a11y/addressbook/ea-addressbook-view.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-addressbook-view.c	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,122 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-addressbook-view.c
+ * Copyright (C) 2000  Ximian, Inc.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:  Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ */
+
+#include <config.h>
+
+#include <libgnome/gnome-i18n.h>
+#include "ea-addressbook-view.h"
+
+static G_CONST_RETURN gchar* ea_ab_view_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_ab_view_get_description (AtkObject *accessible);
+
+static void ea_ab_view_class_init (EABViewClass *klass);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_ab_view_get_type (void)
+{
+	static GType type = 0;
+	AtkObjectFactory *factory;
+	GTypeQuery query;
+	GType derived_atk_type;
+
+	if (!type) {
+		static  GTypeInfo tinfo =  {
+			sizeof (EABViewClass),
+			(GBaseInitFunc) NULL,  /* base_init */
+			(GBaseFinalizeFunc) NULL,  /* base_finalize */
+			(GClassInitFunc) ea_ab_view_class_init,
+			(GClassFinalizeFunc) NULL, /* class_finalize */
+			NULL,	/* class_data */
+			sizeof (EaABView),
+			0,	/* n_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_EVENT_BOX);
+		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,
+						"EaABView", &tinfo, 0);
+	}
+
+	return type;
+}
+
+static void
+ea_ab_view_class_init (EABViewClass *klass)
+{
+	AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	class->get_name = ea_ab_view_get_name;
+	class->get_description = ea_ab_view_get_description;
+}
+
+static G_CONST_RETURN gchar*
+ea_ab_view_get_name (AtkObject *accessible)
+{
+	g_return_val_if_fail (EA_IS_AB_VIEW(accessible), NULL);
+	if (accessible->name)
+		return accessible->name;
+
+	return _("evolution addressbook");
+}
+
+static G_CONST_RETURN gchar*
+ea_ab_view_get_description (AtkObject *accessible)
+{
+	if (accessible->description)
+		return accessible->description;
+
+	return _("evolution addressbook");
+}
+
+AtkObject* 
+ea_ab_view_new (GtkWidget *obj)
+{
+	GObject *object;
+	AtkObject *accessible;
+
+	g_return_val_if_fail(obj != NULL, NULL);
+	g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW(obj), NULL);
+
+	object = g_object_new (EA_TYPE_AB_VIEW, NULL);
+
+	accessible = ATK_OBJECT (object);
+	atk_object_initialize (accessible, obj);
+	accessible->role = ATK_ROLE_CANVAS;
+
+	return accessible;
+}
Index: a11y/addressbook/ea-addressbook-view.h
===================================================================
RCS file: a11y/addressbook/ea-addressbook-view.h
diff -N a11y/addressbook/ea-addressbook-view.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-addressbook-view.h	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-addressbook_view.h
+ * Copyright (C) 2000  Ximian, Inc.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ */
+#ifndef __EA_ADDRESSBOOK_VIEW_H__
+#define __EA_ADDRESSBOOK_VIEW_H__
+
+#include <gtk/gtkaccessible.h>
+#include "e-addressbook-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define EA_TYPE_AB_VIEW			(ea_ab_view_get_type ())
+#define EA_AB_VIEW(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_AB_VIEW, EaABView))
+#define EA_AB_VIEW_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_AB_VIEW, EaABViewClass))
+#define EA_IS_AB_VIEW(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_AB_VIEW))
+#define EA_IS_AB_VIEW_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((obj), EA_TYPE_AB_VIEW))
+
+typedef struct _EaABView       EaABView;
+typedef struct _EaABViewClass  EaABViewClass;
+
+struct _EaABView
+{
+	GtkAccessible parent;
+};
+
+
+struct _EaABViewClass
+{
+	GtkAccessibleClass parent_class;
+};
+
+GType ea_ab_view_get_type (void);
+AtkObject* ea_ab_view_new(GtkWidget *obj);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_ADDRESSBOOK_VIEW_H__ */
Index: a11y/addressbook/ea-addressbook.c
===================================================================
RCS file: a11y/addressbook/ea-addressbook.c
diff -N a11y/addressbook/ea-addressbook.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-addressbook.c	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+/* Evolution Accessibility: ea-addressbook.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: Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include <gal/e-text/e-text.h>
+#include "ea-factory.h"
+#include "ea-addressbook.h"
+#include "addressbook/ea-minicard.h"
+#include "addressbook/ea-minicard-view.h"
+#include "addressbook/ea-addressbook-view.h"
+
+EA_FACTORY_GOBJECT (EA_TYPE_MINICARD, ea_minicard, ea_minicard_new);
+EA_FACTORY_GOBJECT (EA_TYPE_MINICARD_VIEW, ea_minicard_view, ea_minicard_view_new);
+EA_FACTORY_GOBJECT (EA_TYPE_AB_VIEW, ea_ab_view, ea_ab_view_new);
+
+static gboolean ea_addressbook_focus_watcher (GSignalInvocationHint *ihint,
+					      guint n_param_values,
+					      const GValue *param_values,
+					      gpointer data);
+
+void e_minicard_a11y_init (void)
+{
+	EA_SET_FACTORY (e_minicard_get_type (), ea_minicard);
+}
+
+void e_minicard_view_a11y_init (void)
+{
+	EA_SET_FACTORY (e_minicard_view_get_type (), ea_minicard_view);
+
+	if (atk_get_root ()) {
+		g_signal_add_emission_hook (g_signal_lookup ("event",
+					    e_minicard_get_type()),
+					    0, ea_addressbook_focus_watcher,
+					    NULL, (GDestroyNotify) NULL);
+	}
+}
+
+void eab_view_a11y_init (void)
+{
+	EA_SET_FACTORY (eab_view_get_type (), ea_ab_view);
+}
+
+gboolean
+ea_addressbook_focus_watcher (GSignalInvocationHint *ihint,
+			   guint n_param_values,
+			   const GValue *param_values,
+			   gpointer data)
+{
+	GObject *object;
+	GdkEvent *event;
+	AtkObject *ea_event = NULL;
+
+	object = g_value_get_object (param_values + 0);
+	event = g_value_get_boxed (param_values + 1);
+
+	if (E_IS_MINICARD(object)) {
+		EMinicard *minicard = E_MINICARD (object);
+                GnomeCanvasItem *item = GNOME_CANVAS_ITEM(object);
+		ea_event = atk_gobject_accessible_for_object(minicard);
+		if (event->type == GDK_FOCUS_CHANGE) {
+			if ((event->focus_change.in) && (E_IS_MINICARD(item->canvas->focused_item)))
+				atk_focus_tracker_notify(ea_event);
+		}
+	}
+
+	return TRUE;
+}
Index: a11y/addressbook/ea-addressbook.h
===================================================================
RCS file: a11y/addressbook/ea-addressbook.h
diff -N a11y/addressbook/ea-addressbook.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-addressbook.h	27 Feb 2004 02:54:23 -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-addressbook.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: Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+/* Evolution Accessibility
+*/
+
+#ifndef _EA_ADDRESSBOOK_H__
+#define _EA_ADDRESSBOOK_H__
+
+void eab_view_a11y_init (void);
+void e_minicard_view_a11y_init (void);
+void e_minicard_a11y_init (void);
+void e_minicard_label_a11y_init (void);
+
+#endif /* _EA_ADDRESSBOOK_H__ */
Index: a11y/addressbook/ea-minicard-view.c
===================================================================
RCS file: a11y/addressbook/ea-minicard-view.c
diff -N a11y/addressbook/ea-minicard-view.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-minicard-view.c	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,134 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-minicard-view.c
+ * Copyright (C) 2000  Ximian, Inc.
+ * Author:  Leon Zhang < leon zhang sun com>
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <libgnome/gnome-i18n.h>
+#include <string.h>
+#include "ea-minicard.h"
+#include "ea-minicard-view.h"
+
+static G_CONST_RETURN gchar* ea_minicard_view_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_minicard_view_get_description (AtkObject *accessible);
+
+static void ea_minicard_view_class_init (EaMinicardViewClass *klass);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_minicard_view_get_type (void)
+{
+	static GType type = 0;
+	AtkObjectFactory *factory;
+	GTypeQuery query;
+	GType derived_atk_type;
+
+	if (!type) {
+		static  GTypeInfo tinfo =  {
+			sizeof (EaMinicardViewClass),
+			(GBaseInitFunc) NULL,  /* base_init */
+			(GBaseFinalizeFunc) NULL,  /* base_finalize */
+			(GClassInitFunc) ea_minicard_view_class_init,
+			(GClassFinalizeFunc) NULL, /* class_finalize */
+			NULL,	   /* class_data */
+			sizeof (EaMinicardView),
+			0,	     /* n_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 (),
+							GNOME_TYPE_CANVAS_GROUP);
+		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,
+						"EaMinicardView", &tinfo, 0);
+	}
+
+	return type;
+}
+
+static void
+ea_minicard_view_class_init (EaMinicardViewClass *klass)
+{
+	AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	class->get_name = ea_minicard_view_get_name;
+	class->get_description = ea_minicard_view_get_description;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_view_get_name (AtkObject *accessible)
+{
+	static gchar name[100];
+	GString *new_str = g_string_new (NULL);
+	gchar str[10];
+	EReflow *reflow;
+
+	g_return_val_if_fail (EA_IS_MINICARD_VIEW(accessible), NULL);
+	memset (name, '\0', 100);
+	memset (str, '\0', 10);
+
+	reflow = E_REFLOW(atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible)));
+	sprintf (str, "%d", reflow->count);
+	g_string_append (new_str, _("current addressbook folder "));
+	g_string_append (new_str, (reflow->count) > 1 ? _("have ") : _("has "));
+	g_string_append (new_str, str);
+	g_string_append (new_str, (reflow->count) > 1 ? _(" cards") : _(" card"));
+
+	strcpy (name, new_str->str);
+	g_string_free (new_str, TRUE);
+
+	return name;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_view_get_description (AtkObject *accessible)
+{
+	g_return_val_if_fail (EA_IS_MINICARD_VIEW(accessible), NULL);
+	if (accessible->description)
+		return accessible->description;
+
+	return _("evolution addressbook");
+}
+
+AtkObject* 
+ea_minicard_view_new (GObject *obj)
+{
+	GObject *object;
+	AtkObject *accessible;
+
+	g_return_val_if_fail (E_IS_MINICARD_VIEW(obj), NULL);
+	object = g_object_new (EA_TYPE_MINICARD_VIEW, NULL);
+	accessible = ATK_OBJECT (object);
+	atk_object_initialize (accessible, obj);
+	accessible->role = ATK_ROLE_PANEL;
+	return accessible;
+}
Index: a11y/addressbook/ea-minicard-view.h
===================================================================
RCS file: a11y/addressbook/ea-minicard-view.h
diff -N a11y/addressbook/ea-minicard-view.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-minicard-view.h	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-minicard-view.h
+ * Copyright (C) 2000  Ximian, Inc.
+ * Author: Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __EA_MINICARD_VIEW_H__
+#define __EA_MINICARD_VIEW_H__
+
+#include <atk/atkgobjectaccessible.h>
+#include "e-minicard-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define EA_TYPE_MINICARD_VIEW			(ea_minicard_view_get_type ())
+#define EA_MINICARD_VIEW(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_MINICARD_VIEW, EaMinicardView))
+#define EA_MINICARD_VIEW_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_MINICARD_VIEW, EaMiniCardViewClass))
+#define EA_IS_MINICARD_VIEW(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_MINICARD_VIEW))
+#define EA_IS_MINICARD_VIEW_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((obj), EA_TYPE_MINICARD_VIEW))
+
+
+typedef struct _EaMinicardView       EaMinicardView;
+typedef struct _EaMinicardViewClass  EaMinicardViewClass;
+
+struct _EaMinicardView
+{
+	AtkGObjectAccessible parent;
+};
+
+
+struct _EaMinicardViewClass
+{
+	AtkGObjectAccessibleClass parent_class;
+};
+
+GType ea_minicard_view_get_type (void);
+
+AtkObject* ea_minicard_view_new(GObject *obj);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_MINICARD_VIEW_H__ */
Index: a11y/addressbook/ea-minicard.c
===================================================================
RCS file: a11y/addressbook/ea-minicard.c
diff -N a11y/addressbook/ea-minicard.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-minicard.c	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,184 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-minicard.c
+ * Copyright (C) 2000  Ximian, Inc.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:  Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ */
+
+#include <config.h>
+#include <string.h>
+#include <libgnome/gnome-i18n.h>
+#include "ea-minicard.h"
+
+static G_CONST_RETURN gchar* ea_minicard_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_minicard_get_description (AtkObject *accessible);
+
+static void ea_minicard_class_init (EaMinicardClass *klass);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_minicard_get_type (void)
+{
+	static GType type = 0;
+	AtkObjectFactory *factory;
+	GTypeQuery query;
+	GType derived_atk_type;
+
+	if (!type) {
+		static  GTypeInfo tinfo =  {
+			sizeof (EaMinicardClass),
+			(GBaseInitFunc) NULL,  /* base_init */
+			(GBaseFinalizeFunc) NULL,  /* base_finalize */
+			(GClassInitFunc) ea_minicard_class_init,
+			(GClassFinalizeFunc) NULL, /* class_finalize */
+			NULL,	/* class_data */
+			sizeof (EaMinicard),
+			0,	/* n_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 (),
+						    GNOME_TYPE_CANVAS_GROUP);
+		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,
+						"EaMinicard", &tinfo, 0);
+	}
+
+	return type;
+}
+
+static void
+ea_minicard_class_init (EaMinicardClass *klass)
+{
+	AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	class->get_name = ea_minicard_get_name;
+	class->get_description = ea_minicard_get_description;
+}
+
+/*
+ *  we access the main content of current minicard, including 
+ *  header text, label(field, field name)
+ */
+static G_CONST_RETURN gchar*
+ea_minicard_get_name (AtkObject *accessible)
+{
+#define BUFFERSIZE 500
+	static gchar name[BUFFERSIZE];
+	GString *new_str = g_string_new (NULL);
+	gchar *string;
+	EMinicard *card;
+	GList *list;
+
+	g_return_val_if_fail (EA_IS_MINICARD(accessible), NULL);
+	memset (name, '\0', BUFFERSIZE);
+
+	g_string_append (new_str, _("contact's header: "));
+
+	card = E_MINICARD(atk_gobject_accessible_get_object 
+			 (ATK_GOBJECT_ACCESSIBLE(accessible)));
+	g_object_get (card->header_text, "text", &string, NULL);
+
+	/* get header of current card */
+	g_string_append (new_str, string);
+	g_free (string);
+
+	/* if there exist no enough space for remain info, return */
+	if (new_str->len >= BUFFERSIZE) {
+		strncpy (name, new_str->str, BUFFERSIZE);
+		return name;
+	}
+
+	g_string_append (new_str, " ");
+
+	for ( list = card->fields; list; list = g_list_next( list ) ) {
+		gchar *f, *fn;
+		EMinicardLabel *label;
+
+		label = E_MINICARD_LABEL (E_MINICARD_FIELD (list->data)->label);
+
+		/* get field name */
+		g_object_get (label->fieldname, "text", &fn, NULL);
+		g_string_append (new_str, fn);
+		g_free (fn);
+
+		if (new_str->len >= BUFFERSIZE) {
+			strncpy(name, new_str->str, BUFFERSIZE);
+			return name;
+		}
+
+		g_string_append (new_str, " ");
+
+		/* get field */
+		g_object_get (label->field, "text", &f, NULL);
+		g_string_append (new_str, f);
+		g_free (f);
+
+		if (new_str->len >= BUFFERSIZE) {
+			strncpy (name, new_str->str, BUFFERSIZE);
+			return name;
+		}
+
+		g_string_append (new_str, " ");
+	}
+
+	strcpy (name, new_str->str);
+	g_string_free (new_str, TRUE);
+
+	return name;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_get_description (AtkObject *accessible)
+{
+	if (accessible->description)
+		return accessible->description;
+																
+	return _("evolution minicard");
+}
+
+AtkObject* 
+ea_minicard_new (GObject *obj)
+{
+	GObject *object;
+	AtkObject *accessible;
+
+	g_return_val_if_fail(obj != NULL, NULL);
+	g_return_val_if_fail (E_IS_MINICARD(obj), NULL);
+
+	object = g_object_new (EA_TYPE_MINICARD, NULL);
+	accessible = ATK_OBJECT (object);
+	atk_object_initialize (accessible, obj);
+
+	accessible->role = ATK_ROLE_PANEL;
+	return accessible;
+}
Index: a11y/addressbook/ea-minicard.h
===================================================================
RCS file: a11y/addressbook/ea-minicard.h
diff -N a11y/addressbook/ea-minicard.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-minicard.h	27 Feb 2004 02:54:23 -0000
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-minicard.h
+ * Copyright (C) 2000  Ximian, Inc.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * 
+ * Author: Leon Zhang <leon zhang sun com> Sun Microsystem Inc., 2003
+ */
+#ifndef __EA_MINICARD_H__
+#define __EA_MINICARD_H__
+
+#include <atk/atkgobjectaccessible.h>
+#include "e-minicard.h"
+#include "e-minicard-label.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define EA_TYPE_MINICARD			(ea_minicard_get_type ())
+#define EA_MINICARD(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_MINICARD, EaMinicard))
+#define EA_MINICARD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_MINICARD, EaMiniCardClass))
+#define EA_IS_MINICARD(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_MINICARD))
+#define EA_IS_MINICARD_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((obj), EA_TYPE_MINICARD))
+
+typedef struct _EaMinicard       EaMinicard;
+typedef struct _EaMinicardClass  EaMinicardClass;
+
+struct _EaMinicard
+{
+	AtkGObjectAccessible parent;
+};
+
+
+struct _EaMinicardClass
+{
+	AtkGObjectAccessibleClass parent_class;
+};
+
+GType ea_minicard_get_type (void);
+AtkObject* ea_minicard_new(GObject *obj);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_MINICARD_H__ */
Index: addressbook/gui/component/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/Makefile.am,v
retrieving revision 1.102
diff -u -r1.102 Makefile.am
--- addressbook/gui/component/Makefile.am	7 Jan 2004 14:39:21 -0000	1.102
+++ addressbook/gui/component/Makefile.am	27 Feb 2004 02:54:23 -0000
@@ -12,6 +12,7 @@
 	-I$(top_srcdir)/addressbook/gui/widgets			\
 	-I$(top_srcdir)/addressbook/backend			\
 	-I$(top_builddir)/addressbook/backend			\
+	-I$(top_builddir)/a11y/addressbook			\
 	-DEVOLUTION_DATADIR=\""$(datadir)"\"			\
 	-DEVOLUTION_GLADEDIR=\""$(gladedir)"\"			\
 	-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\"		\
@@ -57,6 +58,7 @@
 	$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la	\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la					\
 	$(top_builddir)/widgets/menus/libmenus.la					\
+	$(top_builddir)/a11y/addressbook/libevolution-addressbook-a11y.la		\
 	$(EVOLUTION_ADDRESSBOOK_LIBS) $(LDAP_LIBS)
 
 
Index: addressbook/gui/widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.130
diff -u -r1.130 e-addressbook-view.c
--- addressbook/gui/widgets/e-addressbook-view.c	11 Feb 2004 20:29:33 -0000	1.130
+++ addressbook/gui/widgets/e-addressbook-view.c	27 Feb 2004 02:54:24 -0000
@@ -272,6 +272,9 @@
 
 	if (!clipboard_atom)
 		clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+
+	/* init the accessibility support for e_addressbook_view */
+	eab_view_a11y_init();
 }
 
 static void
Index: addressbook/gui/widgets/e-minicard-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard-view.c,v
retrieving revision 1.62
diff -u -r1.62 e-minicard-view.c
--- addressbook/gui/widgets/e-minicard-view.c	21 Oct 2003 18:48:56 -0000	1.62
+++ addressbook/gui/widgets/e-minicard-view.c	27 Feb 2004 02:54:24 -0000
@@ -489,6 +489,9 @@
 
 	reflow_class->selection_event = e_minicard_view_selection_event;
 	/* GnomeCanvasItem method overrides */
+
+	/* init the accessibility support for e_minicard_view */
+        e_minicard_view_a11y_init();
 }
 
 static void
Index: addressbook/gui/widgets/e-minicard.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard.c,v
retrieving revision 1.110
diff -u -r1.110 e-minicard.c
--- addressbook/gui/widgets/e-minicard.c	14 Nov 2003 00:38:47 -0000	1.110
+++ addressbook/gui/widgets/e-minicard.c	27 Feb 2004 02:54:24 -0000
@@ -60,18 +60,10 @@
 
 static GnomeCanvasGroupClass *parent_class = NULL;
 
-typedef struct _EMinicardField EMinicardField;
-
-struct _EMinicardField {
-	EContactField field;
-	GnomeCanvasItem *label;
-};
-
 #define d(x)
 
 #define LIST_ICON_FILENAME "contact-list-16.png"
 
-#define E_MINICARD_FIELD(field) ((EMinicardField *)(field))
 
 static void
 e_minicard_field_destroy(EMinicardField *field)
@@ -225,6 +217,9 @@
 	item_class->event      = e_minicard_event;
 
 	klass->selected        = NULL;
+
+	/* init the accessibility support for e_minicard */
+	e_minicard_a11y_init();
 }
 
 static void
Index: addressbook/gui/widgets/e-minicard.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard.h,v
retrieving revision 1.32
diff -u -r1.32 e-minicard.h
--- addressbook/gui/widgets/e-minicard.h	7 Nov 2003 05:51:41 -0000	1.32
+++ addressbook/gui/widgets/e-minicard.h	27 Feb 2004 02:54:24 -0000
@@ -106,6 +106,14 @@
 	void (* style_set) (EMinicard *minicard, GtkStyle *previous_style);
 };
 
+typedef struct _EMinicardField EMinicardField;
+
+struct _EMinicardField {
+	EContactField field;
+	GnomeCanvasItem *label;
+};
+
+#define E_MINICARD_FIELD(field) ((EMinicardField *)(field))
 
 GType       e_minicard_get_type     (void);
 const char *e_minicard_get_card_id  (EMinicard *minicard);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]