GtkColorButton.get_rgba



Hello everyone,

I use GtkColorButton in preference dialog of this submitted extension: https://extensions.gnome.org/extension/674/yawl-yet-another-window-list/

I just updated from Gnome 3.6.0 to Gnome 3.6.3 and realized that GtkColorButton does not work as expected anymore.

After digging around I found that these lines of code that worked fine in Gjs in Gnome 3.6.0 do not work in Gnome 3.6.3:

let rgba = new Gdk.RGBA();
gtkColorButton.get_rgba(rgba);

What works in 3.6.3 now is:

let rgba = gtkColorButton.get_rgba();

In the former we pass reference to an already existing variable for the function to modify it, and in the latter the function returns new value. According to DevHelp the first is what you would use in C, and this is why I had that in the code, and it worked. On the other hand, I understand (and saw that all over Gjs) that in Gjs it is common to return a value instead of passing a reference to an existing variable, even if there is already another value being returned. For example, in C Gio::DataInputStream::read_line returns a string and updates its length by reference, while in Gjs it returns an array containing both the string and its length.

I cannot verify at the moment if the new second version of code (the one I need for 3.6.3) will work in 3.6.0. If I knew that the second version would work in all 3.6.*, I would just stick to it. But I only know that the first worked in 3.6.0 but not in 3.6.3, and the second works in 3.6.3.

So, my question is: is there any way to make the code consistent with both versions? Or, maybe, someone could confirm that the second version works in 3.6.0 (Ubuntu 12.10) as well?

Thanks in advance,
Vadim.



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