# NameError: undefined method \`color\_selection' for class \`Gtk::ColorSelectionDialog'

**URL:** <https://www.ruby-forum.com/t/nameerror-undefined-method-color-selection-for-class-gtk-colorselectiondialog/216466>\
**Category:** Ruby-Gnome 2\
**Created:** [February 5, 2012, 7:39pm UTC](https://www.ruby-forum.com/t/nameerror-undefined-method-color-selection-for-class-gtk-colorselectiondialog/216466 "2012-02-05T19:39:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 5, 2012, 7:39pm UTC](https://www.ruby-forum.com/t/nameerror-undefined-method-color-selection-for-class-gtk-colorselectiondialog/216466/1 "2012-02-05T19:39:54Z")

</div>

After getting past my last issue, I can compile gtk2 just fine But  
when I do a require ‘gtk2’, I get an error.

Here’s a quick example of the error from just doing the require by  
itself in irb.

irb(main):001:0\> require ‘gtk2’  
NameError: undefined method `color_selection' for class`Gtk::ColorSelectionDialog’  
from  
/mytest/ruby/lib/ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require' from /mytest/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require’  
from /mytest/ruby/lib/ruby/site\_ruby/1.9.1/gtk2/base.rb:25:in  
`rescue in <top (required)>' from /mytest/ruby/lib/ruby/site_ruby/1.9.1/gtk2/base.rb:21:in`\<top (required)\>’  
from  
/mytest/ruby/lib/ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require' from /mytest/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require’  
from /mytest/ruby/lib/ruby/site\_ruby/1.9.1/gtk2.rb:11:in `<top (required)>' from /mytest/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require’  
from  
/mytest/ruby/lib/ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require' from (irb):1 from /mytest/ruby/bin/irb:12:in`’

I’m using a rather basic ruby install to reproduce this.

ruby-1.9.3p0 (built myself)  
pkg-config-1.1.3.gem (from gem)  
cairo-1.10.2.gem (from gem)

I see this with both the ruby-gnome2-1.1.2 release, and the latest  
snapshot(as of Feb 05, 2012) from github

The machine it is running on is RHEL 5.7, which has  
gcc 4.1.2 (Red Hat 4.1.2-51)  
gtk2-2.10.4-21.el5\_5.6  
cairo-1.2.4-5.el5

So I see RG\_DEF\_ALIAS(“colorsel”, “color\_selection”); in  
“rbgtkcolorselectiondialog.c”

Indeed, I don’t see, I’m guessing, a rg\_color\_selection method?

I dug on this for a bit, but got tired. Maybe I’ll get luck and figure  
it out, any ideas?  
Thanks

---

<div class="post-metadata">

**Author:** ![grantspeelman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/da6949/32.png) [@grantspeelman](https://www.ruby-forum.com/u/grantspeelman)\
**Post date:** [February 6, 2012, 1:56pm UTC](https://www.ruby-forum.com/t/nameerror-undefined-method-color-selection-for-class-gtk-colorselectiondialog/216466/2 "2012-02-06T13:56:11Z")

</div>

Hi,

In [CAC6rHiqBY\_Sq2hc4ivvSxcy-EEo7ALwO0Ai1s+MWaX8nxR2=removed\_email\_address@domain.invalid](mailto:CAC6rHiqBY_Sq2hc4ivvSxcy-EEo7ALwO0Ai1s+MWaX8nxR2=removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] NameError: undefined method `color_selection' for class `Gtk::ColorSelectionDialog’” on Sun, 5 Feb 2012 11:39:06  
-0700,  
grant schoep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> `\<top (required)\>’  
> from (irb):1
> 
> I dug on this for a bit, but got tired. Maybe I’ll get luck and figure  
> it out, any ideas?

Thanks for your report.  
Maybe I’ve fixed it in master:  
[[gtk2] fix require failure with GTK+ \< 2.14. · ruby-gnome/ruby-gnome@21224f5 · GitHub](https://github.com/ruby-gnome2/ruby-gnome2/commit/21224f5d8d1673c7373752253c7f5c3d3ecb5baa)

## Thanks,

kou
