Re: Some issues calling atk methods II



On Thu, 2010-10-28 at 20:37 +0200, Piñeiro wrote:
> (Not sure if this is the proper list, but detected using gnome-shell,
> sorry for the noise if this is the case).

Well, there is no GJS-list, and it's a problem you are hitting working
on gnome-shell so it's fine to discuss here.

(We don't do a lot of devel discussion on mailing lists - we tend to use
IRC and bugzilla more, but for stuff that works well on a mailing list,
this is the place.)

[...]

> So, my javascript code is something like this:
>    const Atk = imports.gi.Atk;
>    <skip>
>    accessible = label.get_accessible () // label is a StLabel, any ClutterActor would be valid
>    let array = []
>    array [0] = accessible;
>    let relation = Atk.Relation.new (array, 1, Atk.RelationType.LABELLED_BY);

(As Joseph points out this should be 'new Atk.Relation')

> But doing that I get this exception:
> 
> ("Unhandled array element type 16")@gjs_throw:0
> 
> I have checked Atk-1.0.gir, and it seems correct (I can paste the
> method data if required).
> 
> I'm doing something wrong? Suggestions?

Nothing you are doing wrong - GJS just doesn't support arrays of objects
(16 is the "INTERFACE" type which means "pointer to a
boxed/structure/object". Your options at this point:

 * File a bug against GJS and wait
 * Add the capability to GJS yourself
   (gjs/gi/argc.:gjs_array_to_intarray() is the version for arrays of
   integers that you would need to extend and add something similar
   for arrays of objects)
 * Add a wrapper function to gnome-shell/src/shell-global.c that takes a
   GList of objects rather than an array of objects and use that from
   your code.

   (The function would just convert the list to an array and call the
   ATK function.)

The last is certainly the fastest way to get to the end result. (If you
do that, please also file the bug against GJS if there isn't already one
there.)

- Owen




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