From: Dan Winship <[email protected]> > On 08/12/2010 01:56 PM, Piñeiro wrote: >> After thinking a little about it, I realize that this .get_name that >> is being called is atk_action_get_name [2], as this class implements >> AtkAction interface. > >> Although I tried some (random) ways to call atk_object_get_name on >> this object, I was not able to do that. >> >> Any idea or hint? > > hm... try Atk.Object.prototype.get_name.call(atk_label) ?
Just tested. Doesn't work. It says that call is not defined. 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, after all it is a proxy: >>> atk_label = label.get_accessible () r (2) = [object instance proxy GIName:Atk.GObjectAccessible js...@0xxxxxxx nat...@0xxxxxxxx] There is any way to call this method using the real AtkObject instance? Anyway, although we get that, that doesn't seems a really clean way to call this method, and not really general. Although enough if we don't find too many cases (see below, last paragraph). > 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. No, AtkAction is not overriding AtkObjectClass->get_name. CallyActor class is an AtkObjectClass that implements AtkAction (so implementing AtkAction->get_name). StallyLabel [1] is overriding AtkObject->get_name. But AtkAction->get_name is not overriding AtkObject->get_name. Because if not, this problem would also arise in the "C World" calling atk_object_get_name, not just using javascript. And also, take into account that the signature is different. atk_object_get_name just receives the instance. atk_action_get_name receives the instance and a gint, as it returns the name of the nth action of this atkobject. > Does this work usefully in other language bindings? I think this is just > considered bad class design, and the answer is "don't do that then"... You mean trying Atk with python, for example? I haven't tested it. Also, you mean that AtkAction shouldn't have a method ->get_name because AtkObject has already a method called in the same way? Well, after thinking a little about it, and comparing it with other languages, probably it is true, although just in the automatic bindings world. I mean that this wasn't a problem at all until now. Probably this atk_action_get_name can be called atk_action_get_action_name, as it is requesting the name of a specific action. But it sound redundant when you are just using C. Finally, take into account that I was working without problem with Atk until I found this problem, so not sure how many methods are affected. Probably I should require to check if there are other methods in the different interfaces with this problem. Thanks for your hints. BR [1] https://bugzilla.gnome.org/show_bug.cgi?id=626658 === API ([email protected]) _______________________________________________ gnome-shell-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-shell-list
