[gjs] [gi] don't redefine special methods on every prototype; use inheritance



commit c2303db2e89a0783af91f749f0b5946af3ac96c3
Author: Dan Winship <danw gnome org>
Date:   Thu Jun 17 13:15:28 2010 -0400

    [gi] don't redefine special methods on every prototype; use inheritance
    
    Instead of defining "connect", "toString", etc, on each class
    prototype, only define them on the GLib.Object prototype, and let
    everything else just inherit them. (This makes it easier to override
    one of them (eg, toString) on a hierarchy of subclasses.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=621911

 gi/object.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gi/object.c b/gi/object.c
index 703c41e..caacce5 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -1378,9 +1378,9 @@ gjs_define_object_class(JSContext     *context,
                                        /* number of constructor args */
                                        0,
                                        /* props of prototype */
-                                       &gjs_object_instance_proto_props[0],
+                                       parent_proto ? NULL : &gjs_object_instance_proto_props[0],
                                        /* funcs of prototype */
-                                       &gjs_object_instance_proto_funcs[0],
+                                       parent_proto ? NULL : &gjs_object_instance_proto_funcs[0],
                                        /* props of constructor, MyConstructor.myprop */
                                        NULL,
                                        /* funcs of constructor, MyConstructor.myfunc() */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]