# \[BUG\] can't get properties

**URL:** <https://www.ruby-forum.com/t/bug-cant-get-properties/106546>\
**Category:** Ruby-Gnome 2\
**Created:** [June 11, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/bug-cant-get-properties/106546 "2007-06-11T20:40:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 11, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/bug-cant-get-properties/106546/1 "2007-06-11T20:40:10Z")

</div>

Hi,

with the current ruby gnome from CVS i can’t get object properties. The  
following example:

#!/usr/bin/ruby

require ‘gtk2’

class Win  
def initialize  
@win = Gtk::Window.new  
@win.title = “a test”  
@button = Gtk::Button.new ‘press me!’  
@button.signal\_connect(‘clicked’) do  
p @win.property(‘title’)  
end  
@win \<\< @button  
@win.show\_all  
end  
end

win = Win.new  
Gtk.main

throws this error message:

det@datengrab:~/Desktop$ ruby proptest.rb  
proptest.rb:11:in `property': can't get gobject class information from proptest.rb:11:in `initialize’  
from proptest.rb:22:in `call' from proptest.rb:22:in `main’  
from proptest.rb:22

Or did i missed something?

Cheers detlef

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 13, 2007, 3:55am UTC](https://www.ruby-forum.com/t/bug-cant-get-properties/106546/2 "2007-06-13T03:55:04Z")

</div>

Hi Detief here is Julio Sosa, nice example to get the object  
properties, try to run this.

#------------------------------------------------  
#|how you can see i have been replaced the

p @win.property(‘title’), with

p @win.title

now this the result " a test", i hope be helpful for you n\_\_\_n

the error, well u r trying to call an inexistent method for the  
Gtk::Window class

you can read more about the gtk API here,

[http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AWindow#Instance+Methods](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AWindow#Instance+Methods)

#!/usr/bin/ruby

require ‘gtk2’

class Win  
def initialize  
@win = Gtk::Window.new  
@win.title = “a test”  
@button = Gtk::Button.new ‘press me!’  
@button.signal\_connect(‘clicked’) do  
p @win.title  
end  
@win \<\< @button  
@win.show\_all  
end  
end

win = Win.new  
Gtk.main

cheers dude!!  
#------------------------------------------------------

2007/6/11, Detlef R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> end
> 
> Cheers detlef  
> [ruby-gnome2-devel-en List Signup and Options](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 14, 2007, 7:02pm UTC](https://www.ruby-forum.com/t/bug-cant-get-properties/106546/3 "2007-06-14T19:02:51Z")

</div>

Am Donnerstag, den 14.06.2007, 00:49 +0900 schrieb Masao M.:

> > ```
> > @button.signal_connect('clicked') do
> > 
> > ```
> > 
> > Or did i missed something?
> 
> At first, you need to use @win.get\_property(“title”) for getting the property  
> variables.

Hi,

thanks allot, i must be blind :-/

I have looked at GLib::Object.property, which is a module function and  
not at the instance methodes.

Now my extension works like expected 🙂

> [http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> removed\_email\_address@domain.invalid  
> [ruby-gnome2-devel-en List Signup and Options](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)

---

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 13, 2007, 5:50pm UTC](https://www.ruby-forum.com/t/bug-cant-get-properties/106546/4 "2007-06-13T17:50:37Z")

</div>

Hi,

On Mon, 11 Jun 2007 20:08:14 +0200  
Detlef R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> with the current ruby gnome from CVS i can’t get object properties. The  
> following example:  
>   
> @button.signal\_connect(‘clicked’) do  
> p @win.property(‘title’)  
> end  
>   
> det@datengrab:~/Desktop$ ruby proptest.rb  
> proptest.rb:11:in `property': can't get gobject class information from proptest.rb:11:in `initialize’  
> from proptest.rb:22:in `call' from proptest.rb:22:in `main’  
> from proptest.rb:22
> 
> Or did i missed something?

At first, you need to use @win.get\_property(“title”) for getting the  
property  
variables.

Secondly, there is the GLib::Interface#property method but this is a  
bug.

- This should be a module function, not instance method.
- The method name should be #get\_property(str), not property(str).

I’ll change this method as a module function not instanfce method.

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)
