X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/584285fba4d518f8d6f581b542ee6b38650ba287..af338f4a78fec3685e39ce00bcc4cd891e7c0b60:/glib/gobject.lisp?ds=sidebyside diff --git a/glib/gobject.lisp b/glib/gobject.lisp index ae5995a..115a04c 100644 --- a/glib/gobject.lisp +++ b/glib/gobject.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gobject.lisp,v 1.53 2006-08-16 11:02:46 espen Exp $ +;; $Id: gobject.lisp,v 1.54 2006-08-16 12:09:03 espen Exp $ (in-package "GLIB") @@ -63,15 +63,6 @@ ()) -(defmethod slot-readable-p ((slotd standard-effective-slot-definition)) - (declare (ignore slotd)) - t) - -(defmethod slot-writable-p ((slotd standard-effective-slot-definition)) - (declare (ignore slotd)) - t) - - (defbinding %object-ref () pointer (location pointer)) @@ -151,38 +142,39 @@ (defmethod compute-slot-reader-function ((slotd effective-property-slot-definition) &optional signal-unbound-p) (declare (ignore signal-unbound-p)) - (if (slot-readable-p slotd) - (let* ((type (slot-definition-type slotd)) - (pname (slot-definition-pname slotd)) - (reader (reader-function type :ref :get))) - #'(lambda (object) - (with-memory (gvalue +gvalue-size+) - (%gvalue-init gvalue (find-type-number type)) - (%object-get-property object pname gvalue) - (funcall reader gvalue +gvalue-value-offset+)))) + (let* ((type (slot-definition-type slotd)) + (pname (slot-definition-pname slotd)) + (reader (reader-function type :ref :get))) + #'(lambda (object) + (with-memory (gvalue +gvalue-size+) + (%gvalue-init gvalue (find-type-number type)) + (%object-get-property object pname gvalue) + (funcall reader gvalue +gvalue-value-offset+))))) + +(defmethod compute-slot-writer-function :around ((slotd effective-property-slot-definition)) + (if (construct-only-property-p slotd) + #'(lambda (value object) + (declare (ignore value object)) + (unless *ignore-setting-construct-only-property* + (error 'unwritable-slot :name (slot-definition-name slotd) :instance object))) (call-next-method))) (defmethod compute-slot-writer-function ((slotd effective-property-slot-definition)) - (cond - ((slot-writable-p slotd) - (let* ((type (slot-definition-type slotd)) - (pname (slot-definition-pname slotd)) - (writer (writer-function type :temp t)) - (destroy (destroy-function type :temp t))) - #'(lambda (value object) - (with-memory (gvalue +gvalue-size+) - (%gvalue-init gvalue (find-type-number type)) - (funcall writer value gvalue +gvalue-value-offset+) - (%object-set-property object pname gvalue) - (funcall destroy gvalue +gvalue-value-offset+)) - value))) - - ((construct-only-property-p slotd) + (let* ((type (slot-definition-type slotd)) + (pname (slot-definition-pname slotd)) + (writer (writer-function type :temp t)) + (destroy (destroy-function type :temp t))) #'(lambda (value object) - (declare (ignore value object)) - (unless *ignore-setting-construct-only-property* - (error 'unwritable-slot :name (slot-definition-name slotd) :instance object)))) - ((call-next-method)))) + (with-memory (gvalue +gvalue-size+) + (%gvalue-init gvalue (find-type-number type)) + (funcall writer value gvalue +gvalue-value-offset+) + (%object-set-property object pname gvalue) + (funcall destroy gvalue +gvalue-value-offset+)) + value))) + +(defmethod slot-readable-p ((slotd effective-user-data-slot-definition)) + (declare (ignore slotd)) + t) (defmethod compute-slot-reader-function ((slotd effective-user-data-slot-definition) &optional signal-unbound-p) (declare (ignore signal-unbound-p)) @@ -195,6 +187,10 @@ #'(lambda (object) (user-data-p object slot-name)))) +(defmethod slot-writable-p ((slotd effective-user-data-slot-definition)) + (declare (ignore slotd)) + t) + (defmethod compute-slot-writer-function ((slotd effective-user-data-slot-definition)) (let ((slot-name (slot-definition-name slotd))) #'(lambda (value object)