Forum: Ruby-Gnome 2 RVAL2BOXED and supporting Qnil

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-10 09:53
(Received via mailing list)
gtk_widget_modify_bg[1] supports passing NULL as the GdkColor* to undo
the effect of a previous call with a real color. I want to use that in
my program, but rg2 doesn't like it, as RVAL2BOXED doesn't like being
fed with Qnil.

What is a little misleading is that RVAL2GOBJ does support being fed
with Qnil :)

What do you think of the following patch?

--- glib/src/rbgobj_boxed.c  6 Jul 2007 15:56:20 -0000  1.26
+++ glib/src/rbgobj_boxed.c  10 Jul 2007 07:52:02 -0000
@@ -139,6 +139,9 @@
 {
     boxed_holder* holder;

+    if (obj == Qnil)
+      return NULL;
+
     if (!RTEST(rb_obj_is_kind_of(obj, GTYPE2CLASS(gtype))))
         rb_raise(rb_eArgError, "invalid argument %s (expect %s)",
                  rb_class2name(CLASS_OF(obj)),

[1]
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidg...

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This 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/
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2007-07-10 13:51
(Received via mailing list)
Hi,

> What do you think of the following patch?
>
> --- glib/src/rbgobj_boxed.c  6 Jul 2007 15:56:20 -0000  1.26
> +++ glib/src/rbgobj_boxed.c  10 Jul 2007 07:52:02 -0000
> @@ -139,6 +139,9 @@
>  {
>      boxed_holder* holder;
>
> +    if (obj == Qnil)

We should use NIL_P(obj) not obj == Qnil.

> +      return NULL;
> +


BTW, Guillaume, could you update ChangeLog too?


Thanks,
--
kou

-------------------------------------------------------------------------
This 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/
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-10 14:56
(Received via mailing list)
> > --- glib/src/rbgobj_boxed.c   6 Jul 2007 15:56:20 -0000       1.26
> > +++ glib/src/rbgobj_boxed.c   10 Jul 2007 07:52:02 -0000
> > @@ -139,6 +139,9 @@
> >  {
> >      boxed_holder* holder;
> >
> > +    if (obj == Qnil)
>
> We should use NIL_P(obj) not obj == Qnil.

Ok. Beside that, does it mean "go"?

> BTW, Guillaume, could you update ChangeLog too?

Normally, I use "cvs2cl" to generate a ChangeLog, as it's automatic.
But it seems that's not what rg2 is using. I've still to find an
automatic way to add to ChangeLog, if you want. Do you have any
suggestion?

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This 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/
9fe908f5593444a40be14a424c372e58?d=identicon&s=25 Masao Mutoh (Guest)
on 2007-07-10 16:00
(Received via mailing list)
Hi,

On Tue, 10 Jul 2007 14:55:46 +0200
"Guillaume Cottenceau" <gcottenc@gmail.com> wrote:

> Ok. Beside that, does it mean "go"?
Yes.

> > BTW, Guillaume, could you update ChangeLog too?
>
> Normally, I use "cvs2cl" to generate a ChangeLog, as it's automatic.
> But it seems that's not what rg2 is using. I've still to find an
> automatic way to add to ChangeLog, if you want. Do you have any
> suggestion?

Sometimes, we wrote the contributer's  but don't have
the CVS at the first line.

2007-0x-xx  Foo Bar  <foo@bar.com>   # Here

        * src/rbgtkwindow.c: Fixed Gtk::Window#icon= accept an path for
icon.

So we don't use the tools like cvs2cl.
I think Matz ruby has same policy, doesn't it?

But I don't know CVS well. If there are good idea to maintain them,
we can change the rule.

--
.:% Masao Mutoh<mutoh@highway.ne.jp>


-------------------------------------------------------------------------
This 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/
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-10 17:31
(Received via mailing list)
> > > We should use NIL_P(obj) not obj == Qnil.
> >
> > Ok. Beside that, does it mean "go"?
>
> Yes.

Ok, thanks.

> 2007-0x-xx  Foo Bar  <foo@bar.com>   # Here
>
>         * src/rbgtkwindow.c: Fixed Gtk::Window#icon= accept an path for icon.

I'm afraid I don't understand what you mean :/

> So we don't use the tools like cvs2cl.
> I think Matz ruby has same policy, doesn't it?

I have to confess I never contributed to Ruby itself :/

But probably they have a script like cvs2cl to automatically add to
the ChangeLog from cvs/svn commit log history?

> But I don't know CVS well. If there are good idea to maintain them,
> we can change the rule.

Basically, cvs2cl generates new ChangeLog entries based on cvs commit
logs messages themselves. So updating it is automatic.

For example, as of now the top part of a cvs2cl-generated ChangeLog
would be:

-=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-
2007-07-10 15:22  ggc

  * src/: rbgtkradiobutton.c, rbgtktoolbar.c: kou says we should use
    NIL_P(foo) not foo == Qnil

2007-07-10 15:17  ggc

  * sample/misc/tooltips.rb: demonstrate the new tooltip API of Gtk+
    2.12

2007-07-10 13:48  ktou

  * ChangeLog, src/rbgtktooltip.c: * src/rbgtktooltip.c: used C style
    comments not C++ style.

2007-07-10 10:07  ggc

  * src/rbgtktreestore.c: it's using variable arguments list, make it
    callable that way :)

2007-07-09 15:58  ggc

  * src/rbgtktooltip.c: stock ids manipulated as ruby symbols
-=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=-

The main problem, is that cvs2cl produces a slightly different format
of ChangeLog, so it's unable to just add new entries, it will insist
or regenerating it fully with the whole CVS history, which would be
rather fine but not perfect because it will lose all manually-added
changelogs messages of the past. Maybe that's acceptable though?

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This 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/
9fe908f5593444a40be14a424c372e58?d=identicon&s=25 Masao Mutoh (Guest)
on 2007-07-10 17:56
(Received via mailing list)
Hi,

On Tue, 10 Jul 2007 17:30:01 +0200
"Guillaume Cottenceau" <gcottenc@gmail.com> wrote:

> > 2007-0x-xx  Foo Bar  <foo@bar.com>   # Here
> >
> >         * src/rbgtkwindow.c: Fixed Gtk::Window#icon= accept an path for icon.
>
> I'm afraid I don't understand what you mean :/

Oops, I said "I remained the contributer's name as the author."

> > So we don't use the tools like cvs2cl.
> > I think Matz ruby has same policy, doesn't it?
>
> I have to confess I never contributed to Ruby itself :/
> But probably they have a script like cvs2cl to automatically add to
> the ChangeLog from cvs/svn commit log history?

Please check the ChangeLog of Ruby first.
I don't know how to update it though.
# Kou, do you know it?

> > But I don't know CVS well. If there are good idea to maintain them,
> > we can change the rule.
>
> Basically, cvs2cl generates new ChangeLog entries based on cvs commit
> logs messages themselves. So updating it is automatic.
>
> For example, as of now the top part of a cvs2cl-generated ChangeLog would be:

In your sample, all people become "commiters" only, don't they?
How can I write other contributer name as the author?

Anyway,  you need to update Changelog by hand until the rule will be
changed.

--
.:% Masao Mutoh<mutoh@highway.ne.jp>


-------------------------------------------------------------------------
This 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/
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-10 18:28
(Received via mailing list)
> In your sample, all people become "commiters" only, don't they?
> How can I write other contributer name as the author?

The name in the "head" of each changelog entry is the name of the
commiter, yes. But as usually you put the name of the contributor in
the commit log change, then it's just fine.

For example, my first commited contribution to rg2 appears like:

2005-08-19 19:28  mutoh

  * ChangeLog, src/rbgdkdisplay.c, src/rbgtkimage.c: *
    src/rbgtkimage.c (image_initialize): Fix a problem when first
    parameter is a String   and Second paramter is a
    Gtk::IconSize, not nil.  * src/rbgdkdisplay.c
    (gdkdisplay_s_open): Fix a problem if gdk_display_open returns
    NULL.    Reported by Guillaume Cottenceau.

So we see that you commited, but you credited me. That should be fine
for contributors crediting?

> Anyway,  you need to update Changelog by hand until the rule will be changed.

If we cannot agree on an automatic system, then I'll write a script,
and I'll be happy to add my previous entries with the help of the
script :)

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This 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/
9fe908f5593444a40be14a424c372e58?d=identicon&s=25 Masao Mutoh (Guest)
on 2007-07-10 18:39
(Received via mailing list)
Hi,

On Tue, 10 Jul 2007 18:23:02 +0200
"Guillaume Cottenceau" <gcottenc@gmail.com> wrote:

>
>   * ChangeLog, src/rbgdkdisplay.c, src/rbgtkimage.c: *
>     src/rbgtkimage.c (image_initialize): Fix a problem when first
>     parameter is a String   and Second paramter is a
>     Gtk::IconSize, not nil.  * src/rbgdkdisplay.c
>     (gdkdisplay_s_open): Fix a problem if gdk_display_open returns
>     NULL.    Reported by Guillaume Cottenceau.
>
> So we see that you commited, but you credited me. That should be fine
> for contributors crediting?

In this case, you just reported or give me incomplete patches.
When someone send me a complete patch and I accept it,
I used the contributer name as the author.

> > Anyway,  you need to update Changelog by hand until the rule will be changed.
>
> If we cannot agree on an automatic system, then I'll write a script,
> and I'll be happy to add my previous entries with the help of the
> script :)

Sorry, but I can't accept it now.

BTW, here is the midnight in Japan, I need to go bed.
I'll read your another mail tomorrow.

Thank you and Good night,
Masao.

--
.:% Masao Mutoh<mutoh@highway.ne.jp>


-------------------------------------------------------------------------
This 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/
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-10 20:47
(Received via mailing list)
> In this case, you just reported or give me incomplete patches.
> When someone send me a complete patch and I accept it,
> I used the contributer name as the author.

I see.

> > > Anyway,  you need to update Changelog by hand until the rule will be changed.
> >
> > If we cannot agree on an automatic system, then I'll write a script,
> > and I'll be happy to add my previous entries with the help of the
> > script :)
>
> Sorry, but I can't accept it now.

