Question

I want to use an alpha value in the color buttons in my app - https://github.com/satya164/elegance-colors

Currently I'm using colorbutton.set_use_alpha (true);, as documented in http://www.valadoc.org/#!api=gtk+-3.0/Gtk.ColorButton

But, while compiling, I get warnings saying,

/home/satya/Workspace/elegance-colors/elegance-colors-prefs.vala.c:4706:2: warning: ‘gtk_color_button_set_use_alpha’ is deprecated (declared at /usr/include/gtk-3.0/gtk/gtkcolorbutton.h:95): Use 'gtk_color_chooser_set_use_alpha' instead [-Wdeprecated-declarations]

The code samples in the valadoc website are outdated and the sample on gnome's website doesn't use alpha. Can anyone help me fix the warning messages?

I'm using GTK 3.8 and Vala 0.20.1.

Was it helpful?

Solution

You can get around the issue by casting to Gtk.ColorChooser and calling set_use_alpha on that:

((Gtk.ColorChooser) colorbutton).set_use_alpha (true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top