[Fwd: [evolution-patches] patch for implement the basic a11y function for minicard of AB]



hi, mike  & Chris

Current patch implement the basic accessbilty for addressbook and minicard.

Most of the changed codes is in a11y/addressbook, and very little codes change happen in adddressbook directory.

1) codes in a11y/addressbook mainly finish the factual a11y support for addressbook-view, minicard-view, minicard,
minicard-label.

2) codes in addressbook initialized mapped atkobject for related gobjects to support accessbilty.

I have tested those codes in HEAD and similar codes in 1.4.5, looks ok

pls review it.

thx

leon



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1266
diff -u -r1.1266 ChangeLog
--- ChangeLog	28 Nov 2003 00:32:07 -0000	1.1266
+++ ChangeLog	1 Dec 2003 12:00:51 -0000
@@ -1,3 +1,7 @@
+2003-11-11 Leon Zhang <leon zhang sun com>
+
+	* configure.in: add a11y/addressbook/Makefile
+
 2003-11-28  Anders Carlsson  <andersca gnome org>
 
 	* configure.in: Look for mozilla-nss.pc, not mozilla.pc.
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	1 Dec 2003 12:00:51 -0000
@@ -1,4 +1,4 @@
-SUBDIRS = . calendar widgets
+SUBDIRS = . addressbook calendar widgets
 
 # 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	1 Dec 2003 12:00:51 -0000