Then I can write a script for generating new changelog entries, I
think. I'll do that.

> BTW, here is the midnight in Japan, I need to go bed.
> I'll read your another mail tomorrow.

No problem. Good night :)

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This 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/
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2007-07-11 14:27
(Received via mailing list)
Hi,

In <20070711005525.0dc026b6.mutoh@highway.ne.jp>
  "Re: [ruby-gnome2-devel-en] RVAL2BOXED and supporting Qnil" on Wed, 11
Jul 2007 00:55:25 +0900,
  Masao Mutoh <mutoh@highway.ne.jp> wrote:

> Please check the ChangeLog of Ruby first.
> I don't know how to update it though.
> # Kou, do you know it?

I'm using C-x 4 a (add-change-log-entry-other-window) on
Emacs. Maybe other people are using that too.

> > Basically, cvs2cl generates new ChangeLog entries based on cvs commit
> > logs messages themselves. So updating it is automatic.
> >
> > For example, as of now the top part of a cvs2cl-generated ChangeLog would be:
>
> In your sample, all people become "commiters" only, don't they?
> How can I write other contributer name as the author?

In my case, I want to use 'Kouhei Sutou <kou@cozmixng.org>'
not SF.net user name 'ktou'.


Thanks,
--
kou

-------------------------------------------------------------------------
This 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/
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2007-07-11 15:52
(Received via mailing list)
> > Please check the ChangeLog of Ruby first.
> > I don't know how to update it though.
> > # Kou, do you know it?
>
> I'm using C-x 4 a (add-change-log-entry-other-window) on
> Emacs. Maybe other people are using that too.

