Re: [evolution-patches] Patch about a11y bugs in widgets directory



JP Rosevear wrote:

On Wed, 2004-09-29 at 17:52 +0800, Li Yuan wrote:
Hi, JP and Rodrigo

Now I have a patch in widgets directory for cvs HEAD. It fixes some a11y bugs. The patch has passed our internel review.
Please help me to review it. Thanks a lot.

@@ -179,6 +181,10 @@
						gnome_canvas_widget_get_type (),
						"widget", button,
						NULL);
+	a11y = gtk_widget_get_accessible (button);
+	if (a11y != NULL) {
+		atk_object_set_name (a11y, _("Previous Button"));
+	}

Also, why do we check for a non-null a11y object?  The gtk color
selector

Its usual not to wrap a single statement in {}.
I removed the {}, but i think gtk_widget_get_accessible may return NULL here.


Index: misc/e-combo-button.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-combo-button.c,v
retrieving revision 1.18
diff -u -r1.18 e-combo-button.c
--- misc/e-combo-button.c	17 May 2004 17:10:39 -0000	1.18
+++ misc/e-combo-button.c	29 Sep 2004 09:36:24 -0000
@@ -390,6 +390,12 @@
	}
}

+static void
+impl_activated (GtkButton *button)
+{
+	gtk_signal_emit (GTK_OBJECT (button), signals[ACTIVATE_DEFAULT]);
+}
+

static void
class_init (GtkObjectClass *object_class)
@@ -408,6 +414,7 @@

	button_class = GTK_BUTTON_CLASS (object_class);
	button_class->released = impl_released;
+	button_class->activate = impl_activated;

	signals[ACTIVATE_DEFAULT] = gtk_signal_new ("activate_default",
						    GTK_RUN_FIRST,

Why is this emitting the activated signal now? in impl_released we
explicity override the default activate behaviour.
removed from the patch

-JP
attach is the new patch

thanks,
Li
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/ChangeLog,v
retrieving revision 1.123
diff -u -r1.123 ChangeLog
--- ChangeLog	13 Sep 2004 20:52:19 -0000	1.123
+++ ChangeLog	28 Oct 2004 03:52:55 -0000
@@ -1,3 +1,28 @@
+2004-10-28  Li Yuan  <li yuan sun com>
+
+	* e-timezone-dialog/e-timezone-dialog.glade:
+	Add a name for timezone combox.
+	* misc/e-calendar.c: (e_calendar_init), (e_calendar_new):
+	Make accessibility name and description translatable.
+	Add a atk name for the two buttons so that they can be UI
+	grabbed by GOK.
+	* misc/e-dateedit.c: (e_date_edit_new), (create_children):
+	Add a name for atk object.
+	Make accessibility name and description translatable.
+	Add name and description for the date_entry, date_button
+	and time_combo.
+	(e_date_edit_show_date_popup), (hide_date_popup):
+	Grab and ungrab keyboard.
+	add_relation():
+	New function to add labelled_by relation for entry
+	and combobox.
+	* misc/e-map.c: (e_map_new):
+	Add a name for world map widget.
+	Make accessibility name and description translatable.
+	Set the atk role to image.
+	* misc/e-multi-config-dialog.c: (e_multi_config_dialog_add_page):
+	Add an atk name for the page.
+
 2004-09-13  Rodney Dawes  <dobey novell com>
 
 	* e-timezone-dialog/e-timezone-dialog.c (get_widgets):
Index: e-timezone-dialog/e-timezone-dialog.glade
===================================================================
RCS file: /cvs/gnome/evolution/widgets/e-timezone-dialog/e-timezone-dialog.glade,v
retrieving revision 1.7
diff -u -r1.7 e-timezone-dialog.glade
--- e-timezone-dialog/e-timezone-dialog.glade	13 Sep 2004 20:52:19 -0000	1.7
+++ e-timezone-dialog/e-timezone-dialog.glade	28 Oct 2004 03:52:57 -0000
@@ -291,6 +291,9 @@
 		  <property name="case_sensitive">False</property>
 		  <property name="enable_arrow_keys">True</property>
 		  <property name="enable_arrows_always">False</property>
+		  <accessibility>
+		    <atkproperty name="AtkObject::accessible_name" translatable="yes">TimeZone Combobox</atkproperty>
+		  </accessibility>
 
 		  <child internal-child="entry">
 		    <widget class="GtkEntry" id="combo-entry1">
Index: misc/e-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-calendar.c,v
retrieving revision 1.23
diff -u -r1.23 e-calendar.c
--- misc/e-calendar.c	5 Dec 2003 02:01:46 -0000	1.23
+++ misc/e-calendar.c	28 Oct 2004 03:52:59 -0000
@@ -42,6 +42,7 @@
 #include <gtk/gtksignal.h>
 #include <libgnomecanvas/gnome-canvas-widget.h>
 #include <gal/util/e-util.h>
+#include <libgnome/gnome-i18n.h>
 
 #define E_CALENDAR_SMALL_FONT_PTSIZE 6
 
@@ -140,6 +141,7 @@
 	GnomeCanvasGroup *canvas_group;
 	PangoFontDescription *small_font_desc;
 	GtkWidget *button, *pixmap;
+	AtkObject *a11y;
 
 	/* Create the small font. */
 
@@ -179,6 +181,9 @@
 						gnome_canvas_widget_get_type (),
 						"widget", button,
 						NULL);
