Re: Some issues calling atk methods
- From: Dan Winship <danw gnome org>
- To: Piñeiro <apinheiro igalia com>
- Cc: gnome-shell-list gnome org
- Subject: Re: Some issues calling atk methods
- Date: Fri, 13 Aug 2010 13:44:16 -0400
On 08/13/2010 01:04 PM, Piñeiro wrote:
>> hm... try Atk.Object.prototype.get_name.call(atk_label) ?
>
> Just tested. Doesn't work. It says that call is not defined.
ah... because introspection functions aren't JS Function objects...
> Anyway, I
> tested this:
>
> >>> Atk.Object.prototype.get_name (atk_label)
>
> And returns NULL, what it is wrong as the object has a name. Although
> it call the method, it fails in this atk_object_get_name check:
>
> g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
>
> Launching the g_return_val_if_fail warning. So I guess that atk_label
> is not valid as a real AtkObject
no, the atk_label argument is just being ignored: you'll get the same
error if you call "Atk.Object.prototype.get_name()" with no argument.
The problem is that it's passing "Atk.Object.prototype" as the argument
to atk_object_get_name(), and that's a JavaScript internal object, not
an AtkObject instance.
> after all it is a proxy:
>
> >>> atk_label = label.get_accessible ()
> r (2) = [object instance proxy GIName:Atk.GObjectAccessible jsobj 0xXXXXXX native 0xXXXXXXX]
>
> There is any way to call this method using the real AtkObject
> instance?
gjs automatically translates between JS proxies and underlying GObjects
as needed.
>> That assumes AtkLabel isn't overriding AtkObjectClass->get_name... if it
>> is, I don't think there's any way in gjs to refer to AtkLabel's
>> implementation of the method.
>
> Well, sorry, there isn't any AtkLabel class/interface. I guess that
> you are talking about AtkAction.
Oh, no, I meant StallyLabel. If stally_label_get_class() was overriding
atk_object_class->get_name, then there'd be no way to access that method
from gjs. Not that this matters at this point since there isn't even any
way to get the original AtkObject get_name method either.
Probably the easiest solution for now is to just add a C method
"shell_get_accessible_name (AtkObject *obj)" or something, that calls
atk_object_get_name(obj), and then you can use
"Shell.get_accessible_name(atk_label)" from JS.
-- Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]