I also use Emacs, and "C-x 4 a" looks cool as it properly adds to the
changelog file. However, how do you handle the actual message? Do you
have to duplicate it for the commit, or is it possible to write it in
the ChangeLog only, and then Emacs would use that for the commit?

> In my case, I want to use 'Kouhei Sutou <kou@cozmixng.org>'
> not SF.net user name 'ktou'.

This is easy to fix cvs2cl using -U.

I have made some rather deep research with cvs2cl. It's a somehow
obfuscated perl script :)

Let me explain again the benefits from cvs2cl. The main good thing is
that you commit first, with your log message - I use Emacs but you can
use commandline or any other tools -, second you use cvs2cl with
option "--accum", and it will accumulate all new entries from the
commit logs to the ChangeLog file. You may even do that only every
weeks (not after each commit) if you don't rely on ChangeLog being
complete anytime: nothing is lost because all new entries are
accumulated since the last run.

However, cvs2cl uses the date of each entry to know from what point to
accumulate. For that, the current date format with only the day but
not the hours is not enough. It needs the day and the hours for each
commit entry.

So, I think that if everyone adds new entries with the day and the
hours format, I'll be able to use cvs2cl --accum to add new changelog
entries corresponding to my commits, and you should not need to change
anything else from your current technics. Would that be possible for
you?

Another solution, maybe more fast for you: you could simply use the
same technics as me for adding to ChangeLog: use cvs2cl --accum; and
potentially, you may change the "name" of the commiter to credit a
contributor as Masao wants. That should be fast because it would mean
only changing the name of the commiter in the ChangeLog file (the rest
is already ok: date, affected files, commit log). Or you may just
credit the contributer in the commit log itself (I think this is done
for many projects for simplicity).

