# \[patch\] Add hooks to create new fundamental types

**URL:** <https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300>\
**Category:** Ruby-Gnome 2\
**Created:** [May 3, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300 "2006-05-03T18:56:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 3, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/1 "2006-05-03T18:56:26Z")

</div>

Hi,

Attached patch adds the possibility to register new fundamental  
gobject types  
with the ruby gnome2 bindings. This is needed to be able to make  
bindings for  
gstreamer0.10.

For example usage please see [0]:  
[https://trac.luon.net/ruby-gstreamer0.10/file/trunk/ruby-gstreamer0.10/src/rbgstminiobject.c](https://trac.luon.net/ruby-gstreamer0.10/file/trunk/ruby-gstreamer0.10/src/rbgstminiobject.c)

Please comment,  
Sjoerd

0: These are indeed working gstreamer 0.10 bindings, i’ll make a proper  
announcement about them later.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 3, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/2 "2006-05-03T19:02:51Z")

</div>

On Sun, Apr 30, 2006 at 03:35:33PM +0200, Sjoerd S. wrote:

> Hi,
> 
> Attached patch adds the possibility to register new fundamental gobject  
> types with the ruby gnome2 bindings. This is needed to be able to make  
> bindings for gstreamer0.10.

Attached is an updated patch. This add code to use conversion functions  
registered with rbgobj\_register\_g2r\_func and rbgobj\_register\_r2g\_func  
not only  
if it was a boxed value, but also as a fullback for a normal value.

This makes it possible to register conversion functions for things like  
GST\_TYPE\_FRACTION, which is obviously needed if you want to bind  
gstreamer 0.10  
🙂

Also the interdiff between this and the previous patch is attached.

Thanks,  
Sjoerd

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 4, 2006, 11:29am UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/3 "2006-05-04T11:29:40Z")

</div>

Hi,

Attached rbgstminiobject.c is wrong.  
Don’t touch it, please :-).

On Thu, 4 May 2006 16:57:26 +0900  
Masao M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> Could you fix them?
> 
> - In gst\_miniobject\_get\_superclass, you shouldn’t use

## –

.:% Masao M.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

Using Tomcat but need to do more? Need to support web services,  
security?  
Get stuff done quickly with pre-integrated technology to make your job  
easier  
Download IBM WebSphere Application Server v.1.0.1 based on Apache  
Geronimo  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 4, 2006, 9:58am UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/4 "2006-05-04T09:58:32Z")

</div>

Hi,

On Sun, 30 Apr 2006 15:35:33 +0200  
removed\_email\_address@domain.invalid (Sjoerd S.) wrote:

