[evolution-patches] Fix for bug 332821 [composer accessibility]



Hi,
   I have attached a patch for bug #332821! Please review it, thanks.
   You can see the detail in this URL
http://bugzilla.gnome.org/show_bug.cgi?id=332821
Boby.
Index: a11y/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/a11y/ChangeLog,v
retrieving revision 1.49
diff -u -r1.49 ChangeLog
--- a11y/ChangeLog	20 Mar 2006 06:27:54 -0000	1.49
+++ a11y/ChangeLog	3 Apr 2006 03:13:44 -0000
@@ -1,3 +1,13 @@
+2006-04-03  Boby Wang <boby wang sun com>
+
+       Fix for #332821
+
+       * widgets/Makefile.am:
+       * widgets/ea-expander.[ch]:
+       Add two new files to implement the accessibility of EExpander.
+       * widgets/ea-widgets.[ch]:(e_expander_a11y_init):
+       Implement the accessibility of EExpander.
+
 2006-03-20  Boby Wang <boby wang sun com>
 	Fix for #319308
 
Index: a11y/widgets/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/a11y/widgets/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- a11y/widgets/Makefile.am	18 Jun 2005 18:26:08 -0000	1.7
+++ a11y/widgets/Makefile.am	3 Apr 2006 03:13:44 -0000
@@ -22,6 +22,8 @@
 	ea-calendar-cell.h			\
 	ea-combo-button.c			\
 	ea-combo-button.h			\
+	ea-expander.c				\
+	ea-expander.h				\
 	ea-widgets.c				\
 	ea-widgets.h

Index: a11y/widgets/ea-expander.c
===================================================================
RCS file: a11y/widgets/ea-expander.c
diff -N a11y/widgets/ea-expander.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/widgets/ea-expander.c	3 Apr 2006 03:13:44 -0000
@@ -0,0 +1,165 @@
+/* Evolution Accessibility: ea-expander.c
+ *
+ * Copyright (C) 2006 Novell, 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: Boby Wang <boby wang sun com> Sun Microsystem Inc., 2006
+ *
+ */
+
+#include <config.h>
+#include "ea-expander.h"
+#include <gtk/gtkbutton.h>
+#include <glib/gi18n.h>
+
+static AtkObjectClass *parent_class;
+static GType parent_type;
+
+/* Action IDs */
+enum {
+	ACTIVATE,
+	LAST_ACTION
+};
+
+static G_CONST_RETURN gchar*
+ea_expander_get_name (AtkObject *a11y)
+{
+	return _("Toggle Attachment Bar");
+}
+
+/* Action interface */
+static G_CONST_RETURN gchar *
+ea_expander_action_get_name (AtkAction *action, gint i)
+{
+	switch (i)
+	{
+		case ACTIVATE:
+			return _("activate");
+		default:
+			return NULL;
+	}
+}
+
+static gboolean
+ea_expander_do_action (AtkAction *action, gint i)
+{
+	GtkWidget *widget;
+	EExpander *expander;
+
+	widget = GTK_ACCESSIBLE (action)->widget;
+	if (!widget || !GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
+		return FALSE;
+
+	expander = E_EXPANDER (widget);
+
+	switch (i)
+	{
+		case ACTIVATE:
+			g_signal_emit_by_name (expander, "activate");
+			return TRUE;
+		default:
+			return FALSE;
+	}
+}
+
+static gint
+ea_expander_get_n_actions (AtkAction *action)
+{
+	return LAST_ACTION;
+}
+
+static void
+atk_action_interface_init (AtkActionIface *iface)
+{
+	g_return_if_fail (iface != NULL);
+
+	iface->do_action = ea_expander_do_action;
+	iface->get_n_actions = ea_expander_get_n_actions;
+	iface->get_name = ea_expander_action_get_name;
+}
+
+static void
+ea_expander_class_init (EaExpanderClass *klass)
+{
+	AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+
+	parent_class = g_type_class_ref (parent_type);
+
+	atk_object_class->get_name = ea_expander_get_name;
+}
+
+static void
+ea_expander_init (EaExpander *a11y)
+{
+	/* Empty */
+}
+
+GType
+ea_expander_get_type (void)
+{
+	static GType type = 0;
+
+	if (!type) {
+		AtkObjectFactory *factory;
+		GTypeQuery query;
+
+		GTypeInfo info = {
+			sizeof (EaExpanderClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) ea_expander_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL, /* class data */
+			sizeof (EaExpander),
+			0,
+			(GInstanceInitFunc) ea_expander_init,
+			NULL /* value_tree */
+		};
+
+		static const GInterfaceInfo atk_action_info = {
+			(GInterfaceInitFunc) atk_action_interface_init,
+			(GInterfaceFinalizeFunc) NULL,
+			NULL
+		};
+		
+		factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_BIN);
+		parent_type = atk_object_factory_get_accessible_type (factory);
+		g_type_query (parent_type, &query);
+
+		info.class_size = query.class_size;
+		info.instance_size = query.instance_size;
+
+		type = g_type_register_static (parent_type, "EaExpander", &info, 0);
+		g_type_add_interface_static (type, ATK_TYPE_ACTION,
+						&atk_action_info);
+	}
+
+	return type;
+}
+
+AtkObject *
+ea_expander_new (GtkWidget *widget)
+{
+	EaExpander *a11y;
+
+	a11y = g_object_new (ea_expander_get_type (), NULL);
+
+	GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
+	ATK_OBJECT (a11y)->role = ATK_ROLE_TOGGLE_BUTTON;
+
+	return ATK_OBJECT (a11y);
+}
+
Index: a11y/widgets/ea-expander.h
===================================================================
RCS file: a11y/widgets/ea-expander.h
diff -N a11y/widgets/ea-expander.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ a11y/widgets/ea-expander.h	3 Apr 2006 03:13:44 -0000
@@ -0,0 +1,50 @@
+/* Evolution Accessibility: ea-expander.h
+ *
+ * Copyright (C) 2006 Novell, 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: Boby Wang <boby wang sun com> Sun Microsystem Inc., 2006
+ *
+ */
+
+#ifndef _EA_EXPANDER_H_
+#define _EA_EXPANDER_H_
+
+#include <gtk/gtkaccessible.h>
+#include <misc/e-expander.h>
+
+#define EA_TYPE_EXPANDER           (ea_expander_get_type ())
+#define EA_EXPANDER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_EXPANDER, EaExpander))
+#define EA_EXPANDER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass,), EA_TYPE_EXPANDER, EaExpanderClass))
+#define EA_IS_EXPANDER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_EXPANDER))
+#define EA_IS_EXPANDER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_EXPANDER_CLASS))
+
+typedef struct _EaExpander EaExpander;
+typedef struct _EaExpanderClass EaExpanderClass;
+
+struct _EaExpander {
+	GtkAccessible object;
+};
+
+struct _EaExpanderClass {
+	GtkAccessibleClass parent_class;
+};
+
+/* Standard Glib function */
+GType ea_expander_get_type (void);
+AtkObject* ea_expander_new (GtkWidget *expander);
+
+#endif /* ! _EA_EXPANDER_H */_
Index: a11y/widgets/ea-widgets.c
===================================================================
RCS file: /cvs/gnome/evolution/a11y/widgets/ea-widgets.c,v
retrieving revision 1.4
diff -u -r1.4 ea-widgets.c
--- a11y/widgets/ea-widgets.c	27 Jan 2006 14:50:40 -0000	1.4
+++ a11y/widgets/ea-widgets.c	3 Apr 2006 03:13:44 -0000
@@ -26,10 +26,12 @@
 #include "ea-factory.h"
 #include "widgets/ea-calendar-item.h"
 #include "widgets/ea-combo-button.h"