With this technics, you have no risk to lose any entry in the
ChangeLog, the messages are always completely accurate, and you don't
have to type twice (or copy paste) the commit logs.

Would either solution be fine for you?

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This 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/
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2007-07-12 13:57
(Received via mailing list)
Hi,

> > I'm using C-x 4 a (add-change-log-entry-other-window) on
> > Emacs. Maybe other people are using that too.
>
> I also use Emacs, and "C-x 4 a" looks cool as it properly adds to the
> changelog file. However, how do you handle the actual message? Do you
> have to duplicate it for the commit, or is it possible to write it in
> the ChangeLog only, and then Emacs would use that for the commit?

Yes. I need to kill & yank the message.
I'm using psvn (M-x svn-status) to commit for a project that
uses Subversion.


If Ruby-GNOME2 project migrates to Subversion from CVS, I
want to use svn-file-add-to-changelog in psvn.el to write
commit log in ChangeLog format. If we write the following
configurations to our ~/.emacs, svn-file-add-to-changelog
provides same interface as "C-x 4 a":

  (setq svn-status-prefix-key [(control x) ?v])
  (require 'psvn)

Now, we can use "C-x v f a" to write commit log in ChangeLog
format. But we need to use psvn.el in the Subversion
repository trunk...


Anyway, if we can write commit log in ChangeLog format
easily, we will be able to remove ChangeLog and
auto-generate ChangeLog.


Thanks,
--
kou


-------------------------------------------------------------------------
This 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/
0ffbc880048d21762a72f1b1f106587b?d=identicon&s=25 Masahiro Sakai (Guest)
on 2007-07-16 07:33
(Received via mailing list)
Hi,

From: Kouhei Sutou <kou@cozmixng.org>
Subject: Re: [ruby-gnome2-devel-en] RVAL2BOXED and supporting Qnil
Date: Thu, 12 Jul 2007 20:56:26 +0900 (JST)

> Hi,

> I'm using psvn (M-x svn-status) to commit for a project that
> uses Subversion.
>
>
> If Ruby-GNOME2 project migrates to Subversion from CVS, I
> want to use svn-file-add-to-changelog in psvn.el to write
> commit log in ChangeLog format.

BTW, I think Subversion is much nicer than CVS.
Mutoh-san, how do you think about migrating from CVS to Subversion?

Here is guidance of importing data into subversion.
http://sourceforge.net/docman/display_doc.php?doci...

-- Masahiro Sakai

-------------------------------------------------------------------------
This 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/
9fe908f5593444a40be14a424c372e58?d=identicon&s=25 Masao Mutoh (Guest)
on 2007-07-16 13:24
(Received via mailing list)
Hi,

On Mon, 16 Jul 2007 14:32:12 +0900 (JST)
Masahiro Sakai <sakai@tom.sfc.keio.ac.jp> wrote:

> >
> >
> > If Ruby-GNOME2 project migrates to Subversion from CVS, I
> > want to use svn-file-add-to-changelog in psvn.el to write
> > commit log in ChangeLog format.
>
> BTW, I think Subversion is much nicer than CVS.
> Mutoh-san, how do you think about migrating from CVS to Subversion?

Good.

But I don't have the time to spend with it.
Could you work for it?

--
.:% Masao Mutoh<mutoh@highway.ne.jp>


-------------------------------------------------------------------------
This 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/
0ffbc880048d21762a72f1b1f106587b?d=identicon&s=25 Masahiro Sakai (Guest)
on 2007-07-18 23:15
(Received via mailing list)
Hi,

From: Masao Mutoh <mutoh@highway.ne.jp>
Date: Mon, 16 Jul 2007 20:23:26 +0900

> Hi,
>
> On Mon, 16 Jul 2007 14:32:12 +0900 (JST)
> Masahiro Sakai <sakai@tom.sfc.keio.ac.jp> wrote:

> > BTW, I think Subversion is much nicer than CVS.
> > Mutoh-san, how do you think about migrating from CVS to Subversion?
>
> Good.
>
> But I don't have the time to spend with it.
> Could you work for it?

Okay.
If there are no objections I'll try to do it.

But it seems that actual importing step requires project manager's
privilege.  So please help me in this last step.

-- Masahiro Sakai

-------------------------------------------------------------------------
This 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/
This topic is locked and can not be replied to.