# Sharing some value to g\* casting?

**URL:** <https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600>\
**Category:** Ruby-Gnome 2\
**Created:** [September 15, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600 "2008-09-15T14:45:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 15, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/1 "2008-09-15T14:45:19Z")

</div>

We have e.g. the following duplicated definitions for casting a value  
to a treepath:

# grep -rw define.RVAL2TREEPATH . | grep -v svn

./gtk/src/rbgtktreerowreference.c:#define RVAL2TREEPATH(p)  
((GtkTreePath\*)RVAL2BOXED(p, GTK\_TYPE\_TREE\_PATH))  
./gtk/src/rbgtktreemodelfilter.c:#define RVAL2TREEPATH(s)  
((GtkTreePath\*)RVAL2BOXED(s, GTK\_TYPE\_TREE\_PATH))  
./gtk/src/rbgtktreeselection.c:#define RVAL2TREEPATH(p)  
((GtkTreePath\*)RVAL2BOXED(p, GTK\_TYPE\_TREE\_PATH))  
./gtk/src/rbgtktreemodel.c:#define RVAL2TREEPATH(p)  
((GtkTreePath\*)RVAL2BOXED(p, GTK\_TYPE\_TREE\_PATH))  
./gtk/src/rbgtktreeview.c:#define RVAL2TREEPATH(p)  
((GtkTreePath\*)RVAL2BOXED(p, GTK\_TYPE\_TREE\_PATH))  
./gtk/src/rbgtktreemodelsort.c:#define RVAL2TREEPATH(s)  
((GtkTreePath\*)RVAL2BOXED(s, GTK\_TYPE\_TREE\_PATH))

Wouldn’t it make sense to share them all (in a rbgtktreepath.h for  
example?)

–  
Guillaume C. - [http://zarb.org/~gc/](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 15, 2008, 3:16pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/2 "2008-09-15T15:16:15Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] sharing some value to g\* casting?” on Mon, 15  
Sep 2008 14:44:34 +0200,  
“Guillaume C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ./gtk/src/rbgtktreemodel.c:#define RVAL2TREEPATH(p)  
> ((GtkTreePath\*)RVAL2BOXED(p, GTK\_TYPE\_TREE\_PATH))  
> ./gtk/src/rbgtktreeview.c:#define RVAL2TREEPATH(p)  
> ((GtkTreePath\*)RVAL2BOXED(p, GTK\_TYPE\_TREE\_PATH))  
> ./gtk/src/rbgtktreemodelsort.c:#define RVAL2TREEPATH(s)  
> ((GtkTreePath\*)RVAL2BOXED(s, GTK\_TYPE\_TREE\_PATH))
> 
> Wouldn’t it make sense to share them all (in a rbgtktreepath.h for example?)

What about rbgtkprivate.h?

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 15, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/3 "2008-09-15T15:18:36Z")

</div>

> > Wouldn’t it make sense to share them all (in a rbgtktreepath.h for example?)
> 
> What about rbgtkprivate.h?

oh, that naming looks ok to me - though what about people writing  
small C extensions to ruby-gnome2 for their rg2-based ruby programs?  
maybe it would make sense for them to use these definitions as well?

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 15, 2008, 3:46pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/4 "2008-09-15T15:46:55Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] sharing some value to g\* casting?” on Mon,  
15 Sep 2008 15:05:41 +0200,  
“Guillaume C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > Wouldn’t it make sense to share them all (in a rbgtktreepath.h for example?)
> > 
> > What about rbgtkprivate.h?
> 
> oh, that naming looks ok to me - though what about people writing  
> small C extensions to ruby-gnome2 for their rg2-based ruby programs?  
> maybe it would make sense for them to use these definitions as well?

What about rbgtkconversions.h and rbgtk.h includes it?

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 16, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/5 "2008-09-16T15:12:08Z")

</div>

> What about rbgtkconversions.h and rbgtk.h includes it?

Ok. What about the attached patch, as a starting point? Of course more  
boxed values conversions would be good, after these ones  
(unfortunately the bulk of the patch is to change the ITR2RVAL pattern  
to TREEITER2RVAL which is more consistent, and much more  
understandable if we’re going for “global to rbgtk” conversions).

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 18, 2008, 2:52pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/6 "2008-09-18T14:52:24Z")

</div>

On Tue, Sep 16, 2008 at 3:29 PM, Kouhei S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > (unfortunately the bulk of the patch is to change the ITR2RVAL pattern  
> > to TREEITER2RVAL which is more consistent, and much more  
> > understandable if we’re going for “global to rbgtk” conversions).
> 
> I think we should add GTK prefix like GTKTREEITER2RVAL and  
> RVAL2GTKTREEITER. Otherwise look fine.

And keep TREEPATH2RVAL and RVAL2TREEPATH?

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 16, 2008, 3:30pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/7 "2008-09-16T15:30:23Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] sharing some value to g\* casting?” on Tue,  
16 Sep 2008 15:11:28 +0200,  
“Guillaume C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > What about rbgtkconversions.h and rbgtk.h includes it?
> 
> Ok. What about the attached patch, as a starting point? Of course more  
> boxed values conversions would be good, after these ones  
> (unfortunately the bulk of the patch is to change the ITR2RVAL pattern  
> to TREEITER2RVAL which is more consistent, and much more  
> understandable if we’re going for “global to rbgtk” conversions).

I think we should add GTK prefix like GTKTREEITER2RVAL and  
RVAL2GTKTREEITER. Otherwise look fine.

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![blueprint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cc9497/32.png) [@blueprint](https://www.ruby-forum.com/u/blueprint)\
**Post date:** [September 18, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/sharing-some-value-to-g-casting/148600/8 "2008-09-18T15:00:02Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] sharing some value to g\* casting?” on Thu,  
18 Sep 2008 14:52:03 +0200,  
“Guillaume C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > boxed values conversions would be good, after these ones  
> > > (unfortunately the bulk of the patch is to change the ITR2RVAL pattern  
> > > to TREEITER2RVAL which is more consistent, and much more  
> > > understandable if we’re going for “global to rbgtk” conversions).
> > 
> > I think we should add GTK prefix like GTKTREEITER2RVAL and  
> > RVAL2GTKTREEITER. Otherwise look fine.
> 
> And keep TREEPATH2RVAL and RVAL2TREEPATH?

I want to add GTK prefix to them.

## Thanks,

kou
