Re: GailTreeView Changes Proposal


I just had a long conversation with Marc Mulcahy and wanted to share
the discussion.

There may be a bit of a problem with the way that the "ref_at" function
in GailTreeView works.  Currently these lines of code exist:

  renderer = gtk_tree_view_column_get_cell_renderer(tv_col);

    default_registry = atk_get_default_registry ();
    factory = atk_registry_get_factory (default_registry,
                                        GTK_OBJECT_TYPE (renderer));
    cell = atk_object_factory_create_accessible (factory,
                                                 G_OBJECT (renderer));

    gail_cell_init (GAIL_CELL (cell), GTK_WIDGET (view), row, column);

The "atk_registry_get_factory" function is taking a "renderer" as its
second object so it is building the gail type for the cell based upon
the renderer type used by the specific GtkTreeViewColumn.  In this
example, if it notices that the type is GtkCellRendererText, then it
builds a GailTreeViewTextCell.

This is perhaps a problem because it assumes that the various
GtkCellRenderers are *only* used by GtkTreeView.  Currently GtkTreeView
is the only one making use of the various renderers.  I have just sent an
email to Jonathan Blandford (the author of GtkTreeView) to see if this
is a safe assumption, but I am guessing he'll tell me that it is 
valid to use the various GtkCellRenderers in other/custom Gtk objects.

It seems that we want an "atk_registry_get_factory()" function that
could build the factory based upon the renderer type *and* the fact
that the renderer is used in a GtkTreeView.  Unfortunately the
renderer itself doesn't store this information.

One idea is to change the call to look like this:

    factory = atk_registry_get_factory (default_registry,
                                        GTK_OBJECT_TYPE (tv_col));

so that the factory is based upon the GtkTreeViewColumn object, and
then the factory is responsible for digging into the GtkTreeViewColumn
and figuring out which renderer it is using and then builds the
appropriate Gail object based upon the renderer used by the column.

However this idea is also a little broken because GtkCellRenderer is
an interface that can be extended by anyone.  So if we took this 
approach, I am not sure how the factory would be able to handle 
any renderers aside from the default ones.



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