# Glade & ruby-gnome2

**URL:** <https://www.ruby-forum.com/t/glade-ruby-gnome2/101447>\
**Category:** Ruby\
**Created:** [August 4, 2006, 9:37pm UTC](https://www.ruby-forum.com/t/glade-ruby-gnome2/101447 "2006-08-04T21:37:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![momo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@momo](https://www.ruby-forum.com/u/momo)\
**Post date:** [August 4, 2006, 9:37pm UTC](https://www.ruby-forum.com/t/glade-ruby-gnome2/101447/1 "2006-08-04T21:37:06Z")

</div>

hi all,  
i’m starting with ruby and ruby-gnome2, im trying to develop a simple  
aplication with glade and i generate the ruby file using  
ruby-glade-create-template which is included in my linux distro.

the application works fine, but when i launch it i see this error  
message and i dont know what does it mean and how to fix it.

(eval): line 8  
Gtk-CRITICAL \*\*:gtk\_widget\_grab\_default: assertion  
`GTK\_WIDGET\_CAN\_DEFAULT (widget)’ failed

When a close the application i have this error too:

wikiruby.rb:200:in `on\_quit’: uninitialized constant WikirubyGlade::GTK  
(NameError)

And here my ruby code:

require ‘libglade2’  
require ‘gtkmozembed’  
require ‘lib/redcloth’  
require “rexml/document”  
include REXML

class WikirubyGlade  
include GetText

attr :glade

def initialize(path\_or\_data, root = nil, domain = nil, localedir =  
nil, flag = GladeXML::FILE)  
bindtextdomain(domain, localedir, nil, “UTF-8”)  
@glade = GladeXML.new(path\_or\_data, root, domain, localedir, flag)  
{|handler| method(handler)}

…

if **FILE** == $0

# Set values as your own application.

PROG\_PATH = “wikiruby.glade”  
PROG\_NAME = “wikiruby”  
Gtk.init  
WikirubyGlade.new(PROG\_PATH, nil, PROG\_NAME)  
Gtk.main  
end

Any idea on how to fix this?

---

<div class="post-metadata">

**Author:** ![momo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@momo](https://www.ruby-forum.com/u/momo)\
**Post date:** [August 5, 2006, 3:12pm UTC](https://www.ruby-forum.com/t/glade-ruby-gnome2/101447/2 "2006-08-05T15:12:05Z")

</div>

Hi, from what I can see, the “`GTK\_WIDGET\_CAN\_DEFAULT (widget)’  
failed” part is trying to say that you set “use default” or something  
from Glade on a widget that can’t default, confusing eh?

As for the “uninitialized constant WikirubyGlade::GTK” error, I’m  
guessing that you’re using a Custom widget in Glade to create the  
GtkMozEmbed widget, and made a type in the creation function label  
where it should be Gtk::MozEmbed rather than GTK::MozEmbed (just a  
wild guess).

---

<div class="post-metadata">

**Author:** ![momo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@momo](https://www.ruby-forum.com/u/momo)\
**Post date:** [August 5, 2006, 3:15pm UTC](https://www.ruby-forum.com/t/glade-ruby-gnome2/101447/3 "2006-08-05T15:15:05Z")

</div>

> GtkMozEmbed widget, and made a type in the creation function label  
> Sorry about that, I meant “typo”… how ironic 🙂

---

<div class="post-metadata">

**Author:** ![momo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@momo](https://www.ruby-forum.com/u/momo)\
**Post date:** [August 5, 2006, 3:48pm UTC](https://www.ruby-forum.com/t/glade-ruby-gnome2/101447/4 "2006-08-05T15:48:08Z")

</div>

Matthew H. ha escrito:

> Hi, from what I can see, the “`GTK\_WIDGET\_CAN\_DEFAULT (widget)’  
> failed” part is trying to say that you set “use default” or something  
> from Glade on a widget that can’t default, confusing eh?

You where right, it was a widget with the “use default” option set on.

> As for the “uninitialized constant WikirubyGlade::GTK” error, I’m  
> guessing that you’re using a Custom widget in Glade to create the  
> GtkMozEmbed widget, and made a type in the creation function label  
> where it should be Gtk::MozEmbed rather than GTK::MozEmbed (just a  
> wild guess).

The uninitialized constat could not be fixed with the GTK:MozEmbed  
thing, as it sais the widget is not found and the application does not  
start, so i guess the Gtk::MozEmbed is ok, and it is the only custom  
widget im using at the moment.

---

<div class="post-metadata">

**Author:** ![momo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@momo](https://www.ruby-forum.com/u/momo)\
**Post date:** [August 5, 2006, 7:06pm UTC](https://www.ruby-forum.com/t/glade-ruby-gnome2/101447/5 "2006-08-05T19:06:21Z")

</div>

Ok, i fixed the “uninitialized constant WikirubyGlade::GTK” error, it  
was a typo, i wrote GTK.main\_quit instead of Gtk.main\_quit.