+#include "widgets/ea-expander.h"
 #include "ea-widgets.h"
 
 EA_FACTORY_GOBJECT (EA_TYPE_CALENDAR_ITEM, ea_calendar_item, ea_calendar_item_new)
 EA_FACTORY (EA_TYPE_COMBO_BUTTON, ea_combo_button, ea_combo_button_new)
+EA_FACTORY (EA_TYPE_EXPANDER, ea_expander, ea_expander_new)
 
 void e_calendar_item_a11y_init (void)
 {
@@ -39,4 +41,9 @@
 void e_combo_button_a11y_init (void)
 {
     EA_SET_FACTORY (e_combo_button_get_type (), ea_combo_button);
+}
+
+void e_expander_a11y_init (void)
+{
+     EA_SET_FACTORY (e_expander_get_type (), ea_expander);
 }
Index: a11y/widgets/ea-widgets.h
===================================================================
RCS file: /cvs/gnome/evolution/a11y/widgets/ea-widgets.h,v
retrieving revision 1.2
diff -u -r1.2 ea-widgets.h
--- a11y/widgets/ea-widgets.h	4 Jan 2005 07:40:37 -0000	1.2
+++ a11y/widgets/ea-widgets.h	3 Apr 2006 03:13:44 -0000
@@ -31,5 +31,6 @@
 
 void e_calendar_item_a11y_init (void);
 void e_combo_button_a11y_init (void);
+void e_expander_a11y_init (void);
 
 #endif /* _EA_WIDGETS_H__ */
Index: widgets/misc/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.403
diff -u -r1.403 ChangeLog
--- widgets/misc/ChangeLog	6 Mar 2006 10:47:01 -0000	1.403
+++ widgets/misc/ChangeLog	3 Apr 2006 03:13:47 -0000
@@ -1,3 +1,9 @@
+2006-04-03  Boby Wang  <boby wang sun com>
+
+	** Fixes bug #332821
+	* e-expander.c: (e_expander_class_init):
+	Implement the accessibility of EExpander.
+
 2006-03-06  Simon Zheng  <simon zheng sun com>
 
 	Fixes bug #332140
Index: widgets/misc/e-expander.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-expander.c,v
retrieving revision 1.4
diff -u -r1.4 e-expander.c
--- widgets/misc/e-expander.c	30 Jan 2006 12:28:04 -0000	1.4
+++ widgets/misc/e-expander.c	3 Apr 2006 03:13:47 -0000
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include "e-expander.h"
+#include "ea-widgets.h"
 
 #include <gtk/gtklabel.h>
 #include <gtk/gtkcontainer.h>
@@ -243,6 +244,8 @@
 		  NULL, NULL,
 		  g_cclosure_marshal_VOID__VOID,
 		  G_TYPE_NONE, 0);
+
+  e_expander_a11y_init();
 }
 
 static void


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