[evolution-patches] Re: patch about gtkhtml, fix #70088 (new patch attached)



hi, rodo

I had change the name to "Panel containing HTML".
And here is the new patch. please review it again.

Thanks for your patience.

Yours,
Mengjie Yu



On Tue, 2004-12-14 at 10:11, Radek Doulik wrote:
> Hi Mengjie,
> 
> thanks a lot for your patch. The only thing I am not sure about is why
> do you change role from HTML_CONTAINER to PANEL. What is the reason
> for this?
> 
> Cheers
> Radek
> 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.13
diff -u -p -r1.13 ChangeLog
--- ChangeLog	15 Dec 2004 09:30:52 -0000	1.13
+++ ChangeLog	15 Dec 2004 10:07:16 -0000
@@ -1,3 +1,10 @@
+2004-12-15  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):
+	fix #70088 make ui grab work by add a grab focus action interface.
+
 2004-12-14  Mengjie Yu  <meng-jie yu sun com>
 
 	* object.c: (gtk_html_a11y_cursor_changed_cb),
Index: object.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/object.c,v
retrieving revision 1.6
diff -u -p -r1.6 object.c
--- object.c	15 Dec 2004 09:30:53 -0000	1.6
+++ object.c	15 Dec 2004 10:07:16 -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 _("Panel containing HTML");
+}
+
 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;
 }
@@ -257,7 +344,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]