diff options
author | Hao Sheng <hao.sheng@sun.com> | 2004-03-15 14:21:53 +0800 |
---|---|---|
committer | Yuedong Du <york@src.gnome.org> | 2004-03-15 14:21:53 +0800 |
commit | b02e9c61d7ef00837082581bea73c3f82d31f82e (patch) | |
tree | defb2be7d1cd32401ee0c9968415b284ea707384 /a11y | |
parent | 0d9c21aba16a78315034be6f74742cefe5340e9c (diff) | |
download | gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.tar gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.tar.gz gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.tar.bz2 gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.tar.lz gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.tar.xz gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.tar.zst gsoc2013-evolution-b02e9c61d7ef00837082581bea73c3f82d31f82e.zip |
Contritbuted by Leon Zhang <leon.zhang@sun.com> add directory addressbook.
2003-03-15 Hao Sheng <hao.sheng@sun.com>
* Contritbuted by 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-view.c
addressbook/ea-addressbook.h
addressbook/ea-addressbook-view.h
addressbook/ea-minicard.h
addressbook/ea-minicard-view.h
svn path=/trunk/; revision=25060
Diffstat (limited to 'a11y')
-rw-r--r-- | a11y/ChangeLog | 17 | ||||
-rw-r--r-- | a11y/Makefile.am | 2 | ||||
-rw-r--r-- | a11y/addressbook/Makefile.am | 33 | ||||
-rw-r--r-- | a11y/addressbook/ea-addressbook-view.c | 122 | ||||
-rw-r--r-- | a11y/addressbook/ea-addressbook-view.h | 61 | ||||
-rw-r--r-- | a11y/addressbook/ea-addressbook.c | 88 | ||||
-rw-r--r-- | a11y/addressbook/ea-addressbook.h | 36 | ||||
-rw-r--r-- | a11y/addressbook/ea-minicard-view.c | 134 | ||||
-rw-r--r-- | a11y/addressbook/ea-minicard-view.h | 62 | ||||
-rw-r--r-- | a11y/addressbook/ea-minicard.c | 184 | ||||
-rw-r--r-- | a11y/addressbook/ea-minicard.h | 62 |
11 files changed, 800 insertions, 1 deletions
diff --git a/a11y/ChangeLog b/a11y/ChangeLog index a4908b53aa..3a61f26e2b 100644 --- a/a11y/ChangeLog +++ b/a11y/ChangeLog @@ -1,3 +1,20 @@ +2003-03-15 Hao Sheng <hao.sheng@sun.com> + + * Contritbuted by 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-view.c + addressbook/ea-addressbook.h + addressbook/ea-addressbook-view.h + addressbook/ea-minicard.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. diff --git a/a11y/Makefile.am b/a11y/Makefile.am index c3e7a89fed..c98e486e7f 100644 --- a/a11y/Makefile.am +++ b/a11y/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = . calendar widgets +SUBDIRS = . calendar widgets addressbook # for debug #A11Y_CFLAGS += -pedantic -ansi -DACC_DEBUG -Werror diff --git a/a11y/addressbook/Makefile.am b/a11y/addressbook/Makefile.am new file mode 100644 index 0000000000..86d5fbe3ad --- /dev/null +++ b/a11y/addressbook/Makefile.am @@ -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 diff --git a/a11y/addressbook/ea-addressbook-view.c b/a11y/addressbook/ea-addressbook-view.c new file mode 100644 index 0000000000..89f0532786 --- /dev/null +++ b/a11y/addressbook/ea-addressbook-view.c @@ -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; +} diff --git a/a11y/addressbook/ea-addressbook-view.h b/a11y/addressbook/ea-addressbook-view.h new file mode 100644 index 0000000000..7513ac03ad --- /dev/null +++ b/a11y/addressbook/ea-addressbook-view.h @@ -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__ */ diff --git a/a11y/addressbook/ea-addressbook.c b/a11y/addressbook/ea-addressbook.c new file mode 100644 index 0000000000..d3f67be719 --- /dev/null +++ b/a11y/addressbook/ea-addressbook.c @@ -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; +} diff --git a/a11y/addressbook/ea-addressbook.h b/a11y/addressbook/ea-addressbook.h new file mode 100644 index 0000000000..437d34f1cc --- /dev/null +++ b/a11y/addressbook/ea-addressbook.h @@ -0,0 +1,36 @@ +/* -*- 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); + +#endif /* _EA_ADDRESSBOOK_H__ */ diff --git a/a11y/addressbook/ea-minicard-view.c b/a11y/addressbook/ea-minicard-view.c new file mode 100644 index 0000000000..a9ba5f126f --- /dev/null +++ b/a11y/addressbook/ea-minicard-view.c @@ -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; +} diff --git a/a11y/addressbook/ea-minicard-view.h b/a11y/addressbook/ea-minicard-view.h new file mode 100644 index 0000000000..e983ae5229 --- /dev/null +++ b/a11y/addressbook/ea-minicard-view.h @@ -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__ */ diff --git a/a11y/addressbook/ea-minicard.c b/a11y/addressbook/ea-minicard.c new file mode 100644 index 0000000000..c49f759d58 --- /dev/null +++ b/a11y/addressbook/ea-minicard.c @@ -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; +} diff --git a/a11y/addressbook/ea-minicard.h b/a11y/addressbook/ea-minicard.h new file mode 100644 index 0000000000..1b09ec6839 --- /dev/null +++ b/a11y/addressbook/ea-minicard.h @@ -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__ */ |