Hi!
I pushed some rather sizable changes to SVN, primarily in gtk2. I
removed all methods that implement methods already implemented as
properties. I also removed unnecessary/superfluous/frivolous calls to
G_DEF_SETTERS(), as G_DEF_SETTERS() isn’t exactly fast.
I noticed something while doing this, however. If HAVE_NODE_ATTRASGN
is set, rbgobj_define_property_accessors uses alias for properties, so
all rb_undef_method() in gtk2 for methods that redefine properties may
need rb_undef_method() for the #attribute= method as well (followed by
a matching G_DEF_SETTER()). HAVE_NODE_ATTRASGN only seems to be set
for Ruby 1.7, however, so this shouldn’t really be a problem.
On Mon, Sep 12, 2011 at 17:15, Nikolai W. [email protected] wrote:
I noticed something while doing this, however. If HAVE_NODE_ATTRASGN
is set, rbgobj_define_property_accessors uses alias for properties, so
all rb_undef_method() in gtk2 for methods that redefine properties may
need rb_undef_method() for the #attribute= method as well (followed by
a matching G_DEF_SETTER()). HAVE_NODE_ATTRASGN only seems to be set
for Ruby 1.7, however, so this shouldn’t really be a problem.
As I suspected, this is causing problems. I don’t understand how this
has worked in the past, but I’m adding a new pair of macros
G_REPLACE_PROPERTY() and G_REPLACE_PROPERTY_AND_SETTER() that we can
use:
#define G_REPLACE_PROPERTY(klass, name, function, args)
rb_undef_method(klass, “set_” name);
rb_define_method(klass, “set_” name, function, args)
#define G_REPLACE_PROPERTY_AND_SETTER(klass, name, function, args)
G_REPLACE_PROPERTY(klass, name, function, args);
rb_undef_method(klass, name “=”);
G_DEF_SETTER(klass, name)
I will apply this patch later today once I get everything in place.