+	a11y = gtk_widget_get_accessible (button);
+	if (a11y != NULL)
+		atk_object_set_name (a11y, _("Previous Button"));
 
 	button = gtk_button_new ();
 	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
@@ -201,6 +206,9 @@
 						gnome_canvas_widget_get_type (),
 						"widget", button,
 						NULL);
+	a11y = gtk_widget_get_accessible (button);
+	if (a11y != NULL)
+		atk_object_set_name (a11y, _("Previous Button"));
 
 	cal->min_rows = 1;
 	cal->min_cols = 1;
@@ -221,8 +229,12 @@
 e_calendar_new			(void)
 {
 	GtkWidget *cal;
+	AtkObject *a11y;
 
 	cal = gtk_type_new (e_calendar_get_type ());
+	a11y = gtk_widget_get_accessible (cal);
+	if (a11y != NULL)
+		atk_object_set_name (a11y, _("Month Calendar"));
 
 	return cal;
 }
Index: misc/e-dateedit.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-dateedit.c,v
retrieving revision 1.40
diff -u -r1.40 e-dateedit.c
--- misc/e-dateedit.c	12 Mar 2004 08:44:23 -0000	1.40
+++ misc/e-dateedit.c	28 Oct 2004 03:53:03 -0000
@@ -55,6 +55,8 @@
 #include <gtk/gtkwindow.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkvbox.h>
+#include <atk/atkrelation.h>
+#include <atk/atkrelationset.h>
 #include <libgnome/gnome-i18n.h>
 #include <gal/util/e-util.h>
 #include "e-util/e-time-utils.h"
@@ -304,8 +306,12 @@
 e_date_edit_new			(void)
 {
 	EDateEdit *dedit;
+	AtkObject *a11y;
 
 	dedit = g_object_new (E_TYPE_DATE_EDIT, NULL);
+	a11y = gtk_widget_get_accessible (GTK_WIDGET (dedit));
+	if (a11y != NULL)
+		atk_object_set_name (a11y, _("Date and Time Entry"));
 
 	return GTK_WIDGET (dedit);
 }
@@ -318,10 +324,16 @@
 	ECalendar *calendar;
 	GtkWidget *frame, *arrow;
 	GtkWidget *vbox, *bbox;
+	AtkObject *a11y;
 
 	priv = dedit->priv;
 
 	priv->date_entry  = gtk_entry_new ();
+	a11y = gtk_widget_get_accessible (priv->date_entry);
+	if (a11y != NULL) {
+		atk_object_set_description (a11y, _("Text entry to input date"));
+		atk_object_set_name (a11y, _("Text Date Entry"));
+	}
 	gtk_box_pack_start (GTK_BOX (dedit), priv->date_entry, FALSE, TRUE, 0);
 	
 	g_signal_connect (priv->date_entry, "key_press_event",
@@ -337,6 +349,11 @@
 			  G_CALLBACK (on_date_button_clicked), dedit);
 	gtk_box_pack_start (GTK_BOX (dedit), priv->date_button,
 			    FALSE, FALSE, 0);
+	a11y = gtk_widget_get_accessible (priv->date_button);
+	if (a11y != NULL) {
+		atk_object_set_description (a11y, _("Click this button to show a calendar"));
+		atk_object_set_name (a11y, _("Date Button"));
+	}
 
 	arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
 	gtk_container_add (GTK_CONTAINER (priv->date_button), arrow);
@@ -355,6 +372,11 @@
 	priv->time_combo = gtk_combo_new ();
 	gtk_box_pack_start (GTK_BOX (dedit), priv->time_combo, FALSE, TRUE, 0);
 	rebuild_time_popup (dedit);
+	a11y = gtk_widget_get_accessible (priv->time_combo);
+	if (a11y != NULL) {
+		atk_object_set_description (a11y, _("Combo box to select time"));
+		atk_object_set_name (a11y, _("Time Combo Box"));
+	}
 
 	g_signal_connect (GTK_COMBO (priv->time_combo)->entry,
 			  "key_press_event",
@@ -1185,6 +1207,7 @@
 			   | GDK_BUTTON_RELEASE_MASK
 			   | GDK_POINTER_MOTION_MASK),
 			  NULL, NULL, GDK_CURRENT_TIME);
+	gdk_keyboard_grab (priv->cal_popup->window, TRUE, GDK_CURRENT_TIME);
 	gdk_window_focus (priv->cal_popup->window, GDK_CURRENT_TIME);
 }
 
@@ -1364,6 +1387,7 @@
 	gtk_widget_hide (dedit->priv->cal_popup);
 	gtk_grab_remove (dedit->priv->cal_popup);
 	gdk_pointer_ungrab (GDK_CURRENT_TIME);
