Ruby Forum Ruby-Gnome 2 > Gtk::Widget.visible?

Posted by Dobai-Pataky Bálint (Guest)
on 18.05.2008 09:18
Attachment: dpblnt.vcf (162 Bytes)
(Received via mailing list)
hi

in current ruby-gtk2 svn is Gtk::Widget.visible? changed? it gives
ArgumentError

irb
irb(main):001:0> require 'gtk2'
=> true
irb(main):002:0> @passwd=Gtk::Entry.new
=> #<Gtk::Entry:0x2aaab12aa338 ptr=0xdd7020>
irb(main):003:0> p @passwd.inspect
"#<Gtk::Entry:0x2aaab12aa338 ptr=0xdd7020>"
=> "#<Gtk::Entry:0x2aaab12aa338 ptr=0xdd7020>"
irb(main):005:0> p @passwd.visible?
ArgumentError: wrong number of arguments(1 for 0)
    from (eval):5:in `initialize'
    from (eval):5:in `new'
    from (eval):5:in `visible?'
    from (irb):5
    from /usr/lib64/ruby/1.9.0/irb.rb:150:in `block (2 levels) in
eval_input'
    from /usr/lib64/ruby/1.9.0/irb.rb:259:in `signal_status'
    from /usr/lib64/ruby/1.9.0/irb.rb:147:in `block in eval_input'
    from /usr/lib64/ruby/1.9.0/irb.rb:146:in `eval_input'
    from /usr/lib64/ruby/1.9.0/irb.rb:70:in `block in start'
    from /usr/lib64/ruby/1.9.0/irb.rb:69:in `catch'
    from /usr/lib64/ruby/1.9.0/irb.rb:69:in `start'
    from /usr/bin/irb:13:in `<main>'
irb(main):006:0>

thanks in advice,
balint
Posted by Kouhei Sutou (Guest)
on 18.05.2008 10:13
(Received via mailing list)
Hi,

In <482FD835.6090001@gmail.com>
  "[ruby-gnome2-devel-en] Gtk::Widget.visible?" on Sun, 18 May 2008 
10:18:13 +0300,
  Dobai-Pataky Bálint <dpblnt@gmail.com> wrote:

> in current ruby-gtk2 svn is Gtk::Widget.visible? changed? it gives 
> ArgumentError

Ruby 1.9 can't use module_eval from C. ([ruby-dev:34093])
We need to more works for ruby 1.9 but I think it will be
done in a release after the next release.

Here is a small workaround:
Index: glib/src/rbgobject.c
===================================================================
--- glib/src/rbgobject.c  (revision 3213)
+++ glib/src/rbgobject.c  (working copy)
@@ -331,8 +331,11 @@
         g_free(buf);
     }

-    if (source->len > 0)
+    if (source->len > 0) {
+        g_string_prepend(source, "self.module_eval do\n");
+        g_string_append(source, "\nend");
         rb_funcall(klass, id_module_eval, 1, rb_str_new2(source->str));
+    }
     g_string_free(source, TRUE);
 }



Thanks,
--
kou
Posted by Dobai-Pataky Bálint (Guest)
on 18.05.2008 11:24
Attachment: dpblnt.vcf (162 Bytes)
(Received via mailing list)
does that mean i should not try to use ruby1.9 with ruby-gtk2 yet?
i mean, if i work this around i'm gonna hit more like this?
Posted by Marc Heiler (shevegen)
on 18.05.2008 15:03
> if i work this around i'm gonna hit more like this?

I am not exactly sure where you are heading, but you are aware that 
ruby-1.9 in itself can be considered unstable or experimental right now?

It will take some time for people to bring everything up to shape,
but if you are using unstable versions already then you should
expect things to not work here or there more readily.

I think even Rails does not work with ruby 1.9
Posted by Dobai-Pataky Bálint (Guest)
on 18.05.2008 21:29
Attachment: dpblnt.vcf (162 Bytes)
(Received via mailing list)
Marc Heiler wrote:
>> if i work this around i'm gonna hit more like this?
>>     
>
> I am not exactly sure where you are heading, but you are aware that 
> ruby-1.9 in itself can be considered unstable or experimental right now?
>   
true, i didn't mean to be offensive. apologies if it looked that way.
i just tried to ask, if the "module_eval from C" issue is affecting
other functionalities, or just the .visible? method.
Posted by Kouhei Sutou (Guest)
on 20.05.2008 16:30
(Received via mailing list)
Hi,

In <4830822A.8060803@gmail.com>
  "Re: [ruby-gnome2-devel-en] Gtk::Widget.visible?" on Sun, 18 May 2008 
22:23:22 +0300,
  Dobai-Pataky Bálint <dpblnt@gmail.com> wrote:

> functionalities, or just the .visible? method.
> 

It affects other methods too.
You will find some of them by running ruby1.9 with -w
option.


Thanks,
--
kou