> Hi,
> 
> Attached patch adds the possibility to register new fundamental gobject types  
> with the ruby gnome2 bindings. This is needed to be able to make bindings for  
> gstreamer0.10.
> 
> For example usage please see [0]:  
> [https://trac.luon.net/ruby-gstreamer0.10/file/trunk/ruby-gstreamer0.10/src/rbgstminiobject.c](https://trac.luon.net/ruby-gstreamer0.10/file/trunk/ruby-gstreamer0.10/src/rbgstminiobject.c)
> 
> Please comment,

Hmm. GstMiniObject … I don’t like it.

Anyway, your patch is nice.

I have some comments before I’ll apply it to CVS.  
Could you fix them?

- Merge rbgfundamental.h to rbgobject.h.  
I know why you separate it, but I don’t prefer many header files are  
installed to ruby-dir/site-ruby/1.8/i386-xxx/.
- Rename fundamental\_\* functions’ prefix as extern functions.  
rbgobj\_fundamental\ __, rbgfund\__ , rbgobj\_fund\_\* are recommanded.
- Added glib2.def above informations.
- I prefer camel case as the structure name for extern symbols.  
So rename fundamental\_type something like as RGFundamental.
- A typo found: fundamental\_intialize → fundamental\_initialize

> 0: These are indeed working gstreamer 0.10 bindings, i’ll make a proper  
> announcement about them later.

Good job!

Could you tell me how can I download latest one?  
I think it’s better to discuss with your newest ruby-gstreamer-0.10.

BTW, the comment below is for your rbgstminiobject.c.

- Typo? Gst::Miniobject should be Gst::MiniObject.
- In gst\_miniobject\_get\_superclass, you shouldn’t use  
GLib::Instantiatable here. Because it has some methods  
(like #signal\_foo) of GLib::Object which doesn’t have Gst::MiniObject.

Keep your great work 😉

Regards,  
Masao.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 4, 2006, 1:45pm UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/5 "2006-05-04T13:45:46Z")

</div>

On Thu, May 04, 2006 at 04:57:26PM +0900, Masao M. wrote:

> I have some comments before I’ll apply it to CVS.  
> Could you fix them?

No problem. I’ll try to send you a new patch in the beginning of next  
week.

> Could you tell me how can I download latest one?  
> I think it’s better to discuss with your newest ruby-gstreamer-0.10.

The full trac project page can be found at:  
[https://trac.luon.net/ruby-gstreamer0.10/](https://trac.luon.net/ruby-gstreamer0.10/)

Which includes a browser for the svn repository among other things.

Anonymous access to the svn repository is available through:  
[http://svn.luon.net/svn/ruby-gstreamer0.10/](http://svn.luon.net/svn/ruby-gstreamer0.10/)

And if you don’t want/can’t use svn for some reason, then the svn  
browser at  
[http://svn.luon.net](http://svn.luon.net) makes it possible to download tarballs of the  
current svn  
repository.

> BTW, the comment below is for your rbgstminiobject.c.
> 
> - Typo? Gst::Miniobject should be Gst::MiniObject.
> - In gst\_miniobject\_get\_superclass, you shouldn’t use  
> GLib::Instantiatable here. Because it has some methods  
> (like #signal\_foo) of GLib::Object which doesn’t have Gst::MiniObject.

Right, will need a closer look to decide the right superclass in this  
case.

## Sjoerd

A lifetime isn’t nearly long enough to figure out what it’s all about.

* * *

Using Tomcat but need to do more? Need to support web services,  
security?  
Get stuff done quickly with pre-integrated technology to make your job  
easier  
Download IBM WebSphere Application Server v.1.0.1 based on Apache  
Geronimo  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 9, 2006, 12:53pm UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/6 "2006-05-09T12:53:15Z")

</div>

On Thu, May 04, 2006 at 04:57:26PM +0900, Masao M. wrote:

> - Rename fundamental\_\* functions’ prefix as extern functions.  
> rbgobj\_fundamental\ __, rbgfund\__ , rbgobj\_fund\_\* are recommanded.
> - Added glib2.def above informations.
> - I prefer camel case as the structure name for extern symbols.  
> So rename fundamental\_type something like as RGFundamental.
> - A typo found: fundamental\_intialize -\> fundamental\_initialize

Ok, i’ve done the following things:

- Move things that should be public from rbgfundamental.h to  
rbgobject.h. And  
no longer install rbgfundamental.h. (public are just the function  
struct and  
G\_DEF\_FUNDAMENTAL)
- Prefix all hook functions with rbgobj\_fund instead of fundamental
- Rename the rbgfundamental files to rbgobj\_fundamental
- Rename the function struct to RGFundamental
- Add G\_DEF\_FUNDAMENTAL to glib2.def
- Fix the intialize/initialize typo

If there are more things that need to be changes, please lemme know 🙂

> - Typo? Gst::Miniobject should be Gst::MiniObject.

Fixed thanks!

> - In gst\_miniobject\_get\_superclass, you shouldn’t use  
> GLib::Instantiatable here. Because it has some methods  
> (like #signal\_foo) of GLib::Object which doesn’t have Gst::MiniObject.

Right, i’ve changed it so it’s just a subclass of the normal ruby Object  
now.  
With the addition of gtype and clone functions just lke  
GLib::Instantiatable  
has them. Thanks!

Sjoerd

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 9, 2006, 7:40pm UTC](https://www.ruby-forum.com/t/patch-add-hooks-to-create-new-fundamental-types/59300/7 "2006-05-09T19:40:51Z")

</div>

Hi Sjoerd,

Thanks.

I’ll try your patch carefully.  
But I’m so busy this weekday, so I’ll work it this weekend.

On Tue, 9 May 2006 12:51:16 +0200  
removed\_email\_address@domain.invalid (Sjoerd S.) wrote:

> > installed to ruby-dir/site-ruby/1.8/i386-xxx/.  
> > no longer install rbgfundamental.h. (public are just the function struct and
> 
> ## Sjoerd
> 
> In the next world, you’re on your own.

## –

.:% Masao M.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

Using Tomcat but need to do more? Need to support web services,  
security?  
Get stuff done quickly with pre-integrated technology to make your job  
easier  
Download IBM WebSphere Application Server v.1.0.1 based on Apache  
Geronimo  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)