+	gdk_keyboard_ungrab (GDK_CURRENT_TIME);
 }
 
 
@@ -1580,6 +1604,48 @@
 	return FALSE;
 }
 
+static void
+add_relation (EDateEdit *dedit, GtkWidget *widget)
+{
+	AtkObject *a11yEdit, *a11yWidget;
+
+	/* add a labelled_by relation for widget for accessibility */
+
+	a11yEdit = gtk_widget_get_accessible (GTK_WIDGET (dedit));
+	a11yWidget = gtk_widget_get_accessible (widget);
+
+	if (a11yEdit != NULL && a11yWidget!= NULL) {
+		AtkRelationSet *set;
+		AtkRelation *relation;
+		GPtrArray *target;
+		gpointer target_object;
+
+		set = atk_object_ref_relation_set (a11yWidget);
+		if (set != NULL) {
+			relation = atk_relation_set_get_relation_by_type (set,
+					ATK_RELATION_LABELLED_BY);
+			/* check whether has a labelled_by relation already */
+			if (relation != NULL)
+				return;
+		}
+
+		set = atk_object_ref_relation_set (a11yEdit);
+		if (!set)
+			return;
+
+		relation = atk_relation_set_get_relation_by_type (set,
+				ATK_RELATION_LABELLED_BY);
+		if (relation != NULL) {
+			target = atk_relation_get_target (relation);
+			target_object = g_ptr_array_index (target, 0);
+			if (ATK_IS_OBJECT (target_object)) {
+				atk_object_add_relationship (a11yWidget,
+						ATK_RELATION_LABELLED_BY,
+						ATK_OBJECT (target_object));
+			}
+		}
+	}
+}
 
 /* This sets the text in the date entry according to the current settings. */
 static void
@@ -1604,6 +1670,8 @@
 		e_utf8_strftime (buffer, sizeof (buffer), _("%m/%d/%Y"), &tmp_tm);
 		gtk_entry_set_text (GTK_ENTRY (priv->date_entry), buffer);
 	}
+
+	add_relation (dedit, priv->date_entry);
 }
 
 
@@ -1642,6 +1710,8 @@
 		gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->time_combo)->entry),
 				    buffer);
 	}
+
+	add_relation (dedit, priv->time_combo);
 }
 
 
Index: misc/e-map.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-map.c,v
retrieving revision 1.6
diff -u -r1.6 e-map.c
--- misc/e-map.c	25 Feb 2003 15:39:47 -0000	1.6
+++ misc/e-map.c	28 Oct 2004 03:53:06 -0000
@@ -27,6 +27,7 @@
 #include <gtk/gtksignal.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libart_lgpl/art_filterlevel.h>
+#include <libgnome/gnome-i18n.h>
 
 #include "e-map.h"
 
@@ -639,8 +640,14 @@
 e_map_new ()
 {
 	GtkWidget *widget;
+	AtkObject *a11y;
 
 	widget = GTK_WIDGET (gtk_type_new (TYPE_E_MAP));
+	a11y = gtk_widget_get_accessible (widget);
+	if (a11y != NULL) {
+		atk_object_set_name (a11y, _("World Map"));
+		atk_object_set_role (a11y, ATK_ROLE_IMAGE);
+		atk_object_set_description (a11y, _("Mouse-based interactive map widget for selecting timezone. Keyboard users should select the timezone from the below combo box instead."));
 	return (E_MAP (widget));
 }
 
Index: misc/e-multi-config-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-multi-config-dialog.c,v
retrieving revision 1.30
diff -u -r1.30 e-multi-config-dialog.c
--- misc/e-multi-config-dialog.c	13 Sep 2004 16:24:32 -0000	1.30
+++ misc/e-multi-config-dialog.c	28 Oct 2004 03:53:07 -0000
@@ -395,6 +395,8 @@
 				EConfigPage *page_widget)
 {
 	EMultiConfigDialogPrivate *priv;
+	AtkObject *a11y;
+	gint page_no;
 
 	g_return_if_fail (E_IS_MULTI_CONFIG_DIALOG (dialog));
 	g_return_if_fail (title != NULL);
@@ -411,10 +413,19 @@
 		fill_in_pixbufs (dialog, e_table_model_row_count (priv->list_e_table_model) - 1);
 	}
 
-	gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
+	page_no = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
 				  create_page_container (description, GTK_WIDGET (page_widget)),
 				  NULL);
 
+	a11y = gtk_widget_get_accessible (GTK_WIDGET(priv->notebook));
+	if (a11y != NULL) {
+		AtkObject *a11yPage = atk_object_ref_accessible_child (a11y, page_no);
+		if (a11yPage != NULL) {
+			if (atk_object_get_role (a11yPage) == ATK_ROLE_PAGE_TAB)
+				atk_object_set_name (a11yPage, title);
+			g_object_unref (a11yPage);
+		}
+	}
 	if (priv->pages->next == NULL) {
 		ETable *table;
 


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