GNOME Bugzilla – Bug 454653
GtkBuilder accessibility support
Last modified: 2008-01-25 16:19:26 UTC
libglade supports accessibility in a way GtkBuilder currently does. There are a couple of ways to fix this before 2.12 1) Parse and implement it, perhaps too risky at this point 2) Parse it, but ignore it. Make the converter script convert, but warn that it's currently not supported 3) Make the converter script comment it out. Fix the converter script in the future to remove these comments. It's probably too late to 1. And 3 is not a very good solution since some UI builders do not preserve comments. This needs to be documented and explained in the libglade migration part of the reference manual
Hmm, this is an unfortunate omission. We should probably do 2) and work on a patch for landing GtkBuilder a11y support in 2.12.1.
What is the plan for this, have <accessibility> by parsed as a custom tag by GtkWidget ?
(In reply to comment #2) > What is the plan for this, have <accessibility> by parsed as a custom tag > by GtkWidget ? > Yes, that what I have in mind. Since the accessibility parts are tied to widgets anyway.
Created attachment 91396 [details] [review] patch Adds accessibility and ignore everything under it. Also adds a tests and updated the converter script
Might make sense to add a g_warning ("<accessibility> is being ignored,\n" "see http://bugzilla.gnome.org/show_bug.cgi?id=454653\n");
2007-07-08 Johan Dahlin <jdahlin@async.com.br> * gtk/gtkwidget.c (gtk_widget_buildable_custom_tag_start): Parse <accessibility> but don't do anything yet. * gtk/gtk-builder-convert (GtkBuilderConverter._parse): Do not strip atk/accessibility tags * tests/buildertest.c (test_widget): Test this
Should probably keep this open to fix the "don't do anything yet." part
*** Bug 455127 has been marked as a duplicate of this bug. ***
Move off the 2.12 milestone
I'm working on this, I'll probably have a patch in a couple of days. It might not make it into 2.12 though, since I'd like to implement GtkBuildable on AtkObject.
Johan, any update on this ?
Created attachment 99583 [details] [review] patch, work in progress Work in progress. This has relation and actions working pretty much the same ways as libglade. However when adding support for properties I noticed it would make a lot more sense to reuse the normal <property> tags. This patch supports properties by using an internal-child child, I didn't write update the migration script to handle this yet, but it should be quite easy. Having the properties, actions and relations on the same object would be best, but that would require GtkBuildable to be implemented on AtkObject. So, we have a couple of options to solve this: 1) Use the patch above, <atkaction>,<atkrelation> lives on widget, <property> on AtkObject. Write a migration script. 2) Implement GtkBuildable on AtkObject and implement the custom tags here. That means that Gtk+ has to implement an interface on a foreign class in runtime. This is problematic for c++, since all the interfaces supported must be known at compile time, if I understood Murray correctly. 3) Re-implement property on widget, all custom tags are on the same object. This will duplicate a fair amount of code in the gtkbuilderparser.
I had a quick look at gail, and it seems that all accessible implementations derive from GtkAccessible, which lives inside gtk, so that would be one place where you could implement GtkBuilable
But I don't think the approach in the patch is a disaster either. + target = gtk_builder_get_object (builder, relation->target); + target_accessible = gtk_widget_get_accessible (GTK_WIDGET (target)); + relation_type = atk_relation_type_for_name (relation->type); + atk_relation_set_add_relation_by_type (relation_set, relation_type, + target_accessible); This should probably handle the case that there is no object with the target name.
Created attachment 103647 [details] [review] new patch Here is a new patch which parses a couple of files a found (Jokosher.glade and test.glade from pygtk documentation). I haven't tested them with a11y enabled, so I am not sure if they work as expected. Documentation is also missing.
Created attachment 103677 [details] [review] v3: tested, with documentation
Looks good to me, thanks.
2008-01-25 Johan Dahlin <johan@gnome.org> * gtk/gtkwidget.c: (gtk_widget_buildable_interface_init), (gtk_widget_buildable_get_internal_child), (free_action), (free_relation), (gtk_widget_buildable_parser_finished), (accessibility_start_element), (gtk_widget_buildable_custom_tag_start), (gtk_widget_buildable_custom_finished): Implement accessible support, fixes #454653. * gtk/gtk-builder-convert: Add support for migrating old glade files * tests/buildertest.c: (test_widget), (test_file): Add accessible tests and imprve the test_file function to display toplevels and run dialogs.