After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 454653 - GtkBuilder accessibility support
GtkBuilder accessibility support
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkBuilder
2.11.x
Other Linux
: Normal enhancement
: ---
Assigned To: GtkBuilder maintainers
GtkBuilder maintainers
: 455127 (view as bug list)
Depends on:
Blocks: 454642
 
 
Reported: 2007-07-07 20:12 UTC by Johan (not receiving bugmail) Dahlin
Modified: 2008-01-25 16:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.49 KB, patch)
2007-07-08 02:43 UTC, Johan (not receiving bugmail) Dahlin
committed Details | Review
patch, work in progress (18.45 KB, patch)
2007-11-24 19:15 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review
new patch (21.38 KB, patch)
2008-01-24 17:10 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review
v3: tested, with documentation (26.31 KB, patch)
2008-01-24 21:01 UTC, Johan (not receiving bugmail) Dahlin
accepted-commit_now Details | Review

Description Johan (not receiving bugmail) Dahlin 2007-07-07 20:12:56 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
Comment 1 Matthias Clasen 2007-07-08 00:40:16 UTC
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.
Comment 2 Matthias Clasen 2007-07-08 00:43:15 UTC
What is the plan for this, have <accessibility> by parsed as a custom tag
by GtkWidget ? 
Comment 3 Johan (not receiving bugmail) Dahlin 2007-07-08 01:43:40 UTC
(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.
Comment 4 Johan (not receiving bugmail) Dahlin 2007-07-08 02:43:09 UTC
Created attachment 91396 [details] [review]
patch

Adds accessibility and ignore everything under it.
Also adds a tests and updated the converter script
Comment 5 Matthias Clasen 2007-07-08 02:51:53 UTC
Might make sense to add a 

g_warning ("<accessibility> is being ignored,\n"
           "see http://bugzilla.gnome.org/show_bug.cgi?id=454653\n");
Comment 6 Johan (not receiving bugmail) Dahlin 2007-07-08 03:22:46 UTC
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
Comment 7 Matthias Clasen 2007-07-08 03:30:26 UTC
Should probably keep this open to fix the "don't do anything yet." part
Comment 8 Johan (not receiving bugmail) Dahlin 2007-07-09 11:55:49 UTC
*** Bug 455127 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2007-09-09 02:10:05 UTC
Move off the 2.12 milestone
Comment 10 Johan (not receiving bugmail) Dahlin 2007-10-25 23:01:06 UTC
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.
Comment 11 Matthias Clasen 2007-11-24 17:58:16 UTC
Johan, any update on this ?
Comment 12 Johan (not receiving bugmail) Dahlin 2007-11-24 19:15:46 UTC
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.
Comment 13 Matthias Clasen 2007-11-25 01:33:18 UTC
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
Comment 14 Matthias Clasen 2007-11-25 03:52:28 UTC
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.
Comment 15 Johan (not receiving bugmail) Dahlin 2008-01-24 17:10:40 UTC
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.
Comment 16 Johan (not receiving bugmail) Dahlin 2008-01-24 21:01:59 UTC
Created attachment 103677 [details] [review]
v3: tested, with documentation
Comment 17 Matthias Clasen 2008-01-25 06:54:58 UTC
Looks good to me, thanks.
Comment 18 Johan (not receiving bugmail) Dahlin 2008-01-25 16:19:26 UTC
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.