Glade & ruby-gnome2

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?

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).

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

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.

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