@@ -0,0 +1,35 @@
+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-label.c  		\
+			ea-minicard-label.h		\
+			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	1 Dec 2003 12:00:51 -0000
@@ -0,0 +1,123 @@
+/* -*- 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 "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)
+{
+	static gchar new_name[50]="evolution addressbook";
+
+	g_return_val_if_fail (EA_IS_AB_VIEW(accessible), NULL);
+	if (accessible->name)
+		return accessible->name;
+
+	return new_name;
+}
+
+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	1 Dec 2003 12:00:51 -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	1 Dec 2003 12:00:51 -0000
@@ -0,0 +1,116 @@
+/* -*- 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-label.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_LABEL, ea_minicard_label, ea_minicard_label_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_label_a11y_init (void)
+{
+	EA_SET_FACTORY (e_minicard_label_get_type (), ea_minicard_label);
+}
+
+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);
+		g_signal_add_emission_hook (g_signal_lookup ("event",
+					   e_minicard_label_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);
+		}
+	} else if (E_IS_MINICARD_LABEL(object)) {
+		EMinicardLabel *minicard_label = E_MINICARD_LABEL (object);
+		ea_event = atk_gobject_accessible_for_object(minicard_label);
+		if (event->type == GDK_FOCUS_CHANGE) {
+			if (event->focus_change.in) 
+				atk_focus_tracker_notify(ea_event);
+		}
+	} else if (E_IS_TEXT(object)) {
+                GnomeCanvasItem *item = GNOME_CANVAS_ITEM(object);
+                if (E_IS_MINICARD_LABEL(item->parent)){
+                        EMinicardLabel *minicard_label = E_MINICARD_LABEL (item->parent);
+                        ea_event = atk_gobject_accessible_for_object(minicard_label);
+                        if (event->type == GDK_FOCUS_CHANGE) {
+                                if (event->focus_change.in) 
+                                        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	1 Dec 2003 12:00:51 -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-label.c
===================================================================
RCS file: a11y/addressbook/ea-minicard-label.c
diff -N a11y/addressbook/ea-minicard-label.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-minicard-label.c	1 Dec 2003 12:00:51 -0000
@@ -0,0 +1,144 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-minicard-label.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 "ea-minicard-label.h"
+#include "ea-minicard.h"
+
+static G_CONST_RETURN gchar* ea_minicard_label_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_minicard_label_get_description (AtkObject *accessible);
+
+static void ea_minicard_label_class_init (EaMinicardLabelClass *klass);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_minicard_label_get_type (void)
+{
+	static GType type = 0;
+	AtkObjectFactory *factory;
+	GTypeQuery query;
+	GType derived_atk_type;
+
+	if (!type) {
+		static  GTypeInfo tinfo =  {
+			sizeof (EaMinicardLabelClass),
+			(GBaseInitFunc) NULL,  /* base_init */
+			(GBaseFinalizeFunc) NULL,  /* base_finalize */
+			(GClassInitFunc) ea_minicard_label_class_init,
+			(GClassFinalizeFunc) NULL, /* class_finalize */
+			NULL,	   /* class_data */
+			sizeof (EaMinicardLabel),
+			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,
+						"EaMinicardLabel", &tinfo, 0);
+	}
+
+	return type;
+}
+
+static void
+ea_minicard_label_class_init (EaMinicardLabelClass *klass)
+{
+	AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	class->get_name = ea_minicard_label_get_name;
+	class->get_description = ea_minicard_label_get_description;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_label_get_name (AtkObject *accessible)
+{
+#define BUFFSIZE 200
+	static gchar name[BUFFSIZE];
+	char *p = name;
+	char *f, *fn;
+	int f_len, fn_len, count;
+	EMinicardLabel *label;
+
+	g_return_val_if_fail (EA_IS_MINICARD_LABEL(accessible), NULL);
+	memset(p, '\0', BUFFSIZE);
+
+	label = E_MINICARD_LABEL(atk_gobject_accessible_get_object
+				(ATK_GOBJECT_ACCESSIBLE(accessible)));
+
+	g_object_get (label->fieldname, "text", &fn, NULL);
+	g_object_get (label->field, "text", &f, NULL);
+
+	fn_len = strlen(fn);
+	f_len = strlen(f);
+
+	count = fn_len < BUFFSIZE? fn_len : BUFFSIZE;
+	strncpy(p, fn, count);
+
+	if (count < BUFFSIZE) {
+		int r = BUFFSIZE - count;
+		strncpy(p + count, f, f_len < r ? f_len : r);
+	}
+
+	g_free(f);
+	g_free(fn);
+
+	return name;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_label_get_description (AtkObject *accessible)
+{
+	if (accessible->description)
+		return accessible->description;
+
+	return "evolution minicard label";
+}
+
+AtkObject* 
+ea_minicard_label_new (GObject *obj)
+{
+	GObject *object;
+	AtkObject *accessible;
+
+	g_return_val_if_fail (E_IS_MINICARD_LABEL(obj), NULL);
+	object = g_object_new (EA_TYPE_MINICARD_LABEL, NULL);
+	accessible = ATK_OBJECT (object);
+	atk_object_initialize (accessible, obj);
+	accessible->role = ATK_ROLE_PANEL;
+	return accessible;
+}
Index: a11y/addressbook/ea-minicard-label.h
===================================================================
RCS file: a11y/addressbook/ea-minicard-label.h
diff -N a11y/addressbook/ea-minicard-label.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/addressbook/ea-minicard-label.h	1 Dec 2003 12:00:51 -0000
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* 
+ * ea-minicard-label.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_LABEL_H__
+#define __EA_MINICARD_LABEL_H__
+
+#include <atk/atkgobjectaccessible.h>
+#include "e-minicard-label.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define EA_TYPE_MINICARD_LABEL			(ea_minicard_label_get_type ())
+#define EA_MINICARD_LABEL(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_MINICARD_LABEL, EaMinicardLabel))
+#define EA_MINICARD_LABEL_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_MINICARD_LABEL, EaMiniCardLabelClass))
+#define EA_IS_MINICARD_LABEL(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_MINICARD_LABEL))
+#define EA_IS_MINICARD_LABEL_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((obj), EA_TYPE_MINICARD_LABEL))
+
+
+typedef struct _EaMinicardLabel       EaMinicardLabel;
+typedef struct _EaMinicardLabelClass  EaMinicardLabelClass;
+
+struct _EaMinicardLabel
+{
+	AtkGObjectAccessible parent;
+};
+
+
+struct _EaMinicardLabelClass
+{
+	AtkGObjectAccessibleClass parent_class;
+};
+
+GType ea_minicard_label_get_type (void);
+AtkObject* ea_minicard_label_new(GObject *obj);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_MINICARD_LABEL_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	1 Dec 2003 12:00:51 -0000
@@ -0,0 +1,129 @@
+/* -*- 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 "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 char name[100];
+	char *p = name;
+	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);
+
+	strcat(p,"current addressbook folder ");
+	strcat(p, (reflow->count) > 1 ? "have ":"has ");
+	strcat(p, str);
+	strcat(p, (reflow->count) > 1 ? " cards":" card");
+
+	return name;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_view_get_description (AtkObject *accessible)
+{
+	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	1 Dec 2003 12:00:51 -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	1 Dec 2003 12:00:52 -0000
@@ -0,0 +1,141 @@
+/* -*- 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 "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;
+}
+
+static G_CONST_RETURN gchar*
+ea_minicard_get_name (AtkObject *accessible)
+{
+#define BUFFSIZE 100
+	static gchar name[BUFFSIZE];
+	char *string;
+	char *p = name;
+	int len, count, r;
+	EMinicard *card;
+														       
+	g_return_val_if_fail (EA_IS_MINICARD(accessible), NULL);
+	memset(name, '\0', BUFFSIZE);
+														       
+	strcat(p, "current contact is: ");
+
+	card = E_MINICARD(atk_gobject_accessible_get_object 
+			     (ATK_GOBJECT_ACCESSIBLE(accessible)));
+	g_object_get (card->header_text, "text", &string, NULL);
+
+	count = strlen(p);
+	p += count;
+	r = BUFFSIZE - count;
+
+	len = strlen(string);
+	strncpy(p, string, len < r ? len : r);
+	g_free(string);
+
+	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	1 Dec 2003 12:00:52 -0000
@@ -0,0 +1,61 @@
+/* -*- 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"
+
+#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/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1478
diff -u -r1.1478 ChangeLog
--- addressbook/ChangeLog	26 Nov 2003 15:29:17 -0000	1.1478
+++ addressbook/ChangeLog	1 Dec 2003 12:00:54 -0000
@@ -1,3 +1,16 @@
+2003-12-1 Leon Zhang <leon zhang sun com>
+
+	* gui/component/Makefile.am: add dependence to a11y module.
+
+	* gui/widgets/e-addressbook-view.c: e_addressbook_view_class_init():
+	initialization for a11y.
+
+	* gui/widgets/e-minicard-view.c:e_minicard_view_class_init(): same.
+
+	* gui/widgets/e-minicard.c:e_minicard_class_init(): same.
+
+	* gui/widgets/e-minicard-label.c:e_minicard_label_class_init(): same.
+
 2003-11-26  JP Rosevear  <jpr ximian com>
 
 	* gui/widgets/Makefile.am: turn on deprecated gtk and libgnomeui
Index: addressbook/gui/component/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/Makefile.am,v
retrieving revision 1.94
diff -u -r1.94 Makefile.am
--- addressbook/gui/component/Makefile.am	17 Nov 2003 15:13:28 -0000	1.94
+++ addressbook/gui/component/Makefile.am	1 Dec 2003 12:00:54 -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)"\"		\
@@ -60,6 +61,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.120
diff -u -r1.120 e-addressbook-view.c
--- addressbook/gui/widgets/e-addressbook-view.c	7 Nov 2003 05:54:09 -0000	1.120
+++ addressbook/gui/widgets/e-addressbook-view.c	1 Dec 2003 12:00:55 -0000
@@ -233,6 +233,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-label.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard-label.c,v
retrieving revision 1.38
diff -u -r1.38 e-minicard-label.c
--- addressbook/gui/widgets/e-minicard-label.c	14 Nov 2003 00:38:47 -0000	1.38
+++ addressbook/gui/widgets/e-minicard-label.c	1 Dec 2003 12:00:55 -0000
@@ -180,6 +180,9 @@
 	item_class->realize     = e_minicard_label_realize;
 	item_class->unrealize   = e_minicard_label_unrealize;
 	item_class->event       = e_minicard_label_event;
+
+	 /* init the accessibility support for e_minicard_label */
+	e_minicard_label_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	1 Dec 2003 12:00:55 -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	1 Dec 2003 12:00:56 -0000
@@ -225,6 +225,9 @@
 	item_class->event      = e_minicard_event;
 
 	klass->selected        = NULL;
+
+	/* init the accessibility support for e_minicard */
+	e_minicard_a11y_init();
 }
 
 static void



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