(let* ((uri* (->uri* uri 'open-input-gfile))
(gfile (make-gfile uri*))
(gstream (gfile-read gfile))
- (port (make-generic-i/o-port (make-g-stream-source gstream) #f)))
+ (port (make-generic-i/o-port (make-g-stream-source gstream) #f
+ 'open-input-gfile)))
;;(port/set-coding port 'ISO-8859-1)
;;(port/set-line-ending port 'NEWLINE)
(gobject-unref! gfile)
(else (loop again (fix:1+ count)))))))
(define (make-g-stream-source gstream)
- ;; Not unlike make-non-channel-port-source in genio.scm.
+ ;; Not unlike make-non-channel-ss in genio.scm.
(let ((port #f)
(open? #t))
- (make-gsource
- (named-lambda (g-stream-source/get-channel)
- #f)
+ (make-source/sink
+ 'source
+ #f
(named-lambda (g-stream-source/get-port)
port)
- (named-lambda (g-stream-source/set-port port*)
+ (named-lambda (g-stream-source/set-port! port*)
(set! port port*))
(named-lambda (g-stream-source/open?)
open?)
(let ((value (g-input-stream-close gstream)))
(set! open? #f)
value)))
- (named-lambda (g-stream-source/has-bytes?)
- #t)
- (named-lambda (g-stream-source/read-bytes buffer start end)
- (g-input-stream-read gstream buffer start end)))))
+ (vector
+ (named-lambda (g-stream-source/has-bytes?)
+ #t)
+ (named-lambda (g-stream-source/read-bytes buffer start end)
+ (g-input-stream-read gstream buffer start end))))))
(define (open-output-gfile uri)
(let* ((uri* (->uri* uri 'open-output-gfile))
(gfile (make-gfile uri*))
(gstream (gfile-replace gfile #f #t 'private))
- (port (make-generic-i/o-port #f (make-g-stream-sink gstream))))
+ (port (make-generic-i/o-port #f (make-g-stream-sink gstream)
+ 'open-output-gfile)))
;;(port/set-coding port 'ISO-8859-1)
;;(port/set-line-ending port 'NEWLINE)
(gobject-unref! gfile)
port))
(define (make-g-stream-sink gstream)
- ;; Not unlike make-non-channel-port-sink in genio.scm.
+ ;; Not unlike make-non-channel-ss in genio.scm.
(let ((port #f)
(open? #t))
- (make-gsink
- (named-lambda (g-stream-sink/get-channel)
- #f)
+ (make-source/sink
+ 'sink
+ #f
(named-lambda (g-stream-sink/get-port)
port)
- (named-lambda (g-stream-sink/set-port port*)
+ (named-lambda (g-stream-sink/set-port! port*)
(set! port port*))
(named-lambda (g-stream-sink/open?)
open?)
(let ((value (g-output-stream-close gstream)))
(set! open? #f)
value)))
- (named-lambda (g-stream-sink/write-bytes buffer start end)
- (g-output-stream-write gstream buffer start end)))))
+ (vector
+ (named-lambda (g-stream-sink/write-bytes buffer start end)
+ (g-output-stream-write gstream buffer start end))))))
(define (gdirectory-read uri)
(let* ((uri* (->uri* uri 'gdirectory-read))
(define-method initialize-instance ((gfile <gfile>))
(call-next-method gfile)
(let ((alien (gobject-alien gfile))
- (uri (uri->string (gfile-uri gfile))))
+ (uri (string->utf8 (uri->string (gfile-uri gfile)))))
(set-alien/ctype! alien '|GFile|)
- (guarantee-utf8-string uri)
(C-call "g_file_new_for_uri" alien uri)
(error-if-null alien "Could not create:" gfile uri)))