Re: GtkColorButton.get_rgba



Norman,

Thanks for confirming the issue. I upgraded to Ubuntu 13.04, and it has
version 3.6.3.1. So, there is also this "micro"-sub-sub-version ".1" at
the end. I do not believe that this may actually indicate some
significant changes in API, but it might indicate specific version of
U13.04, and that would mean any unexpected half-way through changes
specific to Ubuntu. (Can anyone from the team clarify that?)

Given all this, I think I want some code that would work regardless of
the version. Could you please check if the following code would work in
all pre- and post- 3.8 versions of Gnome-Shell?

// Since 3.8 (or 3.6.3.1?) Gtk.ColorButton.get_rgba() has changed
// from changing RGBA value by reference to returning new RGBA value
rgba36 = new Gdk.RGBA();
rgba = gtkColorButton.get_rgba(rgba36);
if (!(rgba instanceof Gdk.RGBA)) rgba = rgba36;

It seems to me this should work in all versions, but I want to be sure.
And I do not have so many different versions of GS to test as you do. :)
Amy: maybe you could also try somehow this code on U12.10?

If this does not work for some reason, maybe something similar with try
... catch would.

Thanks,
Vadim.



On 05/17/2013 03:49 PM, Norman L. Smith wrote:
Hello Vadim:

Your issue caught my attention because I recently updated an extension from 3.6 to 3.8.  I ran into the 
problem you described of the need to change from:

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

to:

[2]
let rgba = gtkColorButton.get_rgba();

I have a Fedora 18 system on GS3.6.3.  It requires the code in [1] above.  This is __different__ from what 
you described.

I have a Fedora 19 Alpha, openSuse 12.3 and a current Arch system with GS3.8.  All three require the code 
in [2] above.

I looked at git.gnome.org.  It looks like there were changes in the introspection annotations concerning 
gtk_color_button_get_rgba.

The following log entry caught my attention.

2012-09-17  Do not introspect gtk_color_button_get_rgba.

With all this said.  I don't think a change at the point level of a Gnome Shell version should break an 
API.  I also find it
is very odd that the API was broken when the shell went to 3.6.3 for you and not for me with Fedora 18.

This seems like you have a typelib for gtk3 different from my typelib or perhaps a different gjs.  I have 
gjs-1.34.0 on the Fedora 18 system.  In the git tree 1.34 is for 3.6 and 1.36.1 is for 3.8 if I read the 
comments correctly.

Hopefully someone who knows more than me about introspection black magic can give an answer.

Regards,
Norman


On Fri, 2013-05-17 at 10:23 -0500, Vadim wrote:
And just as a follow-up question related to the one below.

If, say, I want to see how the implementation of GtkColorButton in Gjs in Gnome 3.6.3 changed compared to 
3.6.0, is there any resource I can easily browse the relevant source code for both versions?

Thank you.
Vadim.


On 05/17/2013 09:42 AM, Vadim wrote:

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.

_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list



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