[evolution-patches] patch to imlement a11y support for minicard of AB(new version)
- From: "leon.zhang" <leon zhang sun com>
- To: Chris Toshok <toshok ximian com>
- Cc: evolution-patches <evolution-patches ximian com>
- Subject: [evolution-patches] patch to imlement a11y support for minicard of AB(new version)
- Date: Thu, 18 Dec 2003 15:06:00 +0800
hi, Chris
Current patch is a new version based on your previous comments:
1) resolved i18n issues.
2) use GString function.
3) move defination EMinicardField from e-minicard.c to e-minicard.h.
Can you review it?
thanks a lot
leon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1273
diff -u -r1.1273 ChangeLog
--- ChangeLog 8 Dec 2003 01:46:03 -0000 1.1273
+++ ChangeLog 18 Dec 2003 07:02:22 -0000
@@ -1,3 +1,7 @@
+2003-12-09 Leon Zhang <leon zhang sun com>
+
+ * configure.in: add a11y/addressbook/Makefile
+
2003-12-07 JP Rosevear <jpr ximian com>
* configure.in: update version reliance
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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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 18 Dec 2003 07:02:22 -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/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1497
diff -u -r1.1497 ChangeLog
--- addressbook/ChangeLog 6 Dec 2003 23:18:58 -0000 1.1497
+++ addressbook/ChangeLog 18 Dec 2003 07:02:25 -0000
@@ -1,3 +1,17 @@
+2003-12-09 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.h: move defination of EMinicardField from
+ e-minicard.c to e-minicard.h
+
2003-12-06 Chris Toshok <toshok ximian com>
* gui/component/select-names/e-select-names-manager.c
Index: addressbook/gui/component/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/Makefile.am,v
retrieving revision 1.100
diff -u -r1.100 Makefile.am
--- addressbook/gui/component/Makefile.am 6 Dec 2003 23:19:00 -0000 1.100
+++ addressbook/gui/component/Makefile.am 18 Dec 2003 07:02:25 -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)"\" \
@@ -54,6 +55,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 18 Dec 2003 07:02:26 -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-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 18 Dec 2003 07:02:26 -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 18 Dec 2003 07:02:28 -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 18 Dec 2003 07:02:28 -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]