[evolution-patches] A gal e-text a11y patch



Hi,

Here is a gal patch which fixes some e-text a11y bugs.
Please help me to review it.

Thanks,
Li
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.900
diff -u -r1.900 ChangeLog
--- ChangeLog	10 Oct 2004 21:12:05 -0000	1.900
+++ ChangeLog	11 Nov 2004 04:20:33 -0000
@@ -1,3 +1,11 @@
+2004-11-11  Li Yuan  <li yuan sun com>
+
+	* gal/a11y/e-text/gal-a11y-e-text.c: 
+	(et_ref_state_set), (et_class_init):
+	Made etext grabbable.
+	(_et_changed_cb), (et_real_initialize):
+	Handle the model changed issue.
+
 2004-10-10  Malcolm Tredinnick <malcolm commsecure com au>
 
 	* configure.in: Remove redundant call to AC_PROG_INTLTOOL and
Index: gal/a11y/e-text/gal-a11y-e-text.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-text/gal-a11y-e-text.c,v
retrieving revision 1.7
diff -u -r1.7 gal-a11y-e-text.c
--- gal/a11y/e-text/gal-a11y-e-text.c	10 Jun 2004 17:00:57 -0000	1.7
+++ gal/a11y/e-text/gal-a11y-e-text.c	11 Nov 2004 04:20:56 -0000
@@ -30,9 +30,41 @@
 #define PARENT_TYPE (parent_type)
 
 struct _GalA11yETextPrivate {
-	int dummy;
+	AtkStateSet *state_set;
+	ETextModel *model;
 };
 
+static AtkStateSet *
+et_ref_state_set (AtkObject *accessible)
+{
+	GObject *g_obj;
+	GalA11yETextPrivate *priv = GET_PRIVATE (accessible);
+	EText *etext;
+
+	GET_PRIVATE (accessible)->state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
+	g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible));
+
+	if (!g_obj)
+		return GET_PRIVATE (accessible)->state_set;
+
+	etext = E_TEXT (g_obj);
+	if (etext->editable)
+		atk_state_set_add_state (GET_PRIVATE(accessible)->state_set,
+				ATK_STATE_EDITABLE);
+	if (etext->max_lines == 1)
+		atk_state_set_add_state (GET_PRIVATE(accessible)->state_set,
+				ATK_STATE_SINGLE_LINE);
+	else
+		atk_state_set_add_state (GET_PRIVATE(accessible)->state_set,
+				ATK_STATE_MULTI_LINE);
+	atk_state_set_add_state (GET_PRIVATE(accessible)->state_set, ATK_STATE_SENSITIVE);
+	atk_state_set_add_state (GET_PRIVATE(accessible)->state_set, ATK_STATE_SHOWING);
+
+	g_object_ref(priv->state_set);
+
+	return priv->state_set;
+}
+
 static void
 et_dispose (GObject *object)
 {
@@ -1013,6 +1045,25 @@
 }
 
 static void
+_et_changed_cb (EText *etext,
+		gpointer user_data)
+{
+	AtkObject *accessible;
+	AtkText *text;
+
+	accessible = ATK_OBJECT (user_data);
+	text = ATK_TEXT (accessible);
+
+	if (GET_PRIVATE(accessible)->model != etext->model) {
+		/* text model changed */
+		GET_PRIVATE(accessible)->model = etext->model;
+
+		g_signal_connect (etext->model, "reposition",
+				G_CALLBACK (_et_reposition_cb), text);
+	}
+}
+
+static void
 et_real_initialize (AtkObject *obj,
                     gpointer  data)
 {
@@ -1033,8 +1084,13 @@
 
 	g_signal_connect_after (etext->tep, "command",
 		(GCallback) _et_command_cb, obj);
-                                                                              
+
+	g_signal_connect (etext, "changed",
+			G_CALLBACK (_et_changed_cb), obj);
+
 	obj->role = ATK_ROLE_TEXT;
+
+	GET_PRIVATE(a11y)->model = etext->model;
 }
 
 static void
@@ -1047,6 +1103,7 @@
 	parent_class                          = g_type_class_ref (PARENT_TYPE);
 	component_parent_iface                = g_type_interface_peek(parent_class, ATK_TYPE_COMPONENT);
 	object_class->dispose                 = et_dispose;
+	atk_class->ref_state_set              = et_ref_state_set;
 	atk_class->initialize                 = et_real_initialize;
 }
 



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