[evolution-patches] patch about gtkhtml, fix #70088



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.12
diff -u -p -r1.12 ChangeLog
--- ChangeLog	1 Nov 2004 09:41:59 -0000	1.12
+++ ChangeLog	14 Dec 2004 06:48:55 -0000
@@ -1,3 +1,11 @@
+2004-12-14  Mengjie Yu  <meng-jie yu sun com>
+
+	* object.c: (get_n_actions), (get_description), (action_get_name),
+	(do_action), (atk_action_interface_init), (gtk_html_a11y_get_type),
+	(gtk_html_a11y_get_name), (gtk_html_a11y_class_init),
+	(gtk_html_a11y_new):
+	fix #70088 make ui grab work by add a grab focus action interface.
+
 2004-11-01  Radek Doulik  <rodo ximian com>
 
 	* Makefile.am (AM_CFLAGS): use AM_FLAGS instead of CFLAGS
Index: object.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/object.c,v
retrieving revision 1.5
diff -u -p -r1.5 object.c
--- object.c	26 May 2004 02:26:17 -0000	1.5
+++ object.c	14 Dec 2004 06:48:55 -0000
@@ -29,12 +29,80 @@
 #include "paragraph.h"
 #include "utils.h"
 #include "text.h"
+#include <glib/gi18n.h>
 
 static void gtk_html_a11y_class_init (GtkHTMLA11YClass *klass);
 static void gtk_html_a11y_init       (GtkHTMLA11Y *a11y);
 
 static GtkAccessibleClass *parent_class = NULL;
 
+
+static gint
+get_n_actions (AtkAction *action)
+{
+	return 1;
+}
+
+static G_CONST_RETURN gchar*
+get_description (AtkAction *action, gint i)
+{
+	if (i == 0)
+		return _("grab focus");
+
+	return NULL;
+}
+
+static G_CONST_RETURN gchar*
+action_get_name (AtkAction *action, gint i)
+{
+	if (i == 0)
+		return _("grab focus");
+
+	return NULL;
+}
+
+
+
+static gboolean
+do_action (AtkAction * action, gint i)
+{
+	GtkWidget *widget;
+	gboolean return_value = TRUE;
+
+	widget = GTK_ACCESSIBLE (action)->widget;
+
+	if (widget == NULL) {
+	/*
+	* State is defunct
+	*/
+	return FALSE;
+	}
+
+	if (!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
+		return FALSE;
+
+
+	switch (i) {
+	case 0:
+		gtk_widget_grab_focus (widget);
+	default:
+		return_value = FALSE;
+		break;
+	}
+	return return_value;
+}
+
+static void
+atk_action_interface_init (AtkActionIface *iface)
+{
+	g_return_if_fail (iface != NULL);
+
+	iface->do_action = do_action;
+	iface->get_n_actions = get_n_actions;
+	iface->get_description = get_description;
+	iface->get_name = action_get_name;
+}
+
 GType
 gtk_html_a11y_get_type (void)
 {
@@ -54,6 +122,12 @@ gtk_html_a11y_get_type (void)
 			NULL                                             /* value table */
 		};
 
+		static const GInterfaceInfo atk_action_info = {
+			(GInterfaceInitFunc) atk_action_interface_init,
+			(GInterfaceFinalizeFunc) NULL,
+			NULL
+		};
+
 		/*
 		 * Figure out the size of the class and instance 
 		 * we are deriving from
@@ -69,6 +143,8 @@ gtk_html_a11y_get_type (void)
 		tinfo.instance_size = query.instance_size;
 
 		type = g_type_register_static (derived_atk_type, "GtkHTMLA11Y", &tinfo, 0);
+
+		g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info);
 	}
 
 	return type;
@@ -125,6 +201,16 @@ gtk_html_a11y_ref_child (AtkObject *acce
 	return accessible_child;
 }
 
+static G_CONST_RETURN gchar*
+gtk_html_a11y_get_name (AtkObject *obj)
+{
+	G_CONST_RETURN gchar *name;
+	if (obj->name != NULL) {
+		return obj->name;
+	}
+	return _("HTML Container");
+}
+
 static void
 gtk_html_a11y_class_init (GtkHTMLA11YClass *klass)
 {
@@ -136,6 +222,7 @@ gtk_html_a11y_class_init (GtkHTMLA11YCla
 	atk_class->initialize = gtk_html_a11y_initialize;
 	atk_class->get_n_children = gtk_html_a11y_get_n_children;
 	atk_class->ref_child = gtk_html_a11y_ref_child;
+	atk_class->get_name = gtk_html_a11y_get_name;
 
 	gobject_class->finalize = gtk_html_a11y_finalize;
 }
@@ -214,7 +301,7 @@ gtk_html_a11y_new (GtkWidget *widget)
 	accessible = ATK_OBJECT (object);
 	atk_object_initialize (accessible, widget);
 
-	accessible->role = ATK_ROLE_HTML_CONTAINER;
+	accessible->role = ATK_ROLE_PANEL;
 	g_signal_connect_after(widget, "grab_focus", 
 			G_CALLBACK (gtk_html_a11y_grab_focus_cb),
 			NULL);


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