Re: GtkColorButton.get_rgba



Norman,

That is good to know, thanks for testing and updating. I am personally
on Ubuntu 13.04, and my get_rgba fix works fine here as well. I am going
to update the extension with it to make the code safer for different
typelib versions.

Vadim.



On 05/20/2013 12:54 PM, Norman L. Smith wrote:
Hello, Vadim

I tested your get_rgba fix on the following:

Fedora 18 GS 3.6.3.1
Fedora 19 Alpha GS 3.8.2
openSuse 12.3 GS 3.8.1
Arch Linux GS 3.8.2

The fix works with no errors on all.

I think the Ubuntu folks are creating their typelib for Gtk3 used with
GS 3.6.3.1 from annotated sources that are intended for Gtk3 3.7 and
later.  Since Gtk is only used in the extension system for Gnome Shell
it may not be a big issue.  The typelib in Fedora 18 is definitely from
sources before 3.7 and the typelib in Fedora 19 Alpha is from sources of
Gtk 3.8 and later.

Hope this is helpful.
Norman
 


On Mon, 2013-05-20 at 10:33 -0500, Vadim wrote